VTK  9.5.20250917
vtkFieldDataToAttributeDataFilter.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
75#ifndef vtkFieldDataToAttributeDataFilter_h
76#define vtkFieldDataToAttributeDataFilter_h
77
78#include "vtkDataSetAlgorithm.h"
79#include "vtkFiltersCoreModule.h" // For export macro
80#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
81
82#define VTK_DATA_OBJECT_FIELD 0
83#define VTK_POINT_DATA_FIELD 1
84#define VTK_CELL_DATA_FIELD 2
85
86#define VTK_CELL_DATA 0
87#define VTK_POINT_DATA 1
88
89VTK_ABI_NAMESPACE_BEGIN
90class vtkDataArray;
92class vtkFieldData;
93
95 : public vtkDataSetAlgorithm
96{
97public:
98 void PrintSelf(ostream& os, vtkIndent indent) override;
100
106
108
114 vtkSetMacro(InputField, int);
115 vtkGetMacro(InputField, int);
118 void SetInputFieldToCellDataField() { this->SetInputField(VTK_CELL_DATA_FIELD); }
120
122
125 vtkSetMacro(OutputAttributeData, int);
126 vtkGetMacro(OutputAttributeData, int);
127 void SetOutputAttributeDataToCellData() { this->SetOutputAttributeData(VTK_CELL_DATA); }
128 void SetOutputAttributeDataToPointData() { this->SetOutputAttributeData(VTK_POINT_DATA); }
130
132
140 int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
141 void SetScalarComponent(int comp, const char* arrayName, int arrayComp)
142 {
143 this->SetScalarComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
144 }
145 const char* GetScalarComponentArrayName(int comp);
151
153
161 int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
162 void SetVectorComponent(int comp, const char* arrayName, int arrayComp)
163 {
164 this->SetVectorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
165 }
166 const char* GetVectorComponentArrayName(int comp);
172
174
182 int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
183 void SetNormalComponent(int comp, const char* arrayName, int arrayComp)
184 {
185 this->SetNormalComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
186 }
187 const char* GetNormalComponentArrayName(int comp);
193
195
203 int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
204 void SetTensorComponent(int comp, const char* arrayName, int arrayComp)
205 {
206 this->SetTensorComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
207 }
208 const char* GetTensorComponentArrayName(int comp);
214
216
224 int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
225 void SetTCoordComponent(int comp, const char* arrayName, int arrayComp)
226 {
227 this->SetTCoordComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
228 }
229 const char* GetTCoordComponentArrayName(int comp);
235
237
241 vtkSetMacro(DefaultNormalize, vtkTypeBool);
242 vtkGetMacro(DefaultNormalize, vtkTypeBool);
243 vtkBooleanMacro(DefaultNormalize, vtkTypeBool);
245
246 // Helper functions, made public to support other classes
247
253 static int GetComponentsType(int numComp, vtkDataArray** arrays);
254
261 static int ConstructArray(vtkDataArray* da, int comp, vtkDataArray* fieldArray, int fieldComp,
262 vtkIdType min, vtkIdType max, int normalize);
263
267 static vtkDataArray* GetFieldArray(vtkFieldData* fd, const char* name, int comp);
268
272 static void SetArrayName(vtkObject* self, char*& name, const char* newName);
273
278 static int UpdateComponentRange(vtkDataArray* da, vtkIdType compRange[2]);
279
284
285protected:
288
290 vtkInformationVector*) override; // generate output data
291
294
295 int NumberOfScalarComponents; // the number of components to fill-in
296 char* ScalarArrays[4]; // the name of the arrays used to construct the scalar
297 int ScalarArrayComponents[4]; // the components of the arrays used to construct
298 vtkIdType ScalarComponentRange[4][2]; // the range of the components to use
299 int ScalarNormalize[4]; // flags control normalization
300
301 char* VectorArrays[3]; // the name of the arrays used to construct the vectors
302 int VectorArrayComponents[3]; // the components of the arrays used to construct
303 vtkIdType VectorComponentRange[3][2]; // the range of the components to use
304 int VectorNormalize[3]; // flags control normalization
305
306 char* GhostLevelArray; // the name of the array used to construct the ghost levels
307 int GhostLevelArrayComponent; // the component of the array used to construct
308 vtkIdType GhostLevelComponentRange[2]; // the range of the components to use
309 int GhostLevelNormalize; // flags control normalization
310
311 char* NormalArrays[3]; // the name of the arrays used to construct the normals
312 int NormalArrayComponents[3]; // the components of the arrays used to construct
313 vtkIdType NormalComponentRange[3][2]; // the range of the components to use
314 int NormalNormalize[3]; // flags control normalization
315
316 char* TensorArrays[9]; // the name of the arrays used to construct the tensors
317 int TensorArrayComponents[9]; // the components of the arrays used to construct
318 vtkIdType TensorComponentRange[9][2]; // the range of the components to use
319 int TensorNormalize[9]; // flags control normalization
320
321 int NumberOfTCoordComponents; // the number of components to fill-in
322 char* TCoordArrays[3]; // the name of the arrays used to construct the tcoords
323 int TCoordArrayComponents[3]; // the components of the arrays used to construct
324 vtkIdType TCoordComponentRange[3][2]; // the range of the components to use
325 int TCoordNormalize[3]; // flags control normalization
326
328
330 vtkIdType componentRange[4][2], char* arrays[4], int arrayComponents[4], int normalize[4],
331 int numComp);
333 vtkIdType componentRange[3][2], char* arrays[3], int arrayComponents[3], int normalize[3]);
335 vtkIdType componentRange[2], char* array, int arrayComponent, int normalize);
337 vtkIdType componentRange[3][2], char* arrays[3], int arrayComponents[3], int normalize[3]);
339 vtkIdType componentRange[3][2], char* arrays[3], int arrayComponents[3], int normalize[3],
340 int numComp);
342 vtkIdType componentRange[9][2], char* arrays[9], int arrayComponents[9], int normalize[9]);
344
345private:
347 void operator=(const vtkFieldDataToAttributeDataFilter&) = delete;
348};
349
350VTK_ABI_NAMESPACE_END
351#endif
abstract superclass for arrays of numeric data
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.
Represents and manipulates a collection of data arrays.
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
abstract base class for most VTK objects
Definition vtkObject.h:162
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_POINT_DATA_FIELD
#define VTK_CELL_DATA_FIELD
#define VTK_DATA_OBJECT_FIELD
int vtkIdType
Definition vtkType.h:333
#define VTK_MARSHALAUTO
#define max(a, b)