VTK
vtkSplitField.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSplitField.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
56 #ifndef vtkSplitField_h
57 #define vtkSplitField_h
58 
59 #include "vtkFiltersGeneralModule.h" // For export macro
60 #include "vtkDataSetAlgorithm.h"
61 
62 #include "vtkDataSetAttributes.h" // Needed for NUM_ATTRIBUTES
63 
64 class vtkFieldData;
65 
67 {
68 public:
70  void PrintSelf(ostream& os, vtkIndent indent);
71 
73  static vtkSplitField *New();
74 
77  void SetInputField(int attributeType, int fieldLoc);
78 
81  void SetInputField(const char* name, int fieldLoc);
82 
85  void SetInputField(const char* name, const char* fieldLoc);
86 
88  void Split(int component, const char* arrayName);
89 
90 //BTX
92  {
93  DATA_OBJECT=0,
94  POINT_DATA=1,
95  CELL_DATA=2
96  };
97 //ETX
98 
99 //BTX
100  struct Component
101  {
102  int Index;
103  char* FieldName;
104  Component* Next; // linked list
105  void SetName(const char* name)
106  {
107  delete[] this->FieldName;
108  this->FieldName = 0;
109  if (name)
110  {
111  this->FieldName = new char[strlen(name)+1];
112  strcpy(this->FieldName, name);
113  }
114  }
115  Component() { FieldName = 0; }
116  ~Component() { delete[] FieldName; }
117  };
118 //ETX
119 
120 protected:
121 
122 //BTX
124  {
126  ATTRIBUTE
127  };
128 //ETX
129 
130  vtkSplitField();
131  virtual ~vtkSplitField();
132 
134 
135  char* FieldName;
139 
140  static char FieldLocationNames[3][12];
141  static char AttributeNames[vtkDataSetAttributes::NUM_ATTRIBUTES][10];
142 
143  vtkDataArray* SplitArray(vtkDataArray* da, int component);
144 
145 
146  // Components are stored as a linked list.
149 
150  // Methods to browse/modify the linked list.
152  { return op->Next; }
154  { return this->Head; }
155  void AddComponent(Component* op);
156  Component* FindComponent(int index);
157  void DeleteAllComponents();
158 
159  void PrintComponent(Component* op, ostream& os, vtkIndent indent);
160  void PrintAllComponents(ostream& os, vtkIndent indent);
161 private:
162  vtkSplitField(const vtkSplitField&); // Not implemented.
163  void operator=(const vtkSplitField&); // Not implemented.
164 };
165 
166 #endif
167 
168 
Component * GetNextComponent(Component *op)
Store vtkAlgorithm input/output information.
void SetName(const char *name)
a simple class to control print indentation
Definition: vtkIndent.h:38
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
#define VTKFILTERSGENERAL_EXPORT
Split a field into single component fields.
Definition: vtkSplitField.h:66
Store zero or more vtkInformation instances.
void PrintSelf(ostream &os, vtkIndent indent)
Superclass for algorithms that produce output of the same type as input.
Component * GetFirst()
static vtkDataSetAlgorithm * New()
Component * Head
represent and manipulate fields of data
Definition: vtkFieldData.h:55
Component * Tail