VTK  9.3.0
vtkDataObjectToDataSetFilter.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
65 #ifndef vtkDataObjectToDataSetFilter_h
66 #define vtkDataObjectToDataSetFilter_h
67 
68 #include "vtkDataSetAlgorithm.h"
69 #include "vtkFiltersCoreModule.h" // For export macro
70 
71 VTK_ABI_NAMESPACE_BEGIN
72 class vtkCellArray;
73 class vtkDataArray;
74 class vtkDataSet;
75 class vtkPointSet;
76 class vtkPolyData;
77 class vtkRectilinearGrid;
78 class vtkStructuredGrid;
81 
82 class VTKFILTERSCORE_EXPORT vtkDataObjectToDataSetFilter : public vtkDataSetAlgorithm
83 {
84 public:
87  void PrintSelf(ostream& os, vtkIndent indent) override;
88 
93 
95 
98  void SetDataSetType(int);
99  vtkGetMacro(DataSetType, int);
100  void SetDataSetTypeToPolyData() { this->SetDataSetType(VTK_POLY_DATA); }
101  void SetDataSetTypeToStructuredPoints() { this->SetDataSetType(VTK_STRUCTURED_POINTS); }
102  void SetDataSetTypeToStructuredGrid() { this->SetDataSetType(VTK_STRUCTURED_GRID); }
103  void SetDataSetTypeToRectilinearGrid() { this->SetDataSetType(VTK_RECTILINEAR_GRID); }
104  void SetDataSetTypeToUnstructuredGrid() { this->SetDataSetType(VTK_UNSTRUCTURED_GRID); }
106 
108 
123 
125 
138  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
139  void SetPointComponent(int comp, const char* arrayName, int arrayComp)
140  {
141  this->SetPointComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
142  }
143  const char* GetPointComponentArrayName(int comp);
149 
151 
160  void SetVertsComponent(const char* arrayName, int arrayComp, int min, int max);
161  void SetVertsComponent(const char* arrayName, int arrayComp)
162  {
163  this->SetVertsComponent(arrayName, arrayComp, -1, -1);
164  }
169  void SetLinesComponent(const char* arrayName, int arrayComp, int min, int max);
170  void SetLinesComponent(const char* arrayName, int arrayComp)
171  {
172  this->SetLinesComponent(arrayName, arrayComp, -1, -1);
173  }
178  void SetPolysComponent(const char* arrayName, int arrayComp, int min, int max);
179  void SetPolysComponent(const char* arrayName, int arrayComp)
180  {
181  this->SetPolysComponent(arrayName, arrayComp, -1, -1);
182  }
187  void SetStripsComponent(const char* arrayName, int arrayComp, int min, int max);
188  void SetStripsComponent(const char* arrayName, int arrayComp)
189  {
190  this->SetStripsComponent(arrayName, arrayComp, -1, -1);
191  }
197 
199 
208  void SetCellTypeComponent(const char* arrayName, int arrayComp, int min, int max);
209  void SetCellTypeComponent(const char* arrayName, int arrayComp)
210  {
211  this->SetCellTypeComponent(arrayName, arrayComp, -1, -1);
212  }
217  void SetCellConnectivityComponent(const char* arrayName, int arrayComp, int min, int max);
218  void SetCellConnectivityComponent(const char* arrayName, int arrayComp)
219  {
220  this->SetCellConnectivityComponent(arrayName, arrayComp, -1, -1);
221  }
227 
229 
233  vtkSetMacro(DefaultNormalize, vtkTypeBool);
234  vtkGetMacro(DefaultNormalize, vtkTypeBool);
235  vtkBooleanMacro(DefaultNormalize, vtkTypeBool);
237 
239 
244  vtkSetVector3Macro(Dimensions, int);
245  vtkGetVectorMacro(Dimensions, int, 3);
247 
249 
253  vtkSetVector3Macro(Origin, double);
254  vtkGetVectorMacro(Origin, double, 3);
256 
258 
262  vtkSetVector3Macro(Spacing, double);
263  vtkGetVectorMacro(Spacing, double, 3);
265 
267 
273  void SetDimensionsComponent(const char* arrayName, int arrayComp, int min, int max);
274  void SetDimensionsComponent(const char* arrayName, int arrayComp)
275  {
276  this->SetDimensionsComponent(arrayName, arrayComp, -1, -1);
277  }
278  void SetSpacingComponent(const char* arrayName, int arrayComp, int min, int max);
279  void SetSpacingComponent(const char* arrayName, int arrayComp)
280  {
281  this->SetSpacingComponent(arrayName, arrayComp, -1, -1);
282  }
283  void SetOriginComponent(const char* arrayName, int arrayComp, int min, int max);
284  void SetOriginComponent(const char* arrayName, int arrayComp)
285  {
286  this->SetOriginComponent(arrayName, arrayComp, -1, -1);
287  }
289 
290 protected:
293 
295  vtkInformationVector*) override; // generate output data
300 
301  char Updating;
302 
303  // control flags used to generate the output dataset
304  int DataSetType; // the type of dataset to generate
305 
306  // Support definition of points
307  char* PointArrays[3]; // the name of the arrays
308  int PointArrayComponents[3]; // the array components used for x-y-z
309  vtkIdType PointComponentRange[3][2]; // the range of the components to use
310  int PointNormalize[3]; // flags control normalization
311 
312  // These define cells for vtkPolyData
313  char* VertsArray; // the name of the array
314  int VertsArrayComponent; // the array component
315  vtkIdType VertsComponentRange[2]; // the range of the components to use
316 
317  char* LinesArray; // the name of the array
318  int LinesArrayComponent; // the array component used for cell types
319  vtkIdType LinesComponentRange[2]; // the range of the components to use
320 
321  char* PolysArray; // the name of the array
322  int PolysArrayComponent; // the array component
323  vtkIdType PolysComponentRange[2]; // the range of the components to use
324 
325  char* StripsArray; // the name of the array
326  int StripsArrayComponent; // the array component
327  vtkIdType StripsComponentRange[2]; // the range of the components to use
328 
329  // Used to define vtkUnstructuredGrid datasets
330  char* CellTypeArray; // the name of the array
331  int CellTypeArrayComponent; // the array component used for cell types
332  vtkIdType CellTypeComponentRange[2]; // the range of the components to use
333 
334  char* CellConnectivityArray; // the name of the array
335  int CellConnectivityArrayComponent; // the array components used for cell connectivity
336  vtkIdType CellConnectivityComponentRange[2]; // the range of the components to use
337 
338  // helper methods (and attributes) to construct datasets
339  void SetArrayName(char*& name, char* newName);
344  vtkCellArray* ConstructCellArray(vtkDataArray* da, int comp, vtkIdType compRange[2]);
345 
346  // Default value for normalization
348 
349  // Couple of different ways to specify dimensions, spacing, and origin.
350  int Dimensions[3];
351  double Origin[3];
352  double Spacing[3];
353 
354  char* DimensionsArray; // the name of the array
355  int DimensionsArrayComponent; // the component of the array used for dimensions
356  vtkIdType DimensionsComponentRange[2]; // the ComponentRange of the array for the dimensions
357 
358  char* OriginArray; // the name of the array
359  int OriginArrayComponent; // the component of the array used for Origins
360  vtkIdType OriginComponentRange[2]; // the ComponentRange of the array for the Origins
361 
362  char* SpacingArray; // the name of the array
363  int SpacingArrayComponent; // the component of the array used for Spacings
364  vtkIdType SpacingComponentRange[2]; // the ComponentRange of the array for the Spacings
365 
369 
370 private:
372  void operator=(const vtkDataObjectToDataSetFilter&) = delete;
373 };
374 
375 VTK_ABI_NAMESPACE_END
376 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:185
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
map field data to concrete dataset
void SetCellTypeComponent(const char *arrayName, int arrayComp, int min, int max)
Define cell types and cell connectivity when creating unstructured grid data.
int GetPointComponentMaxRange(int comp)
Define the component of the field to be used for the x, y, and z values of the points.
void SetLinesComponent(const char *arrayName, int arrayComp)
Define cell connectivity when creating vtkPolyData.
static vtkDataObjectToDataSetFilter * New()
void SetStripsComponent(const char *arrayName, int arrayComp)
Define cell connectivity when creating vtkPolyData.
void SetArrayName(char *&name, char *newName)
void SetCellConnectivityComponent(const char *arrayName, int arrayComp)
Define cell types and cell connectivity when creating unstructured grid data.
vtkRectilinearGrid * GetRectilinearGridOutput()
Get the output in different forms.
int GetCellConnectivityComponentMinRange()
Define cell types and cell connectivity when creating unstructured grid data.
const char * GetPointComponentArrayName(int comp)
Define the component of the field to be used for the x, y, and z values of the points.
void SetPointComponent(int comp, const char *arrayName, int arrayComp, int min, int max, int normalize)
Define the component of the field to be used for the x, y, and z values of the points.
int GetLinesComponentArrayComponent()
Define cell connectivity when creating vtkPolyData.
int GetPointComponentNormailzeFlag(int comp)
Define the component of the field to be used for the x, y, and z values of the points.
int GetCellConnectivityComponentMaxRange()
Define cell types and cell connectivity when creating unstructured grid data.
void SetOriginComponent(const char *arrayName, int arrayComp, int min, int max)
Alternative methods to specify the dimensions, spacing, and origin for those datasets requiring this ...
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when a request asks the algorithm to do its work.
void SetDataSetTypeToRectilinearGrid()
Control what type of data is generated for output.
int GetStripsComponentMinRange()
Define cell connectivity when creating vtkPolyData.
int GetStripsComponentArrayComponent()
Define cell connectivity when creating vtkPolyData.
const char * GetStripsComponentArrayName()
Define cell connectivity when creating vtkPolyData.
int GetPointComponentArrayComponent(int comp)
Define the component of the field to be used for the x, y, and z values of the points.
int ConstructCells(vtkDataObject *input, vtkPolyData *pd)
int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when a request asks the algorithm to create empty output data ob...
void SetSpacingComponent(const char *arrayName, int arrayComp)
Alternative methods to specify the dimensions, spacing, and origin for those datasets requiring this ...
void SetStripsComponent(const char *arrayName, int arrayComp, int min, int max)
Define cell connectivity when creating vtkPolyData.
int GetStripsComponentMaxRange()
Define cell connectivity when creating vtkPolyData.
int GetLinesComponentMinRange()
Define cell connectivity when creating vtkPolyData.
void SetDimensionsComponent(const char *arrayName, int arrayComp, int min, int max)
Alternative methods to specify the dimensions, spacing, and origin for those datasets requiring this ...
const char * GetCellTypeComponentArrayName()
Define cell types and cell connectivity when creating unstructured grid data.
void SetSpacingComponent(const char *arrayName, int arrayComp, int min, int max)
Alternative methods to specify the dimensions, spacing, and origin for those datasets requiring this ...
void SetDataSetTypeToUnstructuredGrid()
Control what type of data is generated for output.
void SetDataSetTypeToStructuredGrid()
Control what type of data is generated for output.
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when a request asks for Information.
~vtkDataObjectToDataSetFilter() override
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when each filter in the pipeline decides what portion of its inp...
void SetDataSetTypeToStructuredPoints()
Control what type of data is generated for output.
void SetPointComponent(int comp, const char *arrayName, int arrayComp)
Define the component of the field to be used for the x, y, and z values of the points.
int GetPolysComponentArrayComponent()
Define cell connectivity when creating vtkPolyData.
vtkStructuredPoints * GetStructuredPointsOutput()
Get the output in different forms.
vtkDataSet * GetOutput(int idx)
Get the output in different forms.
vtkIdType ConstructPoints(vtkDataObject *input, vtkPointSet *ps)
vtkUnstructuredGrid * GetUnstructuredGridOutput()
Get the output in different forms.
vtkDataSet * GetOutput()
Get the output in different forms.
const char * GetVertsComponentArrayName()
Define cell connectivity when creating vtkPolyData.
void SetCellConnectivityComponent(const char *arrayName, int arrayComp, int min, int max)
Define cell types and cell connectivity when creating unstructured grid data.
void SetCellTypeComponent(const char *arrayName, int arrayComp)
Define cell types and cell connectivity when creating unstructured grid data.
int GetPointComponentMinRange(int comp)
Define the component of the field to be used for the x, y, and z values of the points.
const char * GetLinesComponentArrayName()
Define cell connectivity when creating vtkPolyData.
void ConstructOrigin(vtkDataObject *input)
void ConstructSpacing(vtkDataObject *input)
int GetCellTypeComponentArrayComponent()
Define cell types and cell connectivity when creating unstructured grid data.
int GetVertsComponentMinRange()
Define cell connectivity when creating vtkPolyData.
int GetCellTypeComponentMinRange()
Define cell types and cell connectivity when creating unstructured grid data.
vtkCellArray * ConstructCellArray(vtkDataArray *da, int comp, vtkIdType compRange[2])
void SetLinesComponent(const char *arrayName, int arrayComp, int min, int max)
Define cell connectivity when creating vtkPolyData.
int GetPolysComponentMaxRange()
Define cell connectivity when creating vtkPolyData.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
void SetDataSetTypeToPolyData()
Control what type of data is generated for output.
void SetVertsComponent(const char *arrayName, int arrayComp)
Define cell connectivity when creating vtkPolyData.
vtkDataObject * GetInput()
Get the input to the filter.
int ConstructCells(vtkDataObject *input, vtkUnstructuredGrid *ug)
const char * GetPolysComponentArrayName()
Define cell connectivity when creating vtkPolyData.
int GetLinesComponentMaxRange()
Define cell connectivity when creating vtkPolyData.
void SetPolysComponent(const char *arrayName, int arrayComp, int min, int max)
Define cell connectivity when creating vtkPolyData.
int GetPolysComponentMinRange()
Define cell connectivity when creating vtkPolyData.
void SetPolysComponent(const char *arrayName, int arrayComp)
Define cell connectivity when creating vtkPolyData.
vtkPolyData * GetPolyDataOutput()
Get the output in different forms.
void ConstructDimensions(vtkDataObject *input)
int GetCellTypeComponentMaxRange()
Define cell types and cell connectivity when creating unstructured grid data.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIdType ConstructPoints(vtkDataObject *input, vtkRectilinearGrid *rg)
void SetOriginComponent(const char *arrayName, int arrayComp)
Alternative methods to specify the dimensions, spacing, and origin for those datasets requiring this ...
void SetVertsComponent(const char *arrayName, int arrayComp, int min, int max)
Define cell connectivity when creating vtkPolyData.
void SetDataSetType(int)
Control what type of data is generated for output.
int GetVertsComponentMaxRange()
Define cell connectivity when creating vtkPolyData.
int GetVertsComponentArrayComponent()
Define cell connectivity when creating vtkPolyData.
void SetDimensionsComponent(const char *arrayName, int arrayComp)
Alternative methods to specify the dimensions, spacing, and origin for those datasets requiring this ...
const char * GetCellConnectivityComponentArrayName()
Define cell types and cell connectivity when creating unstructured grid data.
int GetCellConnectivityComponentArrayComponent()
Define cell types and cell connectivity when creating unstructured grid data.
vtkStructuredGrid * GetStructuredGridOutput()
Get the output in different forms.
general representation of visualization data
Definition: vtkDataObject.h:64
Superclass for algorithms that produce output of the same type as input.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
a simple class to control print indentation
Definition: vtkIndent.h:38
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
concrete class for storing a set of points
Definition: vtkPointSet.h:68
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:89
a dataset that is topologically regular with variable spacing in the three coordinate directions
topologically regular array of data
A subclass of ImageData.
dataset represents arbitrary combinations of all possible cell types
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
@ name
Definition: vtkX3D.h:219
int vtkTypeBool
Definition: vtkABI.h:64
int vtkIdType
Definition: vtkType.h:315
#define VTK_RECTILINEAR_GRID
Definition: vtkType.h:68
#define VTK_UNSTRUCTURED_GRID
Definition: vtkType.h:69
#define VTK_STRUCTURED_GRID
Definition: vtkType.h:67
#define VTK_POLY_DATA
Definition: vtkType.h:65
#define VTK_STRUCTURED_POINTS
Definition: vtkType.h:66
#define max(a, b)