VTK  9.2.6
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 =========================================================================*/
58 #ifndef vtkFieldDataToAttributeDataFilter_h
59 #define vtkFieldDataToAttributeDataFilter_h
60 
61 #include "vtkDataSetAlgorithm.h"
62 #include "vtkFiltersCoreModule.h" // For export macro
63 
64 #define VTK_DATA_OBJECT_FIELD 0
65 #define VTK_POINT_DATA_FIELD 1
66 #define VTK_CELL_DATA_FIELD 2
67 
68 #define VTK_CELL_DATA 0
69 #define VTK_POINT_DATA 1
70 
71 class vtkDataArray;
73 class vtkFieldData;
74 
75 class VTKFILTERSCORE_EXPORT vtkFieldDataToAttributeDataFilter : public vtkDataSetAlgorithm
76 {
77 public:
78  void PrintSelf(ostream& os, vtkIndent indent) override;
80 
86 
88 
94  vtkSetMacro(InputField, int);
95  vtkGetMacro(InputField, int);
96  void SetInputFieldToDataObjectField() { this->SetInputField(VTK_DATA_OBJECT_FIELD); }
97  void SetInputFieldToPointDataField() { this->SetInputField(VTK_POINT_DATA_FIELD); }
98  void SetInputFieldToCellDataField() { this->SetInputField(VTK_CELL_DATA_FIELD); }
100 
102 
105  vtkSetMacro(OutputAttributeData, int);
106  vtkGetMacro(OutputAttributeData, int);
107  void SetOutputAttributeDataToCellData() { this->SetOutputAttributeData(VTK_CELL_DATA); }
108  void SetOutputAttributeDataToPointData() { this->SetOutputAttributeData(VTK_POINT_DATA); }
110 
112 
119  void SetScalarComponent(
120  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
121  void SetScalarComponent(int comp, const char* arrayName, int arrayComp)
122  {
123  this->SetScalarComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
124  }
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(
141  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
142  void SetVectorComponent(int comp, const char* arrayName, int arrayComp)
143  {
144  this->SetVectorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
145  }
146  const char* GetVectorComponentArrayName(int comp);
147  int GetVectorComponentArrayComponent(int comp);
148  int GetVectorComponentMinRange(int comp);
149  int GetVectorComponentMaxRange(int comp);
150  int GetVectorComponentNormalizeFlag(int comp);
152 
154 
161  void SetNormalComponent(
162  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
163  void SetNormalComponent(int comp, const char* arrayName, int arrayComp)
164  {
165  this->SetNormalComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
166  }
167  const char* GetNormalComponentArrayName(int comp);
168  int GetNormalComponentArrayComponent(int comp);
169  int GetNormalComponentMinRange(int comp);
170  int GetNormalComponentMaxRange(int comp);
171  int GetNormalComponentNormalizeFlag(int comp);
173 
175 
182  void SetTensorComponent(
183  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
184  void SetTensorComponent(int comp, const char* arrayName, int arrayComp)
185  {
186  this->SetTensorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
187  }
188  const char* GetTensorComponentArrayName(int comp);
189  int GetTensorComponentArrayComponent(int comp);
190  int GetTensorComponentMinRange(int comp);
191  int GetTensorComponentMaxRange(int comp);
192  int GetTensorComponentNormalizeFlag(int comp);
194 
196 
203  void SetTCoordComponent(
204  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
205  void SetTCoordComponent(int comp, const char* arrayName, int arrayComp)
206  {
207  this->SetTCoordComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
208  }
209  const char* GetTCoordComponentArrayName(int comp);
210  int GetTCoordComponentArrayComponent(int comp);
211  int GetTCoordComponentMinRange(int comp);
212  int GetTCoordComponentMaxRange(int comp);
213  int GetTCoordComponentNormalizeFlag(int comp);
215 
217 
221  vtkSetMacro(DefaultNormalize, vtkTypeBool);
222  vtkGetMacro(DefaultNormalize, vtkTypeBool);
223  vtkBooleanMacro(DefaultNormalize, vtkTypeBool);
225 
226  // Helper functions, made public to support other classes
227 
233  static int GetComponentsType(int numComp, vtkDataArray** arrays);
234 
241  static int ConstructArray(vtkDataArray* da, int comp, vtkDataArray* fieldArray, int fieldComp,
242  vtkIdType min, vtkIdType max, int normalize);
243 
247  static vtkDataArray* GetFieldArray(vtkFieldData* fd, const char* name, int comp);
248 
252  static void SetArrayName(vtkObject* self, char*& name, const char* newName);
253 
258  static int UpdateComponentRange(vtkDataArray* da, vtkIdType compRange[2]);
259 
264 
265 protected:
268 
270  vtkInformationVector*) override; // generate output data
271 
274 
275  int NumberOfScalarComponents; // the number of components to fill-in
276  char* ScalarArrays[4]; // the name of the arrays used to construct the scalar
277  int ScalarArrayComponents[4]; // the components of the arrays used to construct
278  vtkIdType ScalarComponentRange[4][2]; // the range of the components to use
279  int ScalarNormalize[4]; // flags control normalization
280 
281  char* VectorArrays[3]; // the name of the arrays used to construct the vectors
282  int VectorArrayComponents[3]; // the components of the arrays used to construct
283  vtkIdType VectorComponentRange[3][2]; // the range of the components to use
284  int VectorNormalize[3]; // flags control normalization
285 
286  char* GhostLevelArray; // the name of the array used to construct the ghost levels
287  int GhostLevelArrayComponent; // the component of the array used to construct
288  vtkIdType GhostLevelComponentRange[2]; // the range of the components to use
289  int GhostLevelNormalize; // flags control normalization
290 
291  char* NormalArrays[3]; // the name of the arrays used to construct the normals
292  int NormalArrayComponents[3]; // the components of the arrays used to construct
293  vtkIdType NormalComponentRange[3][2]; // the range of the components to use
294  int NormalNormalize[3]; // flags control normalization
295 
296  char* TensorArrays[9]; // the name of the arrays used to construct the tensors
297  int TensorArrayComponents[9]; // the components of the arrays used to construct
298  vtkIdType TensorComponentRange[9][2]; // the range of the components to use
299  int TensorNormalize[9]; // flags control normalization
300 
301  int NumberOfTCoordComponents; // the number of components to fill-in
302  char* TCoordArrays[3]; // the name of the arrays used to construct the tcoords
303  int TCoordArrayComponents[3]; // the components of the arrays used to construct
304  vtkIdType TCoordComponentRange[3][2]; // the range of the components to use
305  int TCoordNormalize[3]; // flags control normalization
306 
308 
309  void ConstructScalars(int num, vtkFieldData* fd, vtkDataSetAttributes* attr,
310  vtkIdType componentRange[4][2], char* arrays[4], int arrayComponents[4], int normalize[4],
311  int numComp);
312  void ConstructVectors(int num, vtkFieldData* fd, vtkDataSetAttributes* attr,
313  vtkIdType componentRange[3][2], char* arrays[3], int arrayComponents[3], int normalize[3]);
314  void ConstructGhostLevels(int num, vtkFieldData* fd, vtkDataSetAttributes* attr,
315  vtkIdType componentRange[2], char* array, int arrayComponent, int normalize);
316  void ConstructNormals(int num, vtkFieldData* fd, vtkDataSetAttributes* attr,
317  vtkIdType componentRange[3][2], char* arrays[3], int arrayComponents[3], int normalize[3]);
318  void ConstructTCoords(int num, vtkFieldData* fd, vtkDataSetAttributes* attr,
319  vtkIdType componentRange[3][2], char* arrays[3], int arrayComponents[3], int normalize[3],
320  int numComp);
321  void ConstructTensors(int num, vtkFieldData* fd, vtkDataSetAttributes* attr,
322  vtkIdType componentRange[9][2], char* arrays[9], int arrayComponents[9], int normalize[9]);
323  void ConstructFieldData(int num, vtkDataSetAttributes* attr);
324 
325 private:
327  void operator=(const vtkFieldDataToAttributeDataFilter&) = delete;
328 };
329 
330 #endif
#define VTK_POINT_DATA_FIELD
abstract base class for most VTK objects
Definition: vtkObject.h:62
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:332
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:39
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:55
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:62