VTK
vtkExtractStructuredGridHelper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkExtractGrid.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 =========================================================================*/
30 #ifndef vtkExtractStructuredGridHelper_h
31 #define vtkExtractStructuredGridHelper_h
32 
33 #include "vtkCommonDataModelModule.h" // For export macro
34 #include "vtkObject.h"
35 
36 // Forward declarations
37 class vtkCellData;
38 class vtkPointData;
39 class vtkPoints;
40 
41 namespace vtk
42 {
43 namespace detail
44 {
45 
46 struct vtkIndexMap;
47 
48 } // END namespace detail
49 } // END namespace vtk
50 
51 class VTKCOMMONDATAMODEL_EXPORT vtkExtractStructuredGridHelper :
52  public vtkObject
53 {
54 public:
57  void PrintSelf(ostream& os, vtkIndent indent) override;
58 
59  // Get & Set Macros
60  vtkGetVector6Macro(OutputWholeExtent,int);
61 
69  void Initialize(int voi[6], int wholeExt[6], int sampleRate[3],
70  bool includeBoundary);
71 
75  bool IsValid() const;
76 
82  int GetSize(const int dim);
83 
96  int GetMappedIndex(int dim, int outIdx);
97 
111  int GetMappedIndexFromExtentValue(int dim, int outExtVal);
112 
125  int GetMappedExtentValue(int dim, int outExtVal);
126 
139  int GetMappedExtentValueFromIndex(int dim, int outIdx);
140 
148  void ComputeBeginAndEnd(int inExt[6], int voi[6], int begin[3], int end[3]);
149 
161  void CopyPointsAndPointData( int inExt[6], int outExt[6],
162  vtkPointData* pd, vtkPoints* inpnts,
163  vtkPointData* outPD, vtkPoints* outpnts);
164 
174  void CopyCellData(int inExt[6], int outExt[6],
175  vtkCellData* cd, vtkCellData* outCD);
176 
190  static void GetPartitionedVOI(const int globalVOI[6],
191  const int partitionedExtent[6],
192  const int sampleRate[3],
193  bool includeBoundary,
194  int partitionedVOI[6]);
210  static void GetPartitionedOutputExtent(const int globalVOI[6],
211  const int partitionedVOI[6],
212  const int outputWholeExtent[6],
213  const int sampleRate[3],
214  bool includeBoundary,
215  int partitionedOutputExtent[6]);
216 
217 protected:
220 
221  // Input parameters -- used to reinitialize when data changes.
222  int VOI[6];
223  int InputWholeExtent[6];
224  int SampleRate[3];
226 
227  int OutputWholeExtent[6];
228  vtk::detail::vtkIndexMap* IndexMap;
229 
233  void Invalidate();
234 
235 private:
237  void operator=(const vtkExtractStructuredGridHelper&) = delete;
238 };
239 
240 #endif /* VTKEXTRACTSTRUCTUREDGRIDHELPER_H_ */
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:40
vtkExtractStructuredGridHelper::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkExtractStructuredGridHelper::GetPartitionedVOI
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.
vtkExtractStructuredGridHelper::IndexMap
vtk::detail::vtkIndexMap * IndexMap
Definition: vtkExtractStructuredGridHelper.h:228
vtkExtractStructuredGridHelper::IsValid
bool IsValid() const
Returns true if the helper is properly initialized.
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:38
vtkExtractStructuredGridHelper::GetMappedIndexFromExtentValue
int GetMappedIndexFromExtentValue(int dim, int outExtVal)
Given a dimension and output extent value, return the corresponding input extent index.
vtkExtractStructuredGridHelper::CopyCellData
void CopyCellData(int inExt[6], int outExt[6], vtkCellData *cd, vtkCellData *outCD)
Copies the cell data to the output.
vtkExtractStructuredGridHelper::GetMappedExtentValueFromIndex
int GetMappedExtentValueFromIndex(int dim, int outIdx)
Given a dimension and output extent index, return the corresponding input extent value.
vtkExtractStructuredGridHelper::Initialize
void Initialize(int voi[6], int wholeExt[6], int sampleRate[3], bool includeBoundary)
Initializes the index map.
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:60
detail
Definition: vtkGenericDataArrayLookupHelper.h:30
vtkExtractStructuredGridHelper
helper for extracting/sub-sampling structured datasets.
Definition: vtkExtractStructuredGridHelper.h:53
vtkExtractStructuredGridHelper::GetMappedIndex
int GetMappedIndex(int dim, int outIdx)
Given a dimension and output index, return the corresponding extent index.
vtkX3D::sampleRate
@ sampleRate
Definition: vtkX3D.h:472
vtkExtractStructuredGridHelper::GetPartitionedOutputExtent
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.
vtkExtractStructuredGridHelper::Invalidate
void Invalidate()
Invalidates the output extent.
vtkCellData
represent and manipulate cell attribute data
Definition: vtkCellData.h:39
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkExtractStructuredGridHelper::vtkExtractStructuredGridHelper
vtkExtractStructuredGridHelper()
vtkExtractStructuredGridHelper::ComputeBeginAndEnd
void ComputeBeginAndEnd(int inExt[6], int voi[6], int begin[3], int end[3])
Returns the begin & end extent that intersects with the VOI.
vtkObject.h
vtkExtractStructuredGridHelper::CopyPointsAndPointData
void CopyPointsAndPointData(int inExt[6], int outExt[6], vtkPointData *pd, vtkPoints *inpnts, vtkPointData *outPD, vtkPoints *outpnts)
Copies the points & point data to the output.
vtkExtractStructuredGridHelper::New
static vtkExtractStructuredGridHelper * New()
vtkExtractStructuredGridHelper::IncludeBoundary
bool IncludeBoundary
Definition: vtkExtractStructuredGridHelper.h:225
vtkExtractStructuredGridHelper::GetSize
int GetSize(const int dim)
Returns the size along a given dimension.
vtk
Definition: vtkAtomicTypeConcepts.h:22
vtkExtractStructuredGridHelper::GetMappedExtentValue
int GetMappedExtentValue(int dim, int outExtVal)
Given a dimension and output extent value, return the corresponding input extent value.
vtkExtractStructuredGridHelper::~vtkExtractStructuredGridHelper
~vtkExtractStructuredGridHelper() override