VTK  9.2.20230320
vtkSpanSpace.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSpanSpace.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 =========================================================================*/
42 #ifndef vtkSpanSpace_h
43 #define vtkSpanSpace_h
44 
45 #include "vtkCommonExecutionModelModule.h" // For export macro
46 #include "vtkScalarTree.h"
47 
48 VTK_ABI_NAMESPACE_BEGIN
49 class vtkSpanSpace;
50 struct vtkInternalSpanSpace;
51 
52 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkSpanSpace : public vtkScalarTree
53 {
54 public:
59  static vtkSpanSpace* New();
60 
62 
65  vtkTypeMacro(vtkSpanSpace, vtkScalarTree);
66  void PrintSelf(ostream& os, vtkIndent indent) override;
68 
73  void ShallowCopy(vtkScalarTree* stree) override;
74 
75  //----------------------------------------------------------------------
76  // The following methods are specific to the creation and configuration of
77  // vtkSpanSpace.
78 
80 
88  vtkSetVector2Macro(ScalarRange, double);
89  vtkGetVectorMacro(ScalarRange, double, 2);
91 
93 
97  vtkSetMacro(ComputeScalarRange, vtkTypeBool);
98  vtkGetMacro(ComputeScalarRange, vtkTypeBool);
99  vtkBooleanMacro(ComputeScalarRange, vtkTypeBool);
101 
103 
111  vtkSetClampMacro(Resolution, vtkIdType, 1, 10000);
112  vtkGetMacro(Resolution, vtkIdType);
114 
116 
120  vtkSetMacro(ComputeResolution, vtkTypeBool);
121  vtkGetMacro(ComputeResolution, vtkTypeBool);
122  vtkBooleanMacro(ComputeResolution, vtkTypeBool);
124 
126 
130  vtkSetClampMacro(NumberOfCellsPerBucket, int, 1, VTK_INT_MAX);
131  vtkGetMacro(NumberOfCellsPerBucket, int);
133 
134  //----------------------------------------------------------------------
135  // The following methods satisfy the vtkScalarTree abstract API.
136 
141  void Initialize() override;
142 
147  void BuildTree() override;
148 
156  void InitTraversal(double scalarValue) override;
157 
164  vtkCell* GetNextCell(vtkIdType& cellId, vtkIdList*& ptIds, vtkDataArray* cellScalars) override;
165 
166  // The following methods supports parallel (threaded) traversal. Basically
167  // batches of cells (which are a portion of the whole dataset) are available for
168  // processing in a parallel For() operation.
169 
175  vtkIdType GetNumberOfCellBatches(double scalarValue) override;
176 
182  const vtkIdType* GetCellBatch(vtkIdType batchNum, vtkIdType& numCells) override;
183 
185 
189  vtkSetClampMacro(BatchSize, vtkIdType, 100, VTK_INT_MAX);
190  vtkGetMacro(BatchSize, vtkIdType);
192 
193 protected:
195  ~vtkSpanSpace() override;
196 
197  double ScalarRange[2];
202  vtkInternalSpanSpace* SpanSpace;
204 
205 private:
206  // Internal variables supporting span space traversal
207  vtkIdType RMin[2]; // span space lower left corner
208  vtkIdType RMax[2]; // span space upper right corner
209 
210  // This supports serial traversal via GetNextCell()
211  vtkIdType CurrentRow; // the span space row currently being processed
212  vtkIdType* CurrentSpan; // pointer to current span row
213  vtkIdType CurrentIdx; // position into the current span row
214  vtkIdType CurrentNumCells; // number of cells on the current span row
215 
216 private:
217  vtkSpanSpace(const vtkSpanSpace&) = delete;
218  void operator=(const vtkSpanSpace&) = delete;
219 };
220 
221 VTK_ABI_NAMESPACE_END
222 #endif
abstract class to specify cell behavior
Definition: vtkCell.h:151
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:166
list of point or cell ids
Definition: vtkIdList.h:144
a simple class to control print indentation
Definition: vtkIndent.h:120
organize data according to scalar values (used to accelerate contouring operations)
Definition: vtkScalarTree.h:56
organize data according to scalar span space
Definition: vtkSpanSpace.h:53
static vtkSpanSpace * New()
Instantiate a scalar tree with default resolution of 100 and automatic scalar range computation.
vtkTypeBool ComputeScalarRange
Definition: vtkSpanSpace.h:198
vtkIdType Resolution
Definition: vtkSpanSpace.h:199
vtkIdType BatchSize
Definition: vtkSpanSpace.h:203
void PrintSelf(ostream &os, vtkIndent indent) override
Standard type related macros and PrintSelf() method.
~vtkSpanSpace() override
void InitTraversal(double scalarValue) override
Begin to traverse the cells based on a scalar value.
void Initialize() override
Initialize the span space.
vtkInternalSpanSpace * SpanSpace
Definition: vtkSpanSpace.h:202
vtkTypeBool ComputeResolution
Definition: vtkSpanSpace.h:200
const vtkIdType * GetCellBatch(vtkIdType batchNum, vtkIdType &numCells) override
Return the array of cell ids in the specified batch.
void ShallowCopy(vtkScalarTree *stree) override
This method is used to copy data members when cloning an instance of the class.
vtkIdType GetNumberOfCellBatches(double scalarValue) override
Get the number of cell batches available for processing as a function of the specified scalar value.
int NumberOfCellsPerBucket
Definition: vtkSpanSpace.h:201
vtkCell * GetNextCell(vtkIdType &cellId, vtkIdList *&ptIds, vtkDataArray *cellScalars) override
Return the next cell that may contain scalar value specified to InitTraversal().
void BuildTree() override
Construct the scalar tree from the dataset provided.
int vtkTypeBool
Definition: vtkABI.h:71
int vtkIdType
Definition: vtkType.h:327
#define VTK_INT_MAX
Definition: vtkType.h:156