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 =========================================================================*/
55 #ifndef vtkFieldDataToAttributeDataFilter_h
56 #define vtkFieldDataToAttributeDataFilter_h
57 
58 #include "vtkFiltersCoreModule.h" // For export macro
59 #include "vtkDataSetAlgorithm.h"
60 
61 #define VTK_DATA_OBJECT_FIELD 0
62 #define VTK_POINT_DATA_FIELD 1
63 #define VTK_CELL_DATA_FIELD 2
64 
65 #define VTK_CELL_DATA 0
66 #define VTK_POINT_DATA 1
67 
68 class vtkDataArray;
70 class vtkFieldData;
71 
72 class VTKFILTERSCORE_EXPORT vtkFieldDataToAttributeDataFilter : public vtkDataSetAlgorithm
73 {
74 public:
75  void PrintSelf(ostream& os, vtkIndent indent) override;
77 
83 
85 
91  vtkSetMacro(InputField,int);
92  vtkGetMacro(InputField,int);
94  {this->SetInputField(VTK_DATA_OBJECT_FIELD);};
96  {this->SetInputField(VTK_POINT_DATA_FIELD);};
98  {this->SetInputField(VTK_CELL_DATA_FIELD);};
100 
102 
105  vtkSetMacro(OutputAttributeData,int);
106  vtkGetMacro(OutputAttributeData,int);
108  {this->SetOutputAttributeData(VTK_CELL_DATA);};
110  {this->SetOutputAttributeData(VTK_POINT_DATA);};
112 
114 
121  void SetScalarComponent(int comp, const char *arrayName, int arrayComp,
122  int min, int max, int normalize);
123  void SetScalarComponent(int comp, const char *arrayName, int arrayComp)
124  {this->SetScalarComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
125  const char *GetScalarComponentArrayName(int comp);
126  int GetScalarComponentArrayComponent(int comp);
127  int GetScalarComponentMinRange(int comp);
128  int GetScalarComponentMaxRange(int comp);
129  int GetScalarComponentNormalizeFlag(int comp);
131 
133 
140  void SetVectorComponent(int comp, const char *arrayName, int arrayComp,
141  int min, int max, int normalize);
142  void SetVectorComponent(int comp, const char *arrayName, int arrayComp)
143  {this->SetVectorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
144  const char *GetVectorComponentArrayName(int comp);
145  int GetVectorComponentArrayComponent(int comp);
146  int GetVectorComponentMinRange(int comp);
147  int GetVectorComponentMaxRange(int comp);
148  int GetVectorComponentNormalizeFlag(int comp);
150 
152 
159  void SetNormalComponent(int comp, const char *arrayName, int arrayComp,
160  int min, int max, int normalize);
161  void SetNormalComponent(int comp, const char *arrayName, int arrayComp)
162  {this->SetNormalComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
163  const char *GetNormalComponentArrayName(int comp);
164  int GetNormalComponentArrayComponent(int comp);
165  int GetNormalComponentMinRange(int comp);
166  int GetNormalComponentMaxRange(int comp);
167  int GetNormalComponentNormalizeFlag(int comp);
169 
171 
178  void SetTensorComponent(int comp, const char *arrayName, int arrayComp,
179  int min, int max, int normalize);
180  void SetTensorComponent(int comp, const char *arrayName, int arrayComp)
181  {this->SetTensorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
182  const char *GetTensorComponentArrayName(int comp);
183  int GetTensorComponentArrayComponent(int comp);
184  int GetTensorComponentMinRange(int comp);
185  int GetTensorComponentMaxRange(int comp);
186  int GetTensorComponentNormalizeFlag(int comp);
188 
190 
197  void SetTCoordComponent(int comp, const char *arrayName, int arrayComp,
198  int min, int max, int normalize);
199  void SetTCoordComponent(int comp, const char *arrayName, int arrayComp)
200  {this->SetTCoordComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
201  const char *GetTCoordComponentArrayName(int comp);
202  int GetTCoordComponentArrayComponent(int comp);
203  int GetTCoordComponentMinRange(int comp);
204  int GetTCoordComponentMaxRange(int comp);
205  int GetTCoordComponentNormalizeFlag(int comp);
207 
209 
213  vtkSetMacro(DefaultNormalize,vtkTypeBool);
214  vtkGetMacro(DefaultNormalize,vtkTypeBool);
215  vtkBooleanMacro(DefaultNormalize,vtkTypeBool);
217 
218  // Helper functions, made public to support other classes
219 
225  static int GetComponentsType(int numComp, vtkDataArray **arrays);
226 
233  static int ConstructArray(vtkDataArray *da, int comp, vtkDataArray *frray,
234  int fieldComp, vtkIdType min, vtkIdType max,
235  int normalize);
236 
240  static vtkDataArray *GetFieldArray(vtkFieldData *fd, char *name, int comp);
241 
245  static void SetArrayName(vtkObject *self, char* &name, const char *newName);
246 
251  static int UpdateComponentRange(vtkDataArray *da, vtkIdType compRange[2]);
252 
257 
258 protected:
261 
262  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override; //generate output data
263 
266 
267  int NumberOfScalarComponents; //the number of components to fill-in
268  char *ScalarArrays[4]; //the name of the arrays used to construct the scalar
269  int ScalarArrayComponents[4]; //the components of the arrays used to construct
270  vtkIdType ScalarComponentRange[4][2]; //the range of the components to use
271  int ScalarNormalize[4]; //flags control normalization
272 
273  char *VectorArrays[3]; //the name of the arrays used to construct the vectors
274  int VectorArrayComponents[3]; //the components of the arrays used to construct
275  vtkIdType VectorComponentRange[3][2]; //the range of the components to use
276  int VectorNormalize[3]; //flags control normalization
277 
278  char *GhostLevelArray; //the name of the array used to construct the ghost levels
279  int GhostLevelArrayComponent; //the component of the array used to construct
280  vtkIdType GhostLevelComponentRange[2]; //the range of the components to use
281  int GhostLevelNormalize; //flags control normalization
282 
283  char *NormalArrays[3]; //the name of the arrays used to construct the normals
284  int NormalArrayComponents[3]; //the components of the arrays used to construct
285  vtkIdType NormalComponentRange[3][2]; //the range of the components to use
286  int NormalNormalize[3]; //flags control normalization
287 
288  char *TensorArrays[9]; //the name of the arrays used to construct the tensors
289  int TensorArrayComponents[9]; //the components of the arrays used to construct
290  vtkIdType TensorComponentRange[9][2]; //the range of the components to use
291  int TensorNormalize[9]; //flags control normalization
292 
293  int NumberOfTCoordComponents; //the number of components to fill-in
294  char *TCoordArrays[3]; //the name of the arrays used to construct the tcoords
295  int TCoordArrayComponents[3]; //the components of the arrays used to construct
296  vtkIdType TCoordComponentRange[3][2]; //the range of the components to use
297  int TCoordNormalize[3]; //flags control normalization
298 
300 
301  void ConstructScalars(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
302  vtkIdType componentRange[4][2], char *arrays[4],
303  int arrayComponents[4], int normalize[4], int numComp);
304  void ConstructVectors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
305  vtkIdType componentRange[3][2], char *arrays[3],
306  int arrayComponents[3], int normalize[3]);
307  void ConstructGhostLevels(int num, vtkFieldData *fd,
308  vtkDataSetAttributes *attr,
309  vtkIdType componentRange[2],
310  char *array, int arrayComponent, int normalize);
311  void ConstructNormals(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
312  vtkIdType componentRange[3][2], char *arrays[3],
313  int arrayComponents[3], int normalize[3]);
314  void ConstructTCoords(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
315  vtkIdType componentRange[3][2], char *arrays[3],
316  int arrayComponents[3], int normalize[3], int numComp);
317  void ConstructTensors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr,
318  vtkIdType componentRange[9][2], char *arrays[9],
319  int arrayComponents[9], int normalize[9]);
320  void ConstructFieldData(int num, vtkDataSetAttributes *attr);
321 
322 private:
324  void operator=(const vtkFieldDataToAttributeDataFilter&) = delete;
325 };
326 
327 #endif
328 
329 
#define VTK_POINT_DATA_FIELD
abstract base class for most VTK objects
Definition: vtkObject.h:53
void SetTCoordComponent(int comp, const char *arrayName, int arrayComp)
Define the components of the field to be used for the cell texture coord components.
Store vtkAlgorithm input/output information.
void SetVectorComponent(int comp, const char *arrayName, int arrayComp)
Define the component(s) of the field to be used for the vector components.
map field data to dataset attribute data
int vtkIdType
Definition: vtkType.h:345
int vtkTypeBool
Definition: vtkABI.h:69
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetInputFieldToCellDataField()
Specify which field data to use to generate the output attribute data.
a simple class to control print indentation
Definition: vtkIndent.h:33
void SetOutputAttributeDataToPointData()
Specify which attribute data to output: point or cell data attributes.
void SetScalarComponent(int comp, const char *arrayName, int arrayComp)
Define the component(s) of the field to be used for the scalar components.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when a request asks the algorithm to do its work.
represent and manipulate attribute data in a dataset
void SetInputFieldToPointDataField()
Specify which field data to use to generate the output attribute data.
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when each filter in the pipeline decides what portion of its inp...
void SetNormalComponent(int comp, const char *arrayName, int arrayComp)
Define the component(s) of the field to be used for the normal components.
#define VTK_DATA_OBJECT_FIELD
void SetTensorComponent(int comp, const char *arrayName, int arrayComp)
Define the components of the field to be used for the tensor components.
void SetOutputAttributeDataToCellData()
Specify which attribute data to output: point or cell data attributes.
Store zero or more vtkInformation instances.
Superclass for algorithms that produce output of the same type as input.
void SetInputFieldToDataObjectField()
Specify which field data to use to generate the output attribute data.
#define VTK_CELL_DATA_FIELD
static vtkDataSetAlgorithm * New()
#define max(a, b)
represent and manipulate fields of data
Definition: vtkFieldData.h:53