VTK  9.3.0
vtkSimpleScalarTree.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
38 #ifndef vtkSimpleScalarTree_h
39 #define vtkSimpleScalarTree_h
40 
41 #include "vtkCommonExecutionModelModule.h" // For export macro
42 #include "vtkScalarTree.h"
43 
44 VTK_ABI_NAMESPACE_BEGIN
45 class vtkScalarNode;
47 
48 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkSimpleScalarTree : public vtkScalarTree
49 {
50 public:
56 
58 
62  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
69  void ShallowCopy(vtkScalarTree* stree) override;
70 
72 
78  vtkSetClampMacro(BranchingFactor, int, 2, VTK_INT_MAX);
79  vtkGetMacro(BranchingFactor, int);
81 
83 
87  vtkGetMacro(Level, int);
89 
91 
94  vtkSetClampMacro(MaxLevel, int, 1, VTK_INT_MAX);
95  vtkGetMacro(MaxLevel, int);
97 
102  void BuildTree() override;
103 
107  void Initialize() override;
108 
113  void InitTraversal(double scalarValue) override;
114 
121  vtkCell* GetNextCell(vtkIdType& cellId, vtkIdList*& ptIds, vtkDataArray* cellScalars) override;
122 
123  // The following methods supports parallel (threaded) traversal. Basically
124  // batches of cells (which are a portion of the whole dataset) are available for
125  // processing in a parallel For() operation.
126 
132  vtkIdType GetNumberOfCellBatches(double scalarValue) override;
133 
139  const vtkIdType* GetCellBatch(vtkIdType batchNum, vtkIdType& numCells) override;
140 
141 protected:
144 
145  int MaxLevel;
146  int Level;
147  int BranchingFactor; // number of children per node
148  vtkScalarNode* Tree; // pointerless scalar range tree
149  int TreeSize; // allocated size of tree
150  vtkIdType LeafOffset; // offset to leaf nodes of tree
151 
152 private:
153  vtkIdType NumCells; // the number of cells in this dataset
154  vtkIdType TreeIndex; // traversal location within tree
155  int ChildNumber; // current child in traversal
156  vtkIdType CellId; // current cell id being examined
157  int FindStartLeaf(vtkIdType index, int level);
158  int FindNextLeaf(vtkIdType index, int level);
159 
160  vtkIdType* CandidateCells; // to support parallel computing
161  vtkIdType NumCandidates;
162 
163  vtkSimpleScalarTree(const vtkSimpleScalarTree&) = delete;
164  void operator=(const vtkSimpleScalarTree&) = delete;
165 };
166 
167 VTK_ABI_NAMESPACE_END
168 #endif
abstract class to specify cell behavior
Definition: vtkCell.h:59
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
list of point or cell ids
Definition: vtkIdList.h:32
a simple class to control print indentation
Definition: vtkIndent.h:38
organize data according to scalar values (used to accelerate contouring operations)
Definition: vtkScalarTree.h:44
organize data according to scalar values (used to accelerate contouring operations)
static vtkSimpleScalarTree * New()
Instantiate scalar tree with maximum level of 20 and branching factor of three.
vtkIdType GetNumberOfCellBatches(double scalarValue) override
Get the number of cell batches available for processing as a function of the specified scalar value.
~vtkSimpleScalarTree() override
vtkCell * GetNextCell(vtkIdType &cellId, vtkIdList *&ptIds, vtkDataArray *cellScalars) override
Return the next cell that may contain scalar value specified to initialize traversal.
void ShallowCopy(vtkScalarTree *stree) override
This method is used to copy data members when cloning an instance of the class.
void BuildTree() override
Construct the scalar tree from the dataset provided.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard type related macros and PrintSelf() method.
const vtkIdType * GetCellBatch(vtkIdType batchNum, vtkIdType &numCells) override
Return the array of cell ids in the specified batch.
void InitTraversal(double scalarValue) override
Begin to traverse the cells based on a scalar value.
void Initialize() override
Initialize locator.
@ level
Definition: vtkX3D.h:395
@ index
Definition: vtkX3D.h:246
int vtkIdType
Definition: vtkType.h:315
#define VTK_INT_MAX
Definition: vtkType.h:144