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=========================================================================*/
64#ifndef vtkFieldDataToAttributeDataFilter_h
65#define vtkFieldDataToAttributeDataFilter_h
66
67#include "vtkDataSetAlgorithm.h"
68#include "vtkFiltersCoreModule.h" // For export macro
69
70#define VTK_DATA_OBJECT_FIELD 0
71#define VTK_POINT_DATA_FIELD 1
72#define VTK_CELL_DATA_FIELD 2
73
74#define VTK_CELL_DATA 0
75#define VTK_POINT_DATA 1
76
77class vtkDataArray;
79class vtkFieldData;
80
81class VTKFILTERSCORE_EXPORT vtkFieldDataToAttributeDataFilter : public vtkDataSetAlgorithm
82{
83public:
84 void PrintSelf(ostream& os, vtkIndent indent) override;
86
92
94
100 vtkSetMacro(InputField, int);
101 vtkGetMacro(InputField, int);
104 void SetInputFieldToCellDataField() { this->SetInputField(VTK_CELL_DATA_FIELD); }
106
108
111 vtkSetMacro(OutputAttributeData, int);
112 vtkGetMacro(OutputAttributeData, int);
113 void SetOutputAttributeDataToCellData() { this->SetOutputAttributeData(VTK_CELL_DATA); }
114 void SetOutputAttributeDataToPointData() { this->SetOutputAttributeData(VTK_POINT_DATA); }
116
118
126 int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
127 void SetScalarComponent(int comp, const char* arrayName, int arrayComp)
128 {
129 this->SetScalarComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
130 }
131 const char* GetScalarComponentArrayName(int comp);
137
139
147 int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
148 void SetVectorComponent(int comp, const char* arrayName, int arrayComp)
149 {
150 this->SetVectorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
151 }
152 const char* GetVectorComponentArrayName(int comp);
158
160
168 int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
169 void SetNormalComponent(int comp, const char* arrayName, int arrayComp)
170 {
171 this->SetNormalComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
172 }
173 const char* GetNormalComponentArrayName(int comp);
179
181
189 int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
190 void SetTensorComponent(int comp, const char* arrayName, int arrayComp)
191 {
192 this->SetTensorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
193 }
194 const char* GetTensorComponentArrayName(int comp);
200
202
210 int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
211 void SetTCoordComponent(int comp, const char* arrayName, int arrayComp)
212 {
213 this->SetTCoordComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
214 }
215 const char* GetTCoordComponentArrayName(int comp);
221
223
227 vtkSetMacro(DefaultNormalize, vtkTypeBool);
228 vtkGetMacro(DefaultNormalize, vtkTypeBool);
229 vtkBooleanMacro(DefaultNormalize, vtkTypeBool);
231
232 // Helper functions, made public to support other classes
233
239 static int GetComponentsType(int numComp, vtkDataArray** arrays);
240
247 static int ConstructArray(vtkDataArray* da, int comp, vtkDataArray* fieldArray, int fieldComp,
248 vtkIdType min, vtkIdType max, int normalize);
249
253 static vtkDataArray* GetFieldArray(vtkFieldData* fd, const char* name, int comp);
254
258 static void SetArrayName(vtkObject* self, char*& name, const char* newName);
259
264 static int UpdateComponentRange(vtkDataArray* da, vtkIdType compRange[2]);
265
270
271protected:
274
276 vtkInformationVector*) override; // generate output data
277
280
281 int NumberOfScalarComponents; // the number of components to fill-in
282 char* ScalarArrays[4]; // the name of the arrays used to construct the scalar
283 int ScalarArrayComponents[4]; // the components of the arrays used to construct
284 vtkIdType ScalarComponentRange[4][2]; // the range of the components to use
285 int ScalarNormalize[4]; // flags control normalization
286
287 char* VectorArrays[3]; // the name of the arrays used to construct the vectors
288 int VectorArrayComponents[3]; // the components of the arrays used to construct
289 vtkIdType VectorComponentRange[3][2]; // the range of the components to use
290 int VectorNormalize[3]; // flags control normalization
291
292 char* GhostLevelArray; // the name of the array used to construct the ghost levels
293 int GhostLevelArrayComponent; // the component of the array used to construct
294 vtkIdType GhostLevelComponentRange[2]; // the range of the components to use
295 int GhostLevelNormalize; // flags control normalization
296
297 char* NormalArrays[3]; // the name of the arrays used to construct the normals
298 int NormalArrayComponents[3]; // the components of the arrays used to construct
299 vtkIdType NormalComponentRange[3][2]; // the range of the components to use
300 int NormalNormalize[3]; // flags control normalization
301
302 char* TensorArrays[9]; // the name of the arrays used to construct the tensors
303 int TensorArrayComponents[9]; // the components of the arrays used to construct
304 vtkIdType TensorComponentRange[9][2]; // the range of the components to use
305 int TensorNormalize[9]; // flags control normalization
306
307 int NumberOfTCoordComponents; // the number of components to fill-in
308 char* TCoordArrays[3]; // the name of the arrays used to construct the tcoords
309 int TCoordArrayComponents[3]; // the components of the arrays used to construct
310 vtkIdType TCoordComponentRange[3][2]; // the range of the components to use
311 int TCoordNormalize[3]; // flags control normalization
312
314
316 vtkIdType componentRange[4][2], char* arrays[4], int arrayComponents[4], int normalize[4],
317 int numComp);
319 vtkIdType componentRange[3][2], char* arrays[3], int arrayComponents[3], int normalize[3]);
321 vtkIdType componentRange[2], char* array, int arrayComponent, int normalize);
323 vtkIdType componentRange[3][2], char* arrays[3], int arrayComponents[3], int normalize[3]);
325 vtkIdType componentRange[3][2], char* arrays[3], int arrayComponents[3], int normalize[3],
326 int numComp);
328 vtkIdType componentRange[9][2], char* arrays[9], int arrayComponents[9], int normalize[9]);
330
331private:
333 void operator=(const vtkFieldDataToAttributeDataFilter&) = delete;
334};
335
336#endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:59
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.
static vtkFieldDataToAttributeDataFilter * New()
Construct object with input field set to the data object field, and the output attribute data set to ...
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])
const char * GetTCoordComponentArrayName(int comp)
Define the components of the field to be used for the cell texture coord components.
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])
static void SetArrayName(vtkObject *self, char *&name, const char *newName)
Specify an array name for one of the components.
const char * GetVectorComponentArrayName(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 * 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.
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.
const char * GetTensorComponentArrayName(int comp)
Define the components of the field to be used for the tensor components.
int GetTensorComponentArrayComponent(int comp)
Define the components of the field to be used for the tensor 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.
static vtkDataArray * GetFieldArray(vtkFieldData *fd, const char *name, int comp)
Return an array of a particular name from field data and do error checking.
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:64
a simple class to control print indentation
Definition: vtkIndent.h:43
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
abstract base class for most VTK objects
Definition: vtkObject.h:63
@ 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)