VTK  9.4.20250130
vtkExtractStructuredGridHelper.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
18#ifndef vtkExtractStructuredGridHelper_h
19#define vtkExtractStructuredGridHelper_h
20
21#include "vtkCommonDataModelModule.h" // For export macro
22#include "vtkObject.h"
23
24// Forward declarations
25VTK_ABI_NAMESPACE_BEGIN
26class vtkCellData;
27class vtkPointData;
28class vtkPoints;
29VTK_ABI_NAMESPACE_END
30
31namespace vtk
32{
33namespace detail
34{
35VTK_ABI_NAMESPACE_BEGIN
36
37struct vtkIndexMap;
38
39VTK_ABI_NAMESPACE_END
40} // END namespace detail
41} // END namespace vtk
42
43VTK_ABI_NAMESPACE_BEGIN
44class VTKCOMMONDATAMODEL_EXPORT vtkExtractStructuredGridHelper : public vtkObject
45{
46public:
49 void PrintSelf(ostream& os, vtkIndent indent) override;
50
51 // Get & Set Macros
52 vtkGetVector6Macro(OutputWholeExtent, int);
53
61 void Initialize(int voi[6], int wholeExt[6], int sampleRate[3], bool includeBoundary);
62
66 bool IsValid() const;
67
73 int GetSize(int dim);
74
87 int GetMappedIndex(int dim, int outIdx);
88
102 int GetMappedIndexFromExtentValue(int dim, int outExtVal);
103
116 int GetMappedExtentValue(int dim, int outExtVal);
117
130 int GetMappedExtentValueFromIndex(int dim, int outIdx);
131
139 void ComputeBeginAndEnd(int inExt[6], int voi[6], int begin[3], int end[3]);
140
152 void CopyPointsAndPointData(int inExt[6], int outExt[6], vtkPointData* pd, vtkPoints* inpnts,
153 vtkPointData* outPD, vtkPoints* outpnts);
154
164 void CopyCellData(int inExt[6], int outExt[6], vtkCellData* cd, vtkCellData* outCD);
165
179 static void GetPartitionedVOI(const int globalVOI[6], const int partitionedExtent[6],
180 const int sampleRate[3], bool includeBoundary, int partitionedVOI[6]);
196 static void GetPartitionedOutputExtent(const int globalVOI[6], const int partitionedVOI[6],
197 const int outputWholeExtent[6], const int sampleRate[3], bool includeBoundary,
198 int partitionedOutputExtent[6]);
199
200protected:
203
204 // Input parameters -- used to reinitialize when data changes.
205 int VOI[6];
206 int InputWholeExtent[6];
207 int SampleRate[3];
209
210 int OutputWholeExtent[6];
211 vtk::detail::vtkIndexMap* IndexMap;
212
217
218private:
220 void operator=(const vtkExtractStructuredGridHelper&) = delete;
221};
222
223VTK_ABI_NAMESPACE_END
224#endif /* VTKEXTRACTSTRUCTUREDGRIDHELPER_H_ */
represent and manipulate cell attribute data
helper for extracting/sub-sampling structured datasets.
int GetMappedIndexFromExtentValue(int dim, int outExtVal)
Given a dimension and output extent value, return the corresponding input extent index.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static void GetPartitionedOutputExtent(const int globalVOI[6], const int partitionedVOI[6], const int outputWholeExtent[6], const int sampleRate[3], bool includeBoundary, int partitionedOutputExtent[6])
Calculate the partitioned output extent for a partitioned structured dataset.
void Invalidate()
Invalidates the output extent.
int GetMappedIndex(int dim, int outIdx)
Given a dimension and output index, return the corresponding extent index.
int GetSize(int dim)
Returns the size along a given dimension.
void CopyCellData(int inExt[6], int outExt[6], vtkCellData *cd, vtkCellData *outCD)
Copies the cell data to the output.
void Initialize(int voi[6], int wholeExt[6], int sampleRate[3], bool includeBoundary)
Initializes the index map.
static vtkExtractStructuredGridHelper * New()
void ComputeBeginAndEnd(int inExt[6], int voi[6], int begin[3], int end[3])
Returns the begin & end extent that intersects with the VOI.
int GetMappedExtentValue(int dim, int outExtVal)
Given a dimension and output extent value, return the corresponding input extent value.
bool IsValid() const
Returns true if the helper is properly initialized.
void CopyPointsAndPointData(int inExt[6], int outExt[6], vtkPointData *pd, vtkPoints *inpnts, vtkPointData *outPD, vtkPoints *outpnts)
Copies the points & point data to the output.
int GetMappedExtentValueFromIndex(int dim, int outIdx)
Given a dimension and output extent index, return the corresponding input extent value.
~vtkExtractStructuredGridHelper() override
static void GetPartitionedVOI(const int globalVOI[6], const int partitionedExtent[6], const int sampleRate[3], bool includeBoundary, int partitionedVOI[6])
Calculate the VOI for a partitioned structured dataset.
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162
represent and manipulate point attribute data
represent and manipulate 3D points
Definition vtkPoints.h:139
Specialization of tuple ranges and iterators for vtkAOSDataArrayTemplate.