VTK
vtkFieldDataToAttributeDataFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkFieldDataToAttributeDataFilter.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 =========================================================================*/
57 #ifndef vtkFieldDataToAttributeDataFilter_h
58 #define vtkFieldDataToAttributeDataFilter_h
59 
60 #include "vtkFiltersCoreModule.h" // For export macro
61 #include "vtkDataSetAlgorithm.h"
62 
63 #define VTK_DATA_OBJECT_FIELD 0
64 #define VTK_POINT_DATA_FIELD 1
65 #define VTK_CELL_DATA_FIELD 2
66 
67 #define VTK_CELL_DATA 0
68 #define VTK_POINT_DATA 1
69 
70 class vtkDataArray;
72 class vtkFieldData;
73 
75 {
76 public:
77  void PrintSelf(ostream& os, vtkIndent indent);
79 
83 
85 
89  vtkSetMacro(InputField,int);
90  vtkGetMacro(InputField,int);
92  {this->SetInputField(VTK_DATA_OBJECT_FIELD);};
94  {this->SetInputField(VTK_POINT_DATA_FIELD);};
96  {this->SetInputField(VTK_CELL_DATA_FIELD);};
98 
100 
102  vtkSetMacro(OutputAttributeData,int);
103  vtkGetMacro(OutputAttributeData,int);
105  {this->SetOutputAttributeData(VTK_CELL_DATA);};
107  {this->SetOutputAttributeData(VTK_POINT_DATA);};
109 
111 
116  void SetScalarComponent(int comp, const char *arrayName, int arrayComp,
117  int min, int max, int normalize);
118  void SetScalarComponent(int comp, const char *arrayName, int arrayComp)
119  {this->SetScalarComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
120  const char *GetScalarComponentArrayName(int comp);
121  int GetScalarComponentArrayComponent(int comp);
122  int GetScalarComponentMinRange(int comp);
123  int GetScalarComponentMaxRange(int comp);
124  int GetScalarComponentNormalizeFlag(int comp);
126 
128 
133  void SetVectorComponent(int comp, const char *arrayName, int arrayComp,
134  int min, int max, int normalize);
135  void SetVectorComponent(int comp, const char *arrayName, int arrayComp)
136  {this->SetVectorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
137  const char *GetVectorComponentArrayName(int comp);
138  int GetVectorComponentArrayComponent(int comp);
139  int GetVectorComponentMinRange(int comp);
140  int GetVectorComponentMaxRange(int comp);
141  int GetVectorComponentNormalizeFlag(int comp);
143 
145 
150  void SetNormalComponent(int comp, const char *arrayName, int arrayComp,
151  int min, int max, int normalize);
152  void SetNormalComponent(int comp, const char *arrayName, int arrayComp)
153  {this->SetNormalComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
154  const char *GetNormalComponentArrayName(int comp);
155  int GetNormalComponentArrayComponent(int comp);
156  int GetNormalComponentMinRange(int comp);
157  int GetNormalComponentMaxRange(int comp);
158  int GetNormalComponentNormalizeFlag(int comp);
160 
162 
167  void SetTensorComponent(int comp, const char *arrayName, int arrayComp,
168  int min, int max, int normalize);
169  void SetTensorComponent(int comp, const char *arrayName, int arrayComp)
170  {this->SetTensorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
171  const char *GetTensorComponentArrayName(int comp);
172  int GetTensorComponentArrayComponent(int comp);
173  int GetTensorComponentMinRange(int comp);
174  int GetTensorComponentMaxRange(int comp);
175  int GetTensorComponentNormalizeFlag(int comp);
177 
179 
184  void SetTCoordComponent(int comp, const char *arrayName, int arrayComp,
185  int min, int max, int normalize);
186  void SetTCoordComponent(int comp, const char *arrayName, int arrayComp)
187  {this->SetTCoordComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
188  const char *GetTCoordComponentArrayName(int comp);
189  int GetTCoordComponentArrayComponent(int comp);
190  int GetTCoordComponentMinRange(int comp);
191  int GetTCoordComponentMaxRange(int comp);
192  int GetTCoordComponentNormalizeFlag(int comp);
194 
196 
198  vtkSetMacro(DefaultNormalize,int);
199  vtkGetMacro(DefaultNormalize,int);
200  vtkBooleanMacro(DefaultNormalize,int);
202 
203  // Helper functions, made public to support other classes
204 
208  static int GetComponentsType(int numComp, vtkDataArray **arrays);
209 
211 
215  static int ConstructArray(vtkDataArray *da, int comp, vtkDataArray *frray,
216  int fieldComp, vtkIdType min, vtkIdType max,
217  int normalize);
219 
222  static vtkDataArray *GetFieldArray(vtkFieldData *fd, char *name, int comp);
223 
225  static void SetArrayName(vtkObject *self, char* &name, const char *newName);
226 
227 //BTX
229 
231  static int UpdateComponentRange(vtkDataArray *da, vtkIdType compRange[2]);
232 //ETX
234 
237 
238 protected:
241 
242  virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); //generate output data
243 
246 
247  int NumberOfScalarComponents; //the number of components to fill-in
248  char *ScalarArrays[4]; //the name of the arrays used to construct the scalar
249  int ScalarArrayComponents[4]; //the components of the arrays used to construct
250  vtkIdType ScalarComponentRange[4][2]; //the range of the components to use
251  int ScalarNormalize[4]; //flags control normalization
252 
253  char *VectorArrays[3]; //the name of the arrays used to construct the vectors
254  int VectorArrayComponents[3]; //the components of the arrays used to construct
255  vtkIdType VectorComponentRange[3][2]; //the range of the components to use
256  int VectorNormalize[3]; //flags control normalization
257 
258  char *GhostLevelArray; //the name of the array used to construct the ghost levels
259  int GhostLevelArrayComponent; //the component of the array used to construct
260  vtkIdType GhostLevelComponentRange[2]; //the range of the components to use
261  int GhostLevelNormalize; //flags control normalization
262 
263  char *NormalArrays[3]; //the name of the arrays used to construct the normals
264  int NormalArrayComponents[3]; //the components of the arrays used to construct
265  vtkIdType NormalComponentRange[3][2]; //the range of the components to use
266  int NormalNormalize[3]; //flags control normalization
267 
268  char *TensorArrays[9]; //the name of the arrays used to construct the tensors
269  int TensorArrayComponents[9]; //the components of the arrays used to construct
270  vtkIdType TensorComponentRange[9][2]; //the range of the components to use
271  int TensorNormalize[9]; //flags control normalization
272 
273  int NumberOfTCoordComponents; //the number of components to fill-in
274  char *TCoordArrays[3]; //the name of the arrays used to construct the tcoords
275  int TCoordArrayComponents[3]; //the components of the arrays used to construct
276  vtkIdType TCoordComponentRange[3][2]; //the range of the components to use
277  int TCoordNormalize[3]; //flags control normalization
278 
280 
281  void ConstructScalars(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
282  vtkIdType componentRange[4][2], char *arrays[4],
283  int arrayComponents[4], int normalize[4], int numComp);
284  void ConstructVectors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
285  vtkIdType componentRange[3][2], char *arrays[3],
286  int arrayComponents[3], int normalize[3]);
287  void ConstructGhostLevels(int num, vtkFieldData *fd,
288  vtkDataSetAttributes *attr,
289  vtkIdType componentRange[2],
290  char *array, int arrayComponent, int normalize);
291  void ConstructNormals(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
292  vtkIdType componentRange[3][2], char *arrays[3],
293  int arrayComponents[3], int normalize[3]);
294  void ConstructTCoords(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
295  vtkIdType componentRange[3][2], char *arrays[3],
296  int arrayComponents[3], int normalize[3], int numComp);
297  void ConstructTensors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
298  vtkIdType componentRange[9][2], char *arrays[9],
299  int arrayComponents[9], int normalize[9]);
300  void ConstructFieldData(int num, vtkDataSetAttributes *attr);
301 
302 private:
304  void operator=(const vtkFieldDataToAttributeDataFilter&); // Not implemented.
305 };
306 
307 #endif
308 
309 
#define VTK_POINT_DATA_FIELD
abstract base class for most VTK objects
Definition: vtkObject.h:61
void SetTCoordComponent(int comp, const char *arrayName, int arrayComp)
Store vtkAlgorithm input/output information.
#define VTKFILTERSCORE_EXPORT
void SetVectorComponent(int comp, const char *arrayName, int arrayComp)
map field data to dataset attribute data
int vtkIdType
Definition: vtkType.h:275
a simple class to control print indentation
Definition: vtkIndent.h:38
void SetScalarComponent(int comp, const char *arrayName, int arrayComp)
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
represent and manipulate attribute data in a dataset
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
void SetNormalComponent(int comp, const char *arrayName, int arrayComp)
#define VTK_DATA_OBJECT_FIELD
void SetTensorComponent(int comp, const char *arrayName, int arrayComp)
Store zero or more vtkInformation instances.
void PrintSelf(ostream &os, vtkIndent indent)
Superclass for algorithms that produce output of the same type as input.
#define VTK_CELL_DATA_FIELD
static vtkDataSetAlgorithm * New()
#define max(a, b)
represent and manipulate fields of data
Definition: vtkFieldData.h:55