VTK  9.3.1
vtkFieldDataToAttributeDataFilter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
46 #ifndef vtkFieldDataToAttributeDataFilter_h
47 #define vtkFieldDataToAttributeDataFilter_h
48 
49 #include "vtkDataSetAlgorithm.h"
50 #include "vtkFiltersCoreModule.h" // For export macro
51 
52 #define VTK_DATA_OBJECT_FIELD 0
53 #define VTK_POINT_DATA_FIELD 1
54 #define VTK_CELL_DATA_FIELD 2
55 
56 #define VTK_CELL_DATA 0
57 #define VTK_POINT_DATA 1
58 
59 VTK_ABI_NAMESPACE_BEGIN
60 class vtkDataArray;
62 class vtkFieldData;
63 
64 class VTKFILTERSCORE_EXPORT vtkFieldDataToAttributeDataFilter : public vtkDataSetAlgorithm
65 {
66 public:
67  void PrintSelf(ostream& os, vtkIndent indent) override;
69 
75 
77 
83  vtkSetMacro(InputField, int);
84  vtkGetMacro(InputField, int);
85  void SetInputFieldToDataObjectField() { this->SetInputField(VTK_DATA_OBJECT_FIELD); }
86  void SetInputFieldToPointDataField() { this->SetInputField(VTK_POINT_DATA_FIELD); }
87  void SetInputFieldToCellDataField() { this->SetInputField(VTK_CELL_DATA_FIELD); }
89 
91 
94  vtkSetMacro(OutputAttributeData, int);
95  vtkGetMacro(OutputAttributeData, int);
96  void SetOutputAttributeDataToCellData() { this->SetOutputAttributeData(VTK_CELL_DATA); }
97  void SetOutputAttributeDataToPointData() { this->SetOutputAttributeData(VTK_POINT_DATA); }
99 
101 
108  void SetScalarComponent(
109  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
110  void SetScalarComponent(int comp, const char* arrayName, int arrayComp)
111  {
112  this->SetScalarComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
113  }
114  const char* GetScalarComponentArrayName(int comp);
115  int GetScalarComponentArrayComponent(int comp);
116  int GetScalarComponentMinRange(int comp);
117  int GetScalarComponentMaxRange(int comp);
118  int GetScalarComponentNormalizeFlag(int comp);
120 
122 
129  void SetVectorComponent(
130  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
131  void SetVectorComponent(int comp, const char* arrayName, int arrayComp)
132  {
133  this->SetVectorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
134  }
135  const char* GetVectorComponentArrayName(int comp);
136  int GetVectorComponentArrayComponent(int comp);
137  int GetVectorComponentMinRange(int comp);
138  int GetVectorComponentMaxRange(int comp);
139  int GetVectorComponentNormalizeFlag(int comp);
141 
143 
150  void SetNormalComponent(
151  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
152  void SetNormalComponent(int comp, const char* arrayName, int arrayComp)
153  {
154  this->SetNormalComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
155  }
156  const char* GetNormalComponentArrayName(int comp);
157  int GetNormalComponentArrayComponent(int comp);
158  int GetNormalComponentMinRange(int comp);
159  int GetNormalComponentMaxRange(int comp);
160  int GetNormalComponentNormalizeFlag(int comp);
162 
164 
171  void SetTensorComponent(
172  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
173  void SetTensorComponent(int comp, const char* arrayName, int arrayComp)
174  {
175  this->SetTensorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
176  }
177  const char* GetTensorComponentArrayName(int comp);
178  int GetTensorComponentArrayComponent(int comp);
179  int GetTensorComponentMinRange(int comp);
180  int GetTensorComponentMaxRange(int comp);
181  int GetTensorComponentNormalizeFlag(int comp);
183 
185 
192  void SetTCoordComponent(
193  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
194  void SetTCoordComponent(int comp, const char* arrayName, int arrayComp)
195  {
196  this->SetTCoordComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
197  }
198  const char* GetTCoordComponentArrayName(int comp);
199  int GetTCoordComponentArrayComponent(int comp);
200  int GetTCoordComponentMinRange(int comp);
201  int GetTCoordComponentMaxRange(int comp);
202  int GetTCoordComponentNormalizeFlag(int comp);
204 
206 
210  vtkSetMacro(DefaultNormalize, vtkTypeBool);
211  vtkGetMacro(DefaultNormalize, vtkTypeBool);
212  vtkBooleanMacro(DefaultNormalize, vtkTypeBool);
214 
215  // Helper functions, made public to support other classes
216 
222  static int GetComponentsType(int numComp, vtkDataArray** arrays);
223 
230  static int ConstructArray(vtkDataArray* da, int comp, vtkDataArray* fieldArray, int fieldComp,
231  vtkIdType min, vtkIdType max, int normalize);
232 
236  static vtkDataArray* GetFieldArray(vtkFieldData* fd, const char* name, int comp);
237 
241  static void SetArrayName(vtkObject* self, char*& name, const char* newName);
242 
247  static int UpdateComponentRange(vtkDataArray* da, vtkIdType compRange[2]);
248 
253 
254 protected:
257 
259  vtkInformationVector*) override; // generate output data
260 
263 
264  int NumberOfScalarComponents; // the number of components to fill-in
265  char* ScalarArrays[4]; // the name of the arrays used to construct the scalar
266  int ScalarArrayComponents[4]; // the components of the arrays used to construct
267  vtkIdType ScalarComponentRange[4][2]; // the range of the components to use
268  int ScalarNormalize[4]; // flags control normalization
269 
270  char* VectorArrays[3]; // the name of the arrays used to construct the vectors
271  int VectorArrayComponents[3]; // the components of the arrays used to construct
272  vtkIdType VectorComponentRange[3][2]; // the range of the components to use
273  int VectorNormalize[3]; // flags control normalization
274 
275  char* GhostLevelArray; // the name of the array used to construct the ghost levels
276  int GhostLevelArrayComponent; // the component of the array used to construct
277  vtkIdType GhostLevelComponentRange[2]; // the range of the components to use
278  int GhostLevelNormalize; // flags control normalization
279 
280  char* NormalArrays[3]; // the name of the arrays used to construct the normals
281  int NormalArrayComponents[3]; // the components of the arrays used to construct
282  vtkIdType NormalComponentRange[3][2]; // the range of the components to use
283  int NormalNormalize[3]; // flags control normalization
284 
285  char* TensorArrays[9]; // the name of the arrays used to construct the tensors
286  int TensorArrayComponents[9]; // the components of the arrays used to construct
287  vtkIdType TensorComponentRange[9][2]; // the range of the components to use
288  int TensorNormalize[9]; // flags control normalization
289 
290  int NumberOfTCoordComponents; // the number of components to fill-in
291  char* TCoordArrays[3]; // the name of the arrays used to construct the tcoords
292  int TCoordArrayComponents[3]; // the components of the arrays used to construct
293  vtkIdType TCoordComponentRange[3][2]; // the range of the components to use
294  int TCoordNormalize[3]; // flags control normalization
295 
297 
298  void ConstructScalars(int num, vtkFieldData* fd, vtkDataSetAttributes* attr,
299  vtkIdType componentRange[4][2], char* arrays[4], int arrayComponents[4], int normalize[4],
300  int numComp);
301  void ConstructVectors(int num, vtkFieldData* fd, vtkDataSetAttributes* attr,
302  vtkIdType componentRange[3][2], char* arrays[3], int arrayComponents[3], int normalize[3]);
303  void ConstructGhostLevels(int num, vtkFieldData* fd, vtkDataSetAttributes* attr,
304  vtkIdType componentRange[2], char* array, int arrayComponent, int normalize);
305  void ConstructNormals(int num, vtkFieldData* fd, vtkDataSetAttributes* attr,
306  vtkIdType componentRange[3][2], char* arrays[3], int arrayComponents[3], int normalize[3]);
307  void ConstructTCoords(int num, vtkFieldData* fd, vtkDataSetAttributes* attr,
308  vtkIdType componentRange[3][2], char* arrays[3], int arrayComponents[3], int normalize[3],
309  int numComp);
310  void ConstructTensors(int num, vtkFieldData* fd, vtkDataSetAttributes* attr,
311  vtkIdType componentRange[9][2], char* arrays[9], int arrayComponents[9], int normalize[9]);
312  void ConstructFieldData(int num, vtkDataSetAttributes* attr);
313 
314 private:
316  void operator=(const vtkFieldDataToAttributeDataFilter&) = delete;
317 };
318 
319 VTK_ABI_NAMESPACE_END
320 #endif
#define VTK_POINT_DATA_FIELD
abstract base class for most VTK objects
Definition: vtkObject.h:51
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:315
int vtkTypeBool
Definition: vtkABI.h:64
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:28
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:44
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:51