VTK  9.0.2
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 =========================================================================*/
39 #ifndef vtkSpanSpace_h
40 #define vtkSpanSpace_h
41 
42 #include "vtkCommonExecutionModelModule.h" // For export macro
43 #include "vtkScalarTree.h"
44 
45 class vtkSpanSpace;
46 struct vtkInternalSpanSpace;
47 
48 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkSpanSpace : public vtkScalarTree
49 {
50 public:
55  static vtkSpanSpace* New();
56 
58 
61  vtkTypeMacro(vtkSpanSpace, vtkScalarTree);
62  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
69  void ShallowCopy(vtkScalarTree* stree) override;
70 
71  //----------------------------------------------------------------------
72  // The following methods are specific to the creation and configuration of
73  // vtkSpanSpace.
74 
76 
84  vtkSetVector2Macro(ScalarRange, double);
85  vtkGetVectorMacro(ScalarRange, double, 2);
87 
89 
93  vtkSetMacro(ComputeScalarRange, vtkTypeBool);
94  vtkGetMacro(ComputeScalarRange, vtkTypeBool);
95  vtkBooleanMacro(ComputeScalarRange, vtkTypeBool);
97 
99 
107  vtkSetClampMacro(Resolution, vtkIdType, 1, 10000);
108  vtkGetMacro(Resolution, vtkIdType);
110 
112 
116  vtkSetMacro(ComputeResolution, vtkTypeBool);
117  vtkGetMacro(ComputeResolution, vtkTypeBool);
118  vtkBooleanMacro(ComputeResolution, vtkTypeBool);
120 
122 
126  vtkSetClampMacro(NumberOfCellsPerBucket, int, 1, VTK_INT_MAX);
127  vtkGetMacro(NumberOfCellsPerBucket, int);
129 
130  //----------------------------------------------------------------------
131  // The following methods satisfy the vtkScalarTree abstract API.
132 
137  void Initialize() override;
138 
143  void BuildTree() override;
144 
152  void InitTraversal(double scalarValue) override;
153 
160  vtkCell* GetNextCell(vtkIdType& cellId, vtkIdList*& ptIds, vtkDataArray* cellScalars) override;
161 
162  // The following methods supports parallel (threaded) traversal. Basically
163  // batches of cells (which are a portion of the whole dataset) are available for
164  // processing in a parallel For() operation.
165 
171  vtkIdType GetNumberOfCellBatches(double scalarValue) override;
172 
178  const vtkIdType* GetCellBatch(vtkIdType batchNum, vtkIdType& numCells) override;
179 
181 
185  vtkSetClampMacro(BatchSize, vtkIdType, 100, VTK_INT_MAX);
186  vtkGetMacro(BatchSize, vtkIdType);
188 
189 protected:
191  ~vtkSpanSpace() override;
192 
193  double ScalarRange[2];
198  vtkInternalSpanSpace* SpanSpace;
200 
201 private:
202  // Internal variables supporting span space traversal
203  vtkIdType RMin[2]; // span space lower left corner
204  vtkIdType RMax[2]; // span space upper right corner
205 
206  // This supports serial traversal via GetNextCell()
207  vtkIdType CurrentRow; // the span space row currently being processed
208  vtkIdType* CurrentSpan; // pointer to current span row
209  vtkIdType CurrentIdx; // position into the current span row
210  vtkIdType CurrentNumCells; // number of cells on the current span row
211 
212 private:
213  vtkSpanSpace(const vtkSpanSpace&) = delete;
214  void operator=(const vtkSpanSpace&) = delete;
215 };
216 
217 #endif
abstract class to specify cell behavior
Definition: vtkCell.h:57
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:50
list of point or cell ids
Definition: vtkIdList.h:31
a simple class to control print indentation
Definition: vtkIndent.h:34
organize data according to scalar values (used to accelerate contouring operations)
Definition: vtkScalarTree.h:55
organize data according to scalar span space
Definition: vtkSpanSpace.h:49
static vtkSpanSpace * New()
Instantiate a scalar tree with default resolution of 100 and automatic scalar range computation.
vtkTypeBool ComputeScalarRange
Definition: vtkSpanSpace.h:194
vtkIdType Resolution
Definition: vtkSpanSpace.h:195
vtkIdType BatchSize
Definition: vtkSpanSpace.h:199
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
~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:198
vtkTypeBool ComputeResolution
Definition: vtkSpanSpace.h:196
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:197
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:69
int vtkIdType
Definition: vtkType.h:338
#define VTK_INT_MAX
Definition: vtkType.h:155