VTK  9.0.1
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 =========================================================================*/
55 #ifndef vtkFieldDataToAttributeDataFilter_h
56 #define vtkFieldDataToAttributeDataFilter_h
57 
58 #include "vtkDataSetAlgorithm.h"
59 #include "vtkFiltersCoreModule.h" // For export macro
60 
61 #define VTK_DATA_OBJECT_FIELD 0
62 #define VTK_POINT_DATA_FIELD 1
63 #define VTK_CELL_DATA_FIELD 2
64 
65 #define VTK_CELL_DATA 0
66 #define VTK_POINT_DATA 1
67 
68 class vtkDataArray;
70 class vtkFieldData;
71 
72 class VTKFILTERSCORE_EXPORT vtkFieldDataToAttributeDataFilter : public vtkDataSetAlgorithm
73 {
74 public:
75  void PrintSelf(ostream& os, vtkIndent indent) override;
77 
83 
85 
91  vtkSetMacro(InputField, int);
92  vtkGetMacro(InputField, int);
93  void SetInputFieldToDataObjectField() { this->SetInputField(VTK_DATA_OBJECT_FIELD); }
94  void SetInputFieldToPointDataField() { this->SetInputField(VTK_POINT_DATA_FIELD); }
95  void SetInputFieldToCellDataField() { this->SetInputField(VTK_CELL_DATA_FIELD); }
97 
99 
102  vtkSetMacro(OutputAttributeData, int);
103  vtkGetMacro(OutputAttributeData, int);
104  void SetOutputAttributeDataToCellData() { this->SetOutputAttributeData(VTK_CELL_DATA); }
105  void SetOutputAttributeDataToPointData() { this->SetOutputAttributeData(VTK_POINT_DATA); }
107 
109 
116  void SetScalarComponent(
117  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
118  void SetScalarComponent(int comp, const char* arrayName, int arrayComp)
119  {
120  this->SetScalarComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
121  }
122  const char* GetScalarComponentArrayName(int comp);
123  int GetScalarComponentArrayComponent(int comp);
124  int GetScalarComponentMinRange(int comp);
125  int GetScalarComponentMaxRange(int comp);
126  int GetScalarComponentNormalizeFlag(int comp);
128 
130 
137  void SetVectorComponent(
138  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
139  void SetVectorComponent(int comp, const char* arrayName, int arrayComp)
140  {
141  this->SetVectorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
142  }
143  const char* GetVectorComponentArrayName(int comp);
144  int GetVectorComponentArrayComponent(int comp);
145  int GetVectorComponentMinRange(int comp);
146  int GetVectorComponentMaxRange(int comp);
147  int GetVectorComponentNormalizeFlag(int comp);
149 
151 
158  void SetNormalComponent(
159  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
160  void SetNormalComponent(int comp, const char* arrayName, int arrayComp)
161  {
162  this->SetNormalComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
163  }
164  const char* GetNormalComponentArrayName(int comp);
165  int GetNormalComponentArrayComponent(int comp);
166  int GetNormalComponentMinRange(int comp);
167  int GetNormalComponentMaxRange(int comp);
168  int GetNormalComponentNormalizeFlag(int comp);
170 
172 
179  void SetTensorComponent(
180  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
181  void SetTensorComponent(int comp, const char* arrayName, int arrayComp)
182  {
183  this->SetTensorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
184  }
185  const char* GetTensorComponentArrayName(int comp);
186  int GetTensorComponentArrayComponent(int comp);
187  int GetTensorComponentMinRange(int comp);
188  int GetTensorComponentMaxRange(int comp);
189  int GetTensorComponentNormalizeFlag(int comp);
191 
193 
200  void SetTCoordComponent(
201  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
202  void SetTCoordComponent(int comp, const char* arrayName, int arrayComp)
203  {
204  this->SetTCoordComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
205  }
206  const char* GetTCoordComponentArrayName(int comp);
207  int GetTCoordComponentArrayComponent(int comp);
208  int GetTCoordComponentMinRange(int comp);
209  int GetTCoordComponentMaxRange(int comp);
210  int GetTCoordComponentNormalizeFlag(int comp);
212 
214 
218  vtkSetMacro(DefaultNormalize, vtkTypeBool);
219  vtkGetMacro(DefaultNormalize, vtkTypeBool);
220  vtkBooleanMacro(DefaultNormalize, vtkTypeBool);
222 
223  // Helper functions, made public to support other classes
224 
230  static int GetComponentsType(int numComp, vtkDataArray** arrays);
231 
238  static int ConstructArray(vtkDataArray* da, int comp, vtkDataArray* frray, int fieldComp,
239  vtkIdType min, vtkIdType max, int normalize);
240 
244  static vtkDataArray* GetFieldArray(vtkFieldData* fd, const char* name, int comp);
245 
249  static void SetArrayName(vtkObject* self, char*& name, const char* newName);
250 
255  static int UpdateComponentRange(vtkDataArray* da, vtkIdType compRange[2]);
256 
261 
262 protected:
265 
267  vtkInformationVector*) override; // generate output data
268 
271 
272  int NumberOfScalarComponents; // the number of components to fill-in
273  char* ScalarArrays[4]; // the name of the arrays used to construct the scalar
274  int ScalarArrayComponents[4]; // the components of the arrays used to construct
275  vtkIdType ScalarComponentRange[4][2]; // the range of the components to use
276  int ScalarNormalize[4]; // flags control normalization
277 
278  char* VectorArrays[3]; // the name of the arrays used to construct the vectors
279  int VectorArrayComponents[3]; // the components of the arrays used to construct
280  vtkIdType VectorComponentRange[3][2]; // the range of the components to use
281  int VectorNormalize[3]; // flags control normalization
282 
283  char* GhostLevelArray; // the name of the array used to construct the ghost levels
284  int GhostLevelArrayComponent; // the component of the array used to construct
285  vtkIdType GhostLevelComponentRange[2]; // the range of the components to use
286  int GhostLevelNormalize; // flags control normalization
287 
288  char* NormalArrays[3]; // the name of the arrays used to construct the normals
289  int NormalArrayComponents[3]; // the components of the arrays used to construct
290  vtkIdType NormalComponentRange[3][2]; // the range of the components to use
291  int NormalNormalize[3]; // flags control normalization
292 
293  char* TensorArrays[9]; // the name of the arrays used to construct the tensors
294  int TensorArrayComponents[9]; // the components of the arrays used to construct
295  vtkIdType TensorComponentRange[9][2]; // the range of the components to use
296  int TensorNormalize[9]; // flags control normalization
297 
298  int NumberOfTCoordComponents; // the number of components to fill-in
299  char* TCoordArrays[3]; // the name of the arrays used to construct the tcoords
300  int TCoordArrayComponents[3]; // the components of the arrays used to construct
301  vtkIdType TCoordComponentRange[3][2]; // the range of the components to use
302  int TCoordNormalize[3]; // flags control normalization
303 
305 
306  void ConstructScalars(int num, vtkFieldData* fd, vtkDataSetAttributes* attr,
307  vtkIdType componentRange[4][2], char* arrays[4], int arrayComponents[4], int normalize[4],
308  int numComp);
309  void ConstructVectors(int num, vtkFieldData* fd, vtkDataSetAttributes* attr,
310  vtkIdType componentRange[3][2], char* arrays[3], int arrayComponents[3], int normalize[3]);
311  void ConstructGhostLevels(int num, vtkFieldData* fd, vtkDataSetAttributes* attr,
312  vtkIdType componentRange[2], char* array, int arrayComponent, int normalize);
313  void ConstructNormals(int num, vtkFieldData* fd, vtkDataSetAttributes* attr,
314  vtkIdType componentRange[3][2], char* arrays[3], int arrayComponents[3], int normalize[3]);
315  void ConstructTCoords(int num, vtkFieldData* fd, vtkDataSetAttributes* attr,
316  vtkIdType componentRange[3][2], char* arrays[3], int arrayComponents[3], int normalize[3],
317  int numComp);
318  void ConstructTensors(int num, vtkFieldData* fd, vtkDataSetAttributes* attr,
319  vtkIdType componentRange[9][2], char* arrays[9], int arrayComponents[9], int normalize[9]);
320  void ConstructFieldData(int num, vtkDataSetAttributes* attr);
321 
322 private:
324  void operator=(const vtkFieldDataToAttributeDataFilter&) = delete;
325 };
326 
327 #endif
vtkFieldDataToAttributeDataFilter
map field data to dataset attribute data
Definition: vtkFieldDataToAttributeDataFilter.h:72
vtkFieldDataToAttributeDataFilter::InputField
int InputField
Definition: vtkFieldDataToAttributeDataFilter.h:269
vtkFieldDataToAttributeDataFilter::SetInputFieldToDataObjectField
void SetInputFieldToDataObjectField()
Definition: vtkFieldDataToAttributeDataFilter.h:93
VTK_CELL_DATA
#define VTK_CELL_DATA
Definition: vtkFieldDataToAttributeDataFilter.h:65
vtkFieldDataToAttributeDataFilter::GhostLevelArrayComponent
int GhostLevelArrayComponent
Definition: vtkFieldDataToAttributeDataFilter.h:284
VTK_POINT_DATA_FIELD
#define VTK_POINT_DATA_FIELD
Definition: vtkFieldDataToAttributeDataFilter.h:62
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkDataSetAttributes
represent and manipulate attribute data in a dataset
Definition: vtkDataSetAttributes.h:53
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkFieldDataToAttributeDataFilter::GhostLevelNormalize
int GhostLevelNormalize
Definition: vtkFieldDataToAttributeDataFilter.h:286
vtkFieldDataToAttributeDataFilter::NumberOfTCoordComponents
int NumberOfTCoordComponents
Definition: vtkFieldDataToAttributeDataFilter.h:298
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkDataSetAlgorithm::RequestData
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when a request asks the algorithm to do its work.
Definition: vtkDataSetAlgorithm.h:176
vtkFieldDataToAttributeDataFilter::SetInputFieldToCellDataField
void SetInputFieldToCellDataField()
Definition: vtkFieldDataToAttributeDataFilter.h:95
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
vtkFieldDataToAttributeDataFilter::OutputAttributeData
int OutputAttributeData
Definition: vtkFieldDataToAttributeDataFilter.h:270
VTK_CELL_DATA_FIELD
#define VTK_CELL_DATA_FIELD
Definition: vtkFieldDataToAttributeDataFilter.h:63
max
#define max(a, b)
Definition: vtkX3DExporterFIWriterHelper.h:31
vtkFieldData
represent and manipulate fields of data
Definition: vtkFieldData.h:53
vtkFieldDataToAttributeDataFilter::GhostLevelArray
char * GhostLevelArray
Definition: vtkFieldDataToAttributeDataFilter.h:283
vtkDataSetAlgorithm
Superclass for algorithms that produce output of the same type as input.
Definition: vtkDataSetAlgorithm.h:48
vtkFieldDataToAttributeDataFilter::SetTensorComponent
void SetTensorComponent(int comp, const char *arrayName, int arrayComp)
Definition: vtkFieldDataToAttributeDataFilter.h:181
vtkFieldDataToAttributeDataFilter::SetOutputAttributeDataToCellData
void SetOutputAttributeDataToCellData()
Definition: vtkFieldDataToAttributeDataFilter.h:104
VTK_POINT_DATA
#define VTK_POINT_DATA
Definition: vtkFieldDataToAttributeDataFilter.h:66
vtkFieldDataToAttributeDataFilter::NumberOfScalarComponents
int NumberOfScalarComponents
Definition: vtkFieldDataToAttributeDataFilter.h:272
VTK_DATA_OBJECT_FIELD
#define VTK_DATA_OBJECT_FIELD
Definition: vtkFieldDataToAttributeDataFilter.h:61
vtkFieldDataToAttributeDataFilter::SetScalarComponent
void SetScalarComponent(int comp, const char *arrayName, int arrayComp)
Definition: vtkFieldDataToAttributeDataFilter.h:118
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkDataSetAlgorithm::New
static vtkDataSetAlgorithm * New()
vtkFieldDataToAttributeDataFilter::SetOutputAttributeDataToPointData
void SetOutputAttributeDataToPointData()
Definition: vtkFieldDataToAttributeDataFilter.h:105
vtkFieldDataToAttributeDataFilter::SetNormalComponent
void SetNormalComponent(int comp, const char *arrayName, int arrayComp)
Definition: vtkFieldDataToAttributeDataFilter.h:160
vtkX3D::name
@ name
Definition: vtkX3D.h:225
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
vtkFieldDataToAttributeDataFilter::SetInputFieldToPointDataField
void SetInputFieldToPointDataField()
Definition: vtkFieldDataToAttributeDataFilter.h:94
vtkDataSetAlgorithm.h
vtkDataSetAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkDataSetAlgorithm::RequestUpdateExtent
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when each filter in the pipeline decides what portion of its inp...
Definition: vtkDataSetAlgorithm.h:152
vtkFieldDataToAttributeDataFilter::SetVectorComponent
void SetVectorComponent(int comp, const char *arrayName, int arrayComp)
Definition: vtkFieldDataToAttributeDataFilter.h:139
vtkFieldDataToAttributeDataFilter::SetTCoordComponent
void SetTCoordComponent(int comp, const char *arrayName, int arrayComp)
Definition: vtkFieldDataToAttributeDataFilter.h:202
vtkFieldDataToAttributeDataFilter::DefaultNormalize
vtkTypeBool DefaultNormalize
Definition: vtkFieldDataToAttributeDataFilter.h:304
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69