VTK  9.1.0
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 =========================================================================*/
84 #ifndef vtkFieldDataToAttributeDataFilter_h
85 #define vtkFieldDataToAttributeDataFilter_h
86 
87 #include "vtkDataSetAlgorithm.h"
88 #include "vtkFiltersCoreModule.h" // For export macro
89 
90 #define VTK_DATA_OBJECT_FIELD 0
91 #define VTK_POINT_DATA_FIELD 1
92 #define VTK_CELL_DATA_FIELD 2
93 
94 #define VTK_CELL_DATA 0
95 #define VTK_POINT_DATA 1
96 
97 class vtkDataArray;
99 class vtkFieldData;
100 
101 class VTKFILTERSCORE_EXPORT vtkFieldDataToAttributeDataFilter : public vtkDataSetAlgorithm
102 {
103 public:
104  void PrintSelf(ostream& os, vtkIndent indent) override;
106 
112 
114 
120  vtkSetMacro(InputField, int);
121  vtkGetMacro(InputField, int);
122  void SetInputFieldToDataObjectField() { this->SetInputField(VTK_DATA_OBJECT_FIELD); }
123  void SetInputFieldToPointDataField() { this->SetInputField(VTK_POINT_DATA_FIELD); }
124  void SetInputFieldToCellDataField() { this->SetInputField(VTK_CELL_DATA_FIELD); }
126 
128 
131  vtkSetMacro(OutputAttributeData, int);
132  vtkGetMacro(OutputAttributeData, int);
133  void SetOutputAttributeDataToCellData() { this->SetOutputAttributeData(VTK_CELL_DATA); }
134  void SetOutputAttributeDataToPointData() { this->SetOutputAttributeData(VTK_POINT_DATA); }
136 
138 
146  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
147  void SetScalarComponent(int comp, const char* arrayName, int arrayComp)
148  {
149  this->SetScalarComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
150  }
151  const char* GetScalarComponentArrayName(int comp);
157 
159 
167  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
168  void SetVectorComponent(int comp, const char* arrayName, int arrayComp)
169  {
170  this->SetVectorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
171  }
172  const char* GetVectorComponentArrayName(int comp);
178 
180 
188  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
189  void SetNormalComponent(int comp, const char* arrayName, int arrayComp)
190  {
191  this->SetNormalComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
192  }
193  const char* GetNormalComponentArrayName(int comp);
199 
201 
209  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
210  void SetTensorComponent(int comp, const char* arrayName, int arrayComp)
211  {
212  this->SetTensorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
213  }
214  const char* GetTensorComponentArrayName(int comp);
220 
222 
230  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
231  void SetTCoordComponent(int comp, const char* arrayName, int arrayComp)
232  {
233  this->SetTCoordComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
234  }
235  const char* GetTCoordComponentArrayName(int comp);
241 
243 
247  vtkSetMacro(DefaultNormalize, vtkTypeBool);
248  vtkGetMacro(DefaultNormalize, vtkTypeBool);
249  vtkBooleanMacro(DefaultNormalize, vtkTypeBool);
251 
252  // Helper functions, made public to support other classes
253 
259  static int GetComponentsType(int numComp, vtkDataArray** arrays);
260 
267  static int ConstructArray(vtkDataArray* da, int comp, vtkDataArray* fieldArray, int fieldComp,
268  vtkIdType min, vtkIdType max, int normalize);
269 
273  static vtkDataArray* GetFieldArray(vtkFieldData* fd, const char* name, int comp);
274 
278  static void SetArrayName(vtkObject* self, char*& name, const char* newName);
279 
284  static int UpdateComponentRange(vtkDataArray* da, vtkIdType compRange[2]);
285 
290 
291 protected:
294 
296  vtkInformationVector*) override; // generate output data
297 
300 
301  int NumberOfScalarComponents; // the number of components to fill-in
302  char* ScalarArrays[4]; // the name of the arrays used to construct the scalar
303  int ScalarArrayComponents[4]; // the components of the arrays used to construct
304  vtkIdType ScalarComponentRange[4][2]; // the range of the components to use
305  int ScalarNormalize[4]; // flags control normalization
306 
307  char* VectorArrays[3]; // the name of the arrays used to construct the vectors
308  int VectorArrayComponents[3]; // the components of the arrays used to construct
309  vtkIdType VectorComponentRange[3][2]; // the range of the components to use
310  int VectorNormalize[3]; // flags control normalization
311 
312  char* GhostLevelArray; // the name of the array used to construct the ghost levels
313  int GhostLevelArrayComponent; // the component of the array used to construct
314  vtkIdType GhostLevelComponentRange[2]; // the range of the components to use
315  int GhostLevelNormalize; // flags control normalization
316 
317  char* NormalArrays[3]; // the name of the arrays used to construct the normals
318  int NormalArrayComponents[3]; // the components of the arrays used to construct
319  vtkIdType NormalComponentRange[3][2]; // the range of the components to use
320  int NormalNormalize[3]; // flags control normalization
321 
322  char* TensorArrays[9]; // the name of the arrays used to construct the tensors
323  int TensorArrayComponents[9]; // the components of the arrays used to construct
324  vtkIdType TensorComponentRange[9][2]; // the range of the components to use
325  int TensorNormalize[9]; // flags control normalization
326 
327  int NumberOfTCoordComponents; // the number of components to fill-in
328  char* TCoordArrays[3]; // the name of the arrays used to construct the tcoords
329  int TCoordArrayComponents[3]; // the components of the arrays used to construct
330  vtkIdType TCoordComponentRange[3][2]; // the range of the components to use
331  int TCoordNormalize[3]; // flags control normalization
332 
334 
336  vtkIdType componentRange[4][2], char* arrays[4], int arrayComponents[4], int normalize[4],
337  int numComp);
339  vtkIdType componentRange[3][2], char* arrays[3], int arrayComponents[3], int normalize[3]);
341  vtkIdType componentRange[2], char* array, int arrayComponent, int normalize);
343  vtkIdType componentRange[3][2], char* arrays[3], int arrayComponents[3], int normalize[3]);
345  vtkIdType componentRange[3][2], char* arrays[3], int arrayComponents[3], int normalize[3],
346  int numComp);
348  vtkIdType componentRange[9][2], char* arrays[9], int arrayComponents[9], int normalize[9]);
350 
351 private:
353  void operator=(const vtkFieldDataToAttributeDataFilter&) = delete;
354 };
355 
356 #endif
vtkFieldDataToAttributeDataFilter::GetTensorComponentNormalizeFlag
int GetTensorComponentNormalizeFlag(int comp)
Define the components of the field to be used for the tensor components.
vtkFieldDataToAttributeDataFilter::GetVectorComponentMaxRange
int GetVectorComponentMaxRange(int comp)
Define the component(s) of the field to be used for the vector components.
vtkFieldDataToAttributeDataFilter::GetNormalComponentArrayComponent
int GetNormalComponentArrayComponent(int comp)
Define the component(s) of the field to be used for the normal components.
vtkFieldDataToAttributeDataFilter::RequestData
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when a request asks the algorithm to do its work.
vtkFieldDataToAttributeDataFilter::GetScalarComponentMaxRange
int GetScalarComponentMaxRange(int comp)
Define the component(s) of the field to be used for the scalar components.
vtkFieldDataToAttributeDataFilter
map field data to dataset attribute data
Definition: vtkFieldDataToAttributeDataFilter.h:102
vtkFieldDataToAttributeDataFilter::ConstructFieldData
void ConstructFieldData(int num, vtkDataSetAttributes *attr)
vtkFieldDataToAttributeDataFilter::~vtkFieldDataToAttributeDataFilter
~vtkFieldDataToAttributeDataFilter() override
vtkFieldDataToAttributeDataFilter::InputField
int InputField
Definition: vtkFieldDataToAttributeDataFilter.h:298
vtkFieldDataToAttributeDataFilter::SetInputFieldToDataObjectField
void SetInputFieldToDataObjectField()
Specify which field data to use to generate the output attribute data.
Definition: vtkFieldDataToAttributeDataFilter.h:122
vtkFieldDataToAttributeDataFilter::RequestUpdateExtent
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
If output does not need exact extent, the I do not either.
VTK_CELL_DATA
#define VTK_CELL_DATA
Definition: vtkFieldDataToAttributeDataFilter.h:94
vtkFieldDataToAttributeDataFilter::GetScalarComponentNormalizeFlag
int GetScalarComponentNormalizeFlag(int comp)
Define the component(s) of the field to be used for the scalar components.
vtkFieldDataToAttributeDataFilter::GhostLevelArrayComponent
int GhostLevelArrayComponent
Definition: vtkFieldDataToAttributeDataFilter.h:313
VTK_POINT_DATA_FIELD
#define VTK_POINT_DATA_FIELD
Definition: vtkFieldDataToAttributeDataFilter.h:91
vtkIdType
int vtkIdType
Definition: vtkType.h:332
vtkFieldDataToAttributeDataFilter::ConstructGhostLevels
void ConstructGhostLevels(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, vtkIdType componentRange[2], char *array, int arrayComponent, int normalize)
vtkDataSetAttributes
represent and manipulate attribute data in a dataset
Definition: vtkDataSetAttributes.h:170
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:145
vtkFieldDataToAttributeDataFilter::GhostLevelNormalize
int GhostLevelNormalize
Definition: vtkFieldDataToAttributeDataFilter.h:315
vtkFieldDataToAttributeDataFilter::NumberOfTCoordComponents
int NumberOfTCoordComponents
Definition: vtkFieldDataToAttributeDataFilter.h:327
vtkFieldDataToAttributeDataFilter::SetTensorComponent
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.
vtkFieldDataToAttributeDataFilter::GetTensorComponentMinRange
int GetTensorComponentMinRange(int comp)
Define the components of the field to be used for the tensor components.
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:82
vtkFieldDataToAttributeDataFilter::GetScalarComponentMinRange
int GetScalarComponentMinRange(int comp)
Define the component(s) of the field to be used for the scalar components.
vtkFieldDataToAttributeDataFilter::SetInputFieldToCellDataField
void SetInputFieldToCellDataField()
Specify which field data to use to generate the output attribute data.
Definition: vtkFieldDataToAttributeDataFilter.h:124
vtkFieldDataToAttributeDataFilter::ConstructTensors
void ConstructTensors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, vtkIdType componentRange[9][2], char *arrays[9], int arrayComponents[9], int normalize[9])
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
vtkFieldDataToAttributeDataFilter::OutputAttributeData
int OutputAttributeData
Definition: vtkFieldDataToAttributeDataFilter.h:299
vtkFieldDataToAttributeDataFilter::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkFieldDataToAttributeDataFilter::ConstructScalars
void ConstructScalars(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, vtkIdType componentRange[4][2], char *arrays[4], int arrayComponents[4], int normalize[4], int numComp)
vtkFieldDataToAttributeDataFilter::GetTensorComponentMaxRange
int GetTensorComponentMaxRange(int comp)
Define the components of the field to be used for the tensor components.
vtkFieldDataToAttributeDataFilter::UpdateComponentRange
static int UpdateComponentRange(vtkDataArray *da, vtkIdType compRange[2])
Update the maximum and minimum component range values.
vtkFieldDataToAttributeDataFilter::ConstructArray
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.
VTK_CELL_DATA_FIELD
#define VTK_CELL_DATA_FIELD
Definition: vtkFieldDataToAttributeDataFilter.h:92
max
#define max(a, b)
Definition: vtkX3DExporterFIWriterHelper.h:31
vtkFieldData
represent and manipulate fields of data
Definition: vtkFieldData.h:164
vtkFieldDataToAttributeDataFilter::ConstructNormals
void ConstructNormals(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, vtkIdType componentRange[3][2], char *arrays[3], int arrayComponents[3], int normalize[3])
vtkFieldDataToAttributeDataFilter::GhostLevelArray
char * GhostLevelArray
Definition: vtkFieldDataToAttributeDataFilter.h:312
vtkDataSetAlgorithm
Superclass for algorithms that produce output of the same type as input.
Definition: vtkDataSetAlgorithm.h:49
vtkFieldDataToAttributeDataFilter::SetTensorComponent
void SetTensorComponent(int comp, const char *arrayName, int arrayComp)
Define the components of the field to be used for the tensor components.
Definition: vtkFieldDataToAttributeDataFilter.h:210
vtkFieldDataToAttributeDataFilter::GetFieldArray
static vtkDataArray * GetFieldArray(vtkFieldData *fd, const char *name, int comp)
Return an array of a particular name from field data and do error checking.
vtkFieldDataToAttributeDataFilter::SetOutputAttributeDataToCellData
void SetOutputAttributeDataToCellData()
Specify which attribute data to output: point or cell data attributes.
Definition: vtkFieldDataToAttributeDataFilter.h:133
vtkFieldDataToAttributeDataFilter::SetVectorComponent
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.
vtkFieldDataToAttributeDataFilter::ConstructVectors
void ConstructVectors(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, vtkIdType componentRange[3][2], char *arrays[3], int arrayComponents[3], int normalize[3])
vtkFieldDataToAttributeDataFilter::GetNormalComponentArrayName
const char * GetNormalComponentArrayName(int comp)
Define the component(s) of the field to be used for the normal components.
vtkFieldDataToAttributeDataFilter::GetVectorComponentMinRange
int GetVectorComponentMinRange(int comp)
Define the component(s) of the field to be used for the vector components.
VTK_POINT_DATA
#define VTK_POINT_DATA
Definition: vtkFieldDataToAttributeDataFilter.h:95
vtkFieldDataToAttributeDataFilter::GetTensorComponentArrayComponent
int GetTensorComponentArrayComponent(int comp)
Define the components of the field to be used for the tensor components.
vtkFieldDataToAttributeDataFilter::SetNormalComponent
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.
vtkFieldDataToAttributeDataFilter::NumberOfScalarComponents
int NumberOfScalarComponents
Definition: vtkFieldDataToAttributeDataFilter.h:301
vtkFieldDataToAttributeDataFilter::vtkFieldDataToAttributeDataFilter
vtkFieldDataToAttributeDataFilter()
VTK_DATA_OBJECT_FIELD
#define VTK_DATA_OBJECT_FIELD
Definition: vtkFieldDataToAttributeDataFilter.h:90
vtkFieldDataToAttributeDataFilter::SetScalarComponent
void SetScalarComponent(int comp, const char *arrayName, int arrayComp)
Define the component(s) of the field to be used for the scalar components.
Definition: vtkFieldDataToAttributeDataFilter.h:147
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkFieldDataToAttributeDataFilter::GetVectorComponentArrayComponent
int GetVectorComponentArrayComponent(int comp)
Define the component(s) of the field to be used for the vector components.
vtkFieldDataToAttributeDataFilter::GetScalarComponentArrayName
const char * GetScalarComponentArrayName(int comp)
Define the component(s) of the field to be used for the scalar components.
vtkFieldDataToAttributeDataFilter::SetTCoordComponent
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.
vtkFieldDataToAttributeDataFilter::SetOutputAttributeDataToPointData
void SetOutputAttributeDataToPointData()
Specify which attribute data to output: point or cell data attributes.
Definition: vtkFieldDataToAttributeDataFilter.h:134
vtkFieldDataToAttributeDataFilter::SetNormalComponent
void SetNormalComponent(int comp, const char *arrayName, int arrayComp)
Define the component(s) of the field to be used for the normal components.
Definition: vtkFieldDataToAttributeDataFilter.h:189
vtkFieldDataToAttributeDataFilter::GetScalarComponentArrayComponent
int GetScalarComponentArrayComponent(int comp)
Define the component(s) of the field to be used for the scalar components.
vtkFieldDataToAttributeDataFilter::GetTCoordComponentArrayComponent
int GetTCoordComponentArrayComponent(int comp)
Define the components of the field to be used for the cell texture coord components.
vtkFieldDataToAttributeDataFilter::GetComponentsType
static int GetComponentsType(int numComp, vtkDataArray **arrays)
Given an array of names of arrays in field data, return the common type for these arrays.
vtkFieldDataToAttributeDataFilter::GetTensorComponentArrayName
const char * GetTensorComponentArrayName(int comp)
Define the components of the field to be used for the tensor components.
vtkX3D::name
@ name
Definition: vtkX3D.h:225
vtkFieldDataToAttributeDataFilter::GetNormalComponentNormalizeFlag
int GetNormalComponentNormalizeFlag(int comp)
Define the component(s) of the field to be used for the normal components.
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:183
vtkFieldDataToAttributeDataFilter::SetScalarComponent
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.
vtkFieldDataToAttributeDataFilter::SetInputFieldToPointDataField
void SetInputFieldToPointDataField()
Specify which field data to use to generate the output attribute data.
Definition: vtkFieldDataToAttributeDataFilter.h:123
vtkFieldDataToAttributeDataFilter::GetNormalComponentMinRange
int GetNormalComponentMinRange(int comp)
Define the component(s) of the field to be used for the normal components.
vtkDataSetAlgorithm.h
vtkFieldDataToAttributeDataFilter::GetTCoordComponentNormalizeFlag
int GetTCoordComponentNormalizeFlag(int comp)
Define the components of the field to be used for the cell texture coord components.
vtkFieldDataToAttributeDataFilter::ConstructTCoords
void ConstructTCoords(int num, vtkFieldData *fd, vtkDataSetAttributes *attr, vtkIdType componentRange[3][2], char *arrays[3], int arrayComponents[3], int normalize[3], int numComp)
vtkFieldDataToAttributeDataFilter::New
static vtkFieldDataToAttributeDataFilter * New()
Construct object with input field set to the data object field, and the output attribute data set to ...
vtkFieldDataToAttributeDataFilter::GetNormalComponentMaxRange
int GetNormalComponentMaxRange(int comp)
Define the component(s) of the field to be used for the normal components.
vtkFieldDataToAttributeDataFilter::SetArrayName
static void SetArrayName(vtkObject *self, char *&name, const char *newName)
Specify an array name for one of the components.
vtkFieldDataToAttributeDataFilter::SetVectorComponent
void SetVectorComponent(int comp, const char *arrayName, int arrayComp)
Define the component(s) of the field to be used for the vector components.
Definition: vtkFieldDataToAttributeDataFilter.h:168
vtkFieldDataToAttributeDataFilter::SetTCoordComponent
void SetTCoordComponent(int comp, const char *arrayName, int arrayComp)
Define the components of the field to be used for the cell texture coord components.
Definition: vtkFieldDataToAttributeDataFilter.h:231
vtkFieldDataToAttributeDataFilter::GetTCoordComponentMaxRange
int GetTCoordComponentMaxRange(int comp)
Define the components of the field to be used for the cell texture coord components.
vtkFieldDataToAttributeDataFilter::GetTCoordComponentMinRange
int GetTCoordComponentMinRange(int comp)
Define the components of the field to be used for the cell texture coord components.
vtkFieldDataToAttributeDataFilter::GetTCoordComponentArrayName
const char * GetTCoordComponentArrayName(int comp)
Define the components of the field to be used for the cell texture coord components.
vtkFieldDataToAttributeDataFilter::DefaultNormalize
vtkTypeBool DefaultNormalize
Definition: vtkFieldDataToAttributeDataFilter.h:333
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkFieldDataToAttributeDataFilter::GetVectorComponentArrayName
const char * GetVectorComponentArrayName(int comp)
Define the component(s) of the field to be used for the vector components.
vtkFieldDataToAttributeDataFilter::GetVectorComponentNormalizeFlag
int GetVectorComponentNormalizeFlag(int comp)
Define the component(s) of the field to be used for the vector components.