VTK  9.5.20251215
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
37
38#ifndef vtkSimpleScalarTree_h
39#define vtkSimpleScalarTree_h
40
41#include "vtkCommonExecutionModelModule.h" // For export macro
42#include "vtkScalarTree.h"
43
44VTK_ABI_NAMESPACE_BEGIN
45class vtkScalarNode;
47
48class VTKCOMMONEXECUTIONMODEL_EXPORT vtkSimpleScalarTree : public vtkScalarTree
49{
50public:
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
141protected:
144
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
152private:
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
164 void operator=(const vtkSimpleScalarTree&) = delete;
165};
166
167VTK_ABI_NAMESPACE_END
168#endif
abstract class to specify cell behavior
Definition vtkCell.h:129
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)
vtkIdType GetNumberOfCellBatches(double scalarValue) override
Get the number of cell batches available for processing as a function of the specified scalar value.
~vtkSimpleScalarTree() override
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.
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.
static vtkSimpleScalarTree * New()
Instantiate scalar tree with maximum level of 20 and branching factor of three.
vtkCell * GetNextCell(vtkIdType &cellId, vtkIdList *&ptIds, vtkDataArray *cellScalars) override
Return the next cell that may contain scalar value specified to initialize traversal.
void InitTraversal(double scalarValue) override
Begin to traverse the cells based on a scalar value.
void Initialize() override
Initialize locator.
#define vtkDataArray
int vtkIdType
Definition vtkType.h:368
#define VTK_INT_MAX
Definition vtkType.h:197