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 =========================================================================*/
58 #ifndef vtkFieldDataToAttributeDataFilter_h
59 #define vtkFieldDataToAttributeDataFilter_h
60 
61 #include "vtkFiltersCoreModule.h" // For export macro
62 #include "vtkDataSetAlgorithm.h"
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);
97  {this->SetInputField(VTK_DATA_OBJECT_FIELD);};
99  {this->SetInputField(VTK_POINT_DATA_FIELD);};
101  {this->SetInputField(VTK_CELL_DATA_FIELD);};
103 
105 
108  vtkSetMacro(OutputAttributeData,int);
109  vtkGetMacro(OutputAttributeData,int);
111  {this->SetOutputAttributeData(VTK_CELL_DATA);};
113  {this->SetOutputAttributeData(VTK_POINT_DATA);};
115 
117 
124  void SetScalarComponent(int comp, const char *arrayName, int arrayComp,
125  int min, int max, int normalize);
126  void SetScalarComponent(int comp, const char *arrayName, int arrayComp)
127  {this->SetScalarComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
128  const char *GetScalarComponentArrayName(int comp);
134 
136 
143  void SetVectorComponent(int comp, const char *arrayName, int arrayComp,
144  int min, int max, int normalize);
145  void SetVectorComponent(int comp, const char *arrayName, int arrayComp)
146  {this->SetVectorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
147  const char *GetVectorComponentArrayName(int comp);
153 
155 
162  void SetNormalComponent(int comp, const char *arrayName, int arrayComp,
163  int min, int max, int normalize);
164  void SetNormalComponent(int comp, const char *arrayName, int arrayComp)
165  {this->SetNormalComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
166  const char *GetNormalComponentArrayName(int comp);
172 
174 
181  void SetTensorComponent(int comp, const char *arrayName, int arrayComp,
182  int min, int max, int normalize);
183  void SetTensorComponent(int comp, const char *arrayName, int arrayComp)
184  {this->SetTensorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
185  const char *GetTensorComponentArrayName(int comp);
191 
193 
200  void SetTCoordComponent(int comp, const char *arrayName, int arrayComp,
201  int min, int max, int normalize);
202  void SetTCoordComponent(int comp, const char *arrayName, int arrayComp)
203  {this->SetTCoordComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
204  const char *GetTCoordComponentArrayName(int comp);
210 
212 
216  vtkSetMacro(DefaultNormalize,vtkTypeBool);
217  vtkGetMacro(DefaultNormalize,vtkTypeBool);
218  vtkBooleanMacro(DefaultNormalize,vtkTypeBool);
220 
221  // Helper functions, made public to support other classes
222 
228  static int GetComponentsType(int numComp, vtkDataArray **arrays);
229 
236  static int ConstructArray(vtkDataArray *da, int comp, vtkDataArray *frray,
237  int fieldComp, vtkIdType min, vtkIdType max,
238  int normalize);
239 
243  static vtkDataArray *GetFieldArray(vtkFieldData *fd, const char *name, int comp);
244 
248  static void SetArrayName(vtkObject *self, char* &name, const char *newName);
249 
254  static int UpdateComponentRange(vtkDataArray *da, vtkIdType compRange[2]);
255 
260 
261 protected:
264 
265  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override; //generate output data
266 
269 
270  int NumberOfScalarComponents; //the number of components to fill-in
271  char *ScalarArrays[4]; //the name of the arrays used to construct the scalar
272  int ScalarArrayComponents[4]; //the components of the arrays used to construct
273  vtkIdType ScalarComponentRange[4][2]; //the range of the components to use
274  int ScalarNormalize[4]; //flags control normalization
275 
276  char *VectorArrays[3]; //the name of the arrays used to construct the vectors
277  int VectorArrayComponents[3]; //the components of the arrays used to construct
278  vtkIdType VectorComponentRange[3][2]; //the range of the components to use
279  int VectorNormalize[3]; //flags control normalization
280 
281  char *GhostLevelArray; //the name of the array used to construct the ghost levels
282  int GhostLevelArrayComponent; //the component of the array used to construct
283  vtkIdType GhostLevelComponentRange[2]; //the range of the components to use
284  int GhostLevelNormalize; //flags control normalization
285 
286  char *NormalArrays[3]; //the name of the arrays used to construct the normals
287  int NormalArrayComponents[3]; //the components of the arrays used to construct
288  vtkIdType NormalComponentRange[3][2]; //the range of the components to use
289  int NormalNormalize[3]; //flags control normalization
290 
291  char *TensorArrays[9]; //the name of the arrays used to construct the tensors
292  int TensorArrayComponents[9]; //the components of the arrays used to construct
293  vtkIdType TensorComponentRange[9][2]; //the range of the components to use
294  int TensorNormalize[9]; //flags control normalization
295 
296  int NumberOfTCoordComponents; //the number of components to fill-in
297  char *TCoordArrays[3]; //the name of the arrays used to construct the tcoords
298  int TCoordArrayComponents[3]; //the components of the arrays used to construct
299  vtkIdType TCoordComponentRange[3][2]; //the range of the components to use
300  int TCoordNormalize[3]; //flags control normalization
301 
303 
305  vtkIdType componentRange[4][2], char *arrays[4],
306  int arrayComponents[4], int normalize[4], int numComp);
308  vtkIdType componentRange[3][2], char *arrays[3],
309  int arrayComponents[3], int normalize[3]);
311  vtkDataSetAttributes *attr,
312  vtkIdType componentRange[2],
313  char *array, int arrayComponent, int normalize);
315  vtkIdType componentRange[3][2], char *arrays[3],
316  int arrayComponents[3], int normalize[3]);
318  vtkIdType componentRange[3][2], char *arrays[3],
319  int arrayComponents[3], int normalize[3], int numComp);
321  vtkIdType componentRange[9][2], char *arrays[9],
322  int arrayComponents[9], int normalize[9]);
324 
325 private:
327  void operator=(const vtkFieldDataToAttributeDataFilter&) = delete;
328 };
329 
330 #endif
331 
332 
vtkFieldDataToAttributeDataFilter::GetTensorComponentNormalizeFlag
int GetTensorComponentNormalizeFlag(int comp)
vtkFieldDataToAttributeDataFilter::GetVectorComponentMaxRange
int GetVectorComponentMaxRange(int comp)
vtkFieldDataToAttributeDataFilter::GetNormalComponentArrayComponent
int GetNormalComponentArrayComponent(int comp)
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)
vtkFieldDataToAttributeDataFilter
map field data to dataset attribute data
Definition: vtkFieldDataToAttributeDataFilter.h:76
vtkFieldDataToAttributeDataFilter::ConstructFieldData
void ConstructFieldData(int num, vtkDataSetAttributes *attr)
vtkFieldDataToAttributeDataFilter::~vtkFieldDataToAttributeDataFilter
~vtkFieldDataToAttributeDataFilter() override
vtkFieldDataToAttributeDataFilter::InputField
int InputField
Definition: vtkFieldDataToAttributeDataFilter.h:267
vtkFieldDataToAttributeDataFilter::SetInputFieldToDataObjectField
void SetInputFieldToDataObjectField()
Definition: vtkFieldDataToAttributeDataFilter.h:96
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:68
vtkFieldDataToAttributeDataFilter::GetScalarComponentNormalizeFlag
int GetScalarComponentNormalizeFlag(int comp)
vtkFieldDataToAttributeDataFilter::GhostLevelArrayComponent
int GhostLevelArrayComponent
Definition: vtkFieldDataToAttributeDataFilter.h:282
VTK_POINT_DATA_FIELD
#define VTK_POINT_DATA_FIELD
Definition: vtkFieldDataToAttributeDataFilter.h:65
vtkIdType
int vtkIdType
Definition: vtkType.h:347
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:60
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:42
vtkFieldDataToAttributeDataFilter::GhostLevelNormalize
int GhostLevelNormalize
Definition: vtkFieldDataToAttributeDataFilter.h:284
vtkFieldDataToAttributeDataFilter::NumberOfTCoordComponents
int NumberOfTCoordComponents
Definition: vtkFieldDataToAttributeDataFilter.h:296
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)
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:60
vtkFieldDataToAttributeDataFilter::GetScalarComponentMinRange
int GetScalarComponentMinRange(int comp)
vtkFieldDataToAttributeDataFilter::SetInputFieldToCellDataField
void SetInputFieldToCellDataField()
Definition: vtkFieldDataToAttributeDataFilter.h:100
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:55
vtkFieldDataToAttributeDataFilter::OutputAttributeData
int OutputAttributeData
Definition: vtkFieldDataToAttributeDataFilter.h:268
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)
vtkFieldDataToAttributeDataFilter::UpdateComponentRange
static int UpdateComponentRange(vtkDataArray *da, vtkIdType compRange[2])
Update the maximum and minimum component range values.
VTK_CELL_DATA_FIELD
#define VTK_CELL_DATA_FIELD
Definition: vtkFieldDataToAttributeDataFilter.h:66
max
#define max(a, b)
Definition: vtkX3DExporterFIWriterHelper.h:31
vtkFieldData
represent and manipulate fields of data
Definition: vtkFieldData.h:57
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:281
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)
Definition: vtkFieldDataToAttributeDataFilter.h:183
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()
Definition: vtkFieldDataToAttributeDataFilter.h:110
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)
vtkFieldDataToAttributeDataFilter::GetVectorComponentMinRange
int GetVectorComponentMinRange(int comp)
vtkFieldDataToAttributeDataFilter::ConstructArray
static int ConstructArray(vtkDataArray *da, int comp, vtkDataArray *frray, 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_POINT_DATA
#define VTK_POINT_DATA
Definition: vtkFieldDataToAttributeDataFilter.h:69
vtkFieldDataToAttributeDataFilter::GetTensorComponentArrayComponent
int GetTensorComponentArrayComponent(int comp)
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:270
vtkFieldDataToAttributeDataFilter::vtkFieldDataToAttributeDataFilter
vtkFieldDataToAttributeDataFilter()
VTK_DATA_OBJECT_FIELD
#define VTK_DATA_OBJECT_FIELD
Definition: vtkFieldDataToAttributeDataFilter.h:64
vtkFieldDataToAttributeDataFilter::SetScalarComponent
void SetScalarComponent(int comp, const char *arrayName, int arrayComp)
Definition: vtkFieldDataToAttributeDataFilter.h:126
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkFieldDataToAttributeDataFilter::GetVectorComponentArrayComponent
int GetVectorComponentArrayComponent(int comp)
vtkFieldDataToAttributeDataFilter::GetScalarComponentArrayName
const char * GetScalarComponentArrayName(int comp)
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()
Definition: vtkFieldDataToAttributeDataFilter.h:112
vtkFieldDataToAttributeDataFilter::SetNormalComponent
void SetNormalComponent(int comp, const char *arrayName, int arrayComp)
Definition: vtkFieldDataToAttributeDataFilter.h:164
vtkFieldDataToAttributeDataFilter::GetScalarComponentArrayComponent
int GetScalarComponentArrayComponent(int comp)
vtkFieldDataToAttributeDataFilter::GetTCoordComponentArrayComponent
int GetTCoordComponentArrayComponent(int comp)
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)
vtkX3D::name
@ name
Definition: vtkX3D.h:219
vtkFieldDataToAttributeDataFilter::GetNormalComponentNormalizeFlag
int GetNormalComponentNormalizeFlag(int comp)
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:87
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()
Definition: vtkFieldDataToAttributeDataFilter.h:98
vtkFieldDataToAttributeDataFilter::GetNormalComponentMinRange
int GetNormalComponentMinRange(int comp)
vtkDataSetAlgorithm.h
vtkFieldDataToAttributeDataFilter::GetTCoordComponentNormalizeFlag
int GetTCoordComponentNormalizeFlag(int comp)
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)
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)
Definition: vtkFieldDataToAttributeDataFilter.h:145
vtkFieldDataToAttributeDataFilter::SetTCoordComponent
void SetTCoordComponent(int comp, const char *arrayName, int arrayComp)
Definition: vtkFieldDataToAttributeDataFilter.h:202
vtkFieldDataToAttributeDataFilter::GetTCoordComponentMaxRange
int GetTCoordComponentMaxRange(int comp)
vtkFieldDataToAttributeDataFilter::GetTCoordComponentMinRange
int GetTCoordComponentMinRange(int comp)
vtkFieldDataToAttributeDataFilter::GetTCoordComponentArrayName
const char * GetTCoordComponentArrayName(int comp)
vtkFieldDataToAttributeDataFilter::DefaultNormalize
vtkTypeBool DefaultNormalize
Definition: vtkFieldDataToAttributeDataFilter.h:302
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkFieldDataToAttributeDataFilter::GetVectorComponentArrayName
const char * GetVectorComponentArrayName(int comp)
vtkFieldDataToAttributeDataFilter::GetVectorComponentNormalizeFlag
int GetVectorComponentNormalizeFlag(int comp)