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 =========================================================================*/
67 #ifndef vtkFieldDataToAttributeDataFilter_h
68 #define vtkFieldDataToAttributeDataFilter_h
69 
70 #include "vtkDataSetAlgorithm.h"
71 #include "vtkFiltersCoreModule.h" // For export macro
72 
73 #define VTK_DATA_OBJECT_FIELD 0
74 #define VTK_POINT_DATA_FIELD 1
75 #define VTK_CELL_DATA_FIELD 2
76 
77 #define VTK_CELL_DATA 0
78 #define VTK_POINT_DATA 1
79 
80 class vtkDataArray;
82 class vtkFieldData;
83 
84 class VTKFILTERSCORE_EXPORT vtkFieldDataToAttributeDataFilter : public vtkDataSetAlgorithm
85 {
86 public:
87  void PrintSelf(ostream& os, vtkIndent indent) override;
89 
95 
97 
103  vtkSetMacro(InputField, int);
104  vtkGetMacro(InputField, int);
105  void SetInputFieldToDataObjectField() { this->SetInputField(VTK_DATA_OBJECT_FIELD); }
106  void SetInputFieldToPointDataField() { this->SetInputField(VTK_POINT_DATA_FIELD); }
107  void SetInputFieldToCellDataField() { this->SetInputField(VTK_CELL_DATA_FIELD); }
109 
111 
114  vtkSetMacro(OutputAttributeData, int);
115  vtkGetMacro(OutputAttributeData, int);
116  void SetOutputAttributeDataToCellData() { this->SetOutputAttributeData(VTK_CELL_DATA); }
117  void SetOutputAttributeDataToPointData() { this->SetOutputAttributeData(VTK_POINT_DATA); }
119 
121 
129  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
130  void SetScalarComponent(int comp, const char* arrayName, int arrayComp)
131  {
132  this->SetScalarComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
133  }
134  const char* GetScalarComponentArrayName(int comp);
140 
142 
150  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
151  void SetVectorComponent(int comp, const char* arrayName, int arrayComp)
152  {
153  this->SetVectorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
154  }
155  const char* GetVectorComponentArrayName(int comp);
161 
163 
171  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
172  void SetNormalComponent(int comp, const char* arrayName, int arrayComp)
173  {
174  this->SetNormalComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
175  }
176  const char* GetNormalComponentArrayName(int comp);
182 
184 
192  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
193  void SetTensorComponent(int comp, const char* arrayName, int arrayComp)
194  {
195  this->SetTensorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
196  }
197  const char* GetTensorComponentArrayName(int comp);
203 
205 
213  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
214  void SetTCoordComponent(int comp, const char* arrayName, int arrayComp)
215  {
216  this->SetTCoordComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
217  }
218  const char* GetTCoordComponentArrayName(int comp);
224 
226 
230  vtkSetMacro(DefaultNormalize, vtkTypeBool);
231  vtkGetMacro(DefaultNormalize, vtkTypeBool);
232  vtkBooleanMacro(DefaultNormalize, vtkTypeBool);
234 
235  // Helper functions, made public to support other classes
236 
242  static int GetComponentsType(int numComp, vtkDataArray** arrays);
243 
250  static int ConstructArray(vtkDataArray* da, int comp, vtkDataArray* fieldArray, int fieldComp,
251  vtkIdType min, vtkIdType max, int normalize);
252 
256  static vtkDataArray* GetFieldArray(vtkFieldData* fd, const char* name, int comp);
257 
261  static void SetArrayName(vtkObject* self, char*& name, const char* newName);
262 
267  static int UpdateComponentRange(vtkDataArray* da, vtkIdType compRange[2]);
268 
273 
274 protected:
277 
279  vtkInformationVector*) override; // generate output data
280 
283 
284  int NumberOfScalarComponents; // the number of components to fill-in
285  char* ScalarArrays[4]; // the name of the arrays used to construct the scalar
286  int ScalarArrayComponents[4]; // the components of the arrays used to construct
287  vtkIdType ScalarComponentRange[4][2]; // the range of the components to use
288  int ScalarNormalize[4]; // flags control normalization
289 
290  char* VectorArrays[3]; // the name of the arrays used to construct the vectors
291  int VectorArrayComponents[3]; // the components of the arrays used to construct
292  vtkIdType VectorComponentRange[3][2]; // the range of the components to use
293  int VectorNormalize[3]; // flags control normalization
294 
295  char* GhostLevelArray; // the name of the array used to construct the ghost levels
296  int GhostLevelArrayComponent; // the component of the array used to construct
297  vtkIdType GhostLevelComponentRange[2]; // the range of the components to use
298  int GhostLevelNormalize; // flags control normalization
299 
300  char* NormalArrays[3]; // the name of the arrays used to construct the normals
301  int NormalArrayComponents[3]; // the components of the arrays used to construct
302  vtkIdType NormalComponentRange[3][2]; // the range of the components to use
303  int NormalNormalize[3]; // flags control normalization
304 
305  char* TensorArrays[9]; // the name of the arrays used to construct the tensors
306  int TensorArrayComponents[9]; // the components of the arrays used to construct
307  vtkIdType TensorComponentRange[9][2]; // the range of the components to use
308  int TensorNormalize[9]; // flags control normalization
309 
310  int NumberOfTCoordComponents; // the number of components to fill-in
311  char* TCoordArrays[3]; // the name of the arrays used to construct the tcoords
312  int TCoordArrayComponents[3]; // the components of the arrays used to construct
313  vtkIdType TCoordComponentRange[3][2]; // the range of the components to use
314  int TCoordNormalize[3]; // flags control normalization
315 
317 
319  vtkIdType componentRange[4][2], char* arrays[4], int arrayComponents[4], int normalize[4],
320  int numComp);
322  vtkIdType componentRange[3][2], char* arrays[3], int arrayComponents[3], int normalize[3]);
324  vtkIdType componentRange[2], char* array, int arrayComponent, int normalize);
326  vtkIdType componentRange[3][2], char* arrays[3], int arrayComponents[3], int normalize[3]);
328  vtkIdType componentRange[3][2], char* arrays[3], int arrayComponents[3], int normalize[3],
329  int numComp);
331  vtkIdType componentRange[9][2], char* arrays[9], int arrayComponents[9], int normalize[9]);
333 
334 private:
336  void operator=(const vtkFieldDataToAttributeDataFilter&) = delete;
337 };
338 
339 #endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:65
Superclass for algorithms that produce output of the same type as input.
represent and manipulate attribute data in a dataset
map field data to dataset attribute data
void SetOutputAttributeDataToPointData()
Specify which attribute data to output: point or cell data attributes.
static int GetComponentsType(int numComp, vtkDataArray **arrays)
Given an array of names of arrays in field data, return the common type for these arrays.
int GetNormalComponentMinRange(int comp)
Define the component(s) of the field to be used for the normal components.
void SetOutputAttributeDataToCellData()
Specify which attribute data to output: point or cell data attributes.
void SetInputFieldToCellDataField()
Specify which field data to use to generate the output attribute data.
int GetTensorComponentMaxRange(int comp)
Define the components of the field to be used for the tensor components.
int GetNormalComponentMaxRange(int comp)
Define the component(s) of the field to be used for the normal components.
void SetTensorComponent(int comp, const char *arrayName, int arrayComp)
Define the components of the field to be used for the tensor components.
void ConstructNormals(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, vtkIdType componentRange[3][2], char *arrays[3], int arrayComponents[3], int normalize[3])
static int UpdateComponentRange(vtkDataArray *da, vtkIdType compRange[2])
Update the maximum and minimum component range values.
void ConstructVectors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, vtkIdType componentRange[3][2], char *arrays[3], int arrayComponents[3], int normalize[3])
const char * GetTensorComponentArrayName(int comp)
Define the components of the field to be used for the tensor components.
static void SetArrayName(vtkObject *self, char *&name, const char *newName)
Specify an array name for one of the components.
static vtkDataArray * GetFieldArray(vtkFieldData *fd, const char *name, int comp)
Return an array of a particular name from field data and do error checking.
const char * GetNormalComponentArrayName(int comp)
Define the component(s) of the field to be used for the normal components.
void SetInputFieldToDataObjectField()
Specify which field data to use to generate the output attribute data.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int GetTCoordComponentArrayComponent(int comp)
Define the components of the field to be used for the cell texture coord components.
void ConstructFieldData(int num, vtkDataSetAttributes *attr)
void ConstructTCoords(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, vtkIdType componentRange[3][2], char *arrays[3], int arrayComponents[3], int normalize[3], int numComp)
void SetNormalComponent(int comp, const char *arrayName, int arrayComp)
Define the component(s) of the field to be used for the normal components.
int GetTCoordComponentMaxRange(int comp)
Define the components of the field to be used for the cell texture coord components.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when a request asks the algorithm to do its work.
int GetTensorComponentMinRange(int comp)
Define the components of the field to be used for the tensor components.
static int ConstructArray(vtkDataArray *da, int comp, vtkDataArray *fieldArray, int fieldComp, vtkIdType min, vtkIdType max, int normalize)
Construct a portion of a data array (the comp portion) from another data array and its component.
int GetVectorComponentArrayComponent(int comp)
Define the component(s) of the field to be used for the vector components.
const char * GetScalarComponentArrayName(int comp)
Define the component(s) of the field to be used for the scalar components.
const char * GetTCoordComponentArrayName(int comp)
Define the components of the field to be used for the cell texture coord components.
int GetTensorComponentNormalizeFlag(int comp)
Define the components of the field to be used for the tensor components.
int GetScalarComponentMinRange(int comp)
Define the component(s) of the field to be used for the scalar components.
void SetVectorComponent(int comp, const char *arrayName, int arrayComp, int min, int max, int normalize)
Define the component(s) of the field to be used for the vector components.
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
If output does not need exact extent, the I do not either.
int GetVectorComponentMaxRange(int comp)
Define the component(s) of the field to be used for the vector components.
int GetTensorComponentArrayComponent(int comp)
Define the components of the field to be used for the tensor components.
static vtkFieldDataToAttributeDataFilter * New()
Construct object with input field set to the data object field, and the output attribute data set to ...
const char * GetVectorComponentArrayName(int comp)
Define the component(s) of the field to be used for the vector components.
void SetTCoordComponent(int comp, const char *arrayName, int arrayComp)
Define the components of the field to be used for the cell texture coord components.
void SetScalarComponent(int comp, const char *arrayName, int arrayComp, int min, int max, int normalize)
Define the component(s) of the field to be used for the scalar components.
void ConstructGhostLevels(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, vtkIdType componentRange[2], char *array, int arrayComponent, int normalize)
int GetTCoordComponentMinRange(int comp)
Define the components of the field to be used for the cell texture coord components.
void SetTCoordComponent(int comp, const char *arrayName, int arrayComp, int min, int max, int normalize)
Define the components of the field to be used for the cell texture coord components.
void ConstructTensors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, vtkIdType componentRange[9][2], char *arrays[9], int arrayComponents[9], int normalize[9])
void SetVectorComponent(int comp, const char *arrayName, int arrayComp)
Define the component(s) of the field to be used for the vector components.
int GetScalarComponentMaxRange(int comp)
Define the component(s) of the field to be used for the scalar components.
void SetScalarComponent(int comp, const char *arrayName, int arrayComp)
Define the component(s) of the field to be used for the scalar components.
void SetTensorComponent(int comp, const char *arrayName, int arrayComp, int min, int max, int normalize)
Define the components of the field to be used for the tensor components.
void ConstructScalars(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, vtkIdType componentRange[4][2], char *arrays[4], int arrayComponents[4], int normalize[4], int numComp)
int GetNormalComponentArrayComponent(int comp)
Define the component(s) of the field to be used for the normal components.
int GetScalarComponentArrayComponent(int comp)
Define the component(s) of the field to be used for the scalar components.
int GetTCoordComponentNormalizeFlag(int comp)
Define the components of the field to be used for the cell texture coord components.
int GetVectorComponentMinRange(int comp)
Define the component(s) of the field to be used for the vector components.
int GetNormalComponentNormalizeFlag(int comp)
Define the component(s) of the field to be used for the normal components.
void SetInputFieldToPointDataField()
Specify which field data to use to generate the output attribute data.
void SetNormalComponent(int comp, const char *arrayName, int arrayComp, int min, int max, int normalize)
Define the component(s) of the field to be used for the normal components.
int GetScalarComponentNormalizeFlag(int comp)
Define the component(s) of the field to be used for the scalar components.
int GetVectorComponentNormalizeFlag(int comp)
Define the component(s) of the field to be used for the vector components.
represent and manipulate fields of data
Definition: vtkFieldData.h:72
a simple class to control print indentation
Definition: vtkIndent.h:49
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
abstract base class for most VTK objects
Definition: vtkObject.h:72
@ name
Definition: vtkX3D.h:225
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_POINT_DATA_FIELD
#define VTK_CELL_DATA_FIELD
#define VTK_DATA_OBJECT_FIELD
int vtkIdType
Definition: vtkType.h:332
#define max(a, b)