VTK  9.3.20240329
vtkSpanSpace.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
30 #ifndef vtkSpanSpace_h
31 #define vtkSpanSpace_h
32 
33 #include "vtkCommonExecutionModelModule.h" // For export macro
34 #include "vtkScalarTree.h"
35 
36 VTK_ABI_NAMESPACE_BEGIN
37 class vtkSpanSpace;
38 struct vtkInternalSpanSpace;
39 
40 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkSpanSpace : public vtkScalarTree
41 {
42 public:
47  static vtkSpanSpace* New();
48 
50 
53  vtkTypeMacro(vtkSpanSpace, vtkScalarTree);
54  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
61  void ShallowCopy(vtkScalarTree* stree) override;
62 
63  //----------------------------------------------------------------------
64  // The following methods are specific to the creation and configuration of
65  // vtkSpanSpace.
66 
68 
76  vtkSetVector2Macro(ScalarRange, double);
77  vtkGetVectorMacro(ScalarRange, double, 2);
79 
81 
85  vtkSetMacro(ComputeScalarRange, vtkTypeBool);
86  vtkGetMacro(ComputeScalarRange, vtkTypeBool);
87  vtkBooleanMacro(ComputeScalarRange, vtkTypeBool);
89 
91 
99  vtkSetClampMacro(Resolution, vtkIdType, 1, 10000);
100  vtkGetMacro(Resolution, vtkIdType);
102 
104 
108  vtkSetMacro(ComputeResolution, vtkTypeBool);
109  vtkGetMacro(ComputeResolution, vtkTypeBool);
110  vtkBooleanMacro(ComputeResolution, vtkTypeBool);
112 
114 
118  vtkSetClampMacro(NumberOfCellsPerBucket, int, 1, VTK_INT_MAX);
119  vtkGetMacro(NumberOfCellsPerBucket, int);
121 
122  //----------------------------------------------------------------------
123  // The following methods satisfy the vtkScalarTree abstract API.
124 
129  void Initialize() override;
130 
135  void BuildTree() override;
136 
144  void InitTraversal(double scalarValue) override;
145 
152  vtkCell* GetNextCell(vtkIdType& cellId, vtkIdList*& ptIds, vtkDataArray* cellScalars) override;
153 
154  // The following methods supports parallel (threaded) traversal. Basically
155  // batches of cells (which are a portion of the whole dataset) are available for
156  // processing in a parallel For() operation.
157 
163  vtkIdType GetNumberOfCellBatches(double scalarValue) override;
164 
170  const vtkIdType* GetCellBatch(vtkIdType batchNum, vtkIdType& numCells) override;
171 
173 
177  vtkSetClampMacro(BatchSize, vtkIdType, 100, VTK_INT_MAX);
178  vtkGetMacro(BatchSize, vtkIdType);
180 
181 protected:
183  ~vtkSpanSpace() override;
184 
185  double ScalarRange[2];
190  vtkInternalSpanSpace* SpanSpace;
192 
193 private:
194  // Internal variables supporting span space traversal
195  vtkIdType RMin[2]; // span space lower left corner
196  vtkIdType RMax[2]; // span space upper right corner
197 
198  // This supports serial traversal via GetNextCell()
199  vtkIdType CurrentRow; // the span space row currently being processed
200  vtkIdType* CurrentSpan; // pointer to current span row
201  vtkIdType CurrentIdx; // position into the current span row
202  vtkIdType CurrentNumCells; // number of cells on the current span row
203 
204  vtkSpanSpace(const vtkSpanSpace&) = delete;
205  void operator=(const vtkSpanSpace&) = delete;
206 };
207 
208 VTK_ABI_NAMESPACE_END
209 #endif
abstract class to specify cell behavior
Definition: vtkCell.h:130
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:155
list of point or cell ids
Definition: vtkIdList.h:133
a simple class to control print indentation
Definition: vtkIndent.h:108
organize data according to scalar values (used to accelerate contouring operations)
Definition: vtkScalarTree.h:44
organize data according to scalar span space
Definition: vtkSpanSpace.h:41
static vtkSpanSpace * New()
Instantiate a scalar tree with default resolution of 100 and automatic scalar range computation.
vtkTypeBool ComputeScalarRange
Definition: vtkSpanSpace.h:186
vtkIdType Resolution
Definition: vtkSpanSpace.h:187
vtkIdType BatchSize
Definition: vtkSpanSpace.h:191
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:190
vtkTypeBool ComputeResolution
Definition: vtkSpanSpace.h:188
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:189
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:64
int vtkIdType
Definition: vtkType.h:315
#define VTK_INT_MAX
Definition: vtkType.h:144