VTK  9.2.6
vtkSimpleScalarTree.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSimpleScalarTree.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 =========================================================================*/
50 #ifndef vtkSimpleScalarTree_h
51 #define vtkSimpleScalarTree_h
52 
53 #include "vtkCommonExecutionModelModule.h" // For export macro
54 #include "vtkScalarTree.h"
55 
56 class vtkScalarNode;
58 
59 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkSimpleScalarTree : public vtkScalarTree
60 {
61 public:
67 
69 
73  void PrintSelf(ostream& os, vtkIndent indent) override;
75 
80  void ShallowCopy(vtkScalarTree* stree) override;
81 
83 
89  vtkSetClampMacro(BranchingFactor, int, 2, VTK_INT_MAX);
90  vtkGetMacro(BranchingFactor, int);
92 
94 
98  vtkGetMacro(Level, int);
100 
102 
105  vtkSetClampMacro(MaxLevel, int, 1, VTK_INT_MAX);
106  vtkGetMacro(MaxLevel, int);
108 
113  void BuildTree() override;
114 
118  void Initialize() override;
119 
124  void InitTraversal(double scalarValue) override;
125 
132  vtkCell* GetNextCell(vtkIdType& cellId, vtkIdList*& ptIds, vtkDataArray* cellScalars) override;
133 
134  // The following methods supports parallel (threaded) traversal. Basically
135  // batches of cells (which are a portion of the whole dataset) are available for
136  // processing in a parallel For() operation.
137 
143  vtkIdType GetNumberOfCellBatches(double scalarValue) override;
144 
150  const vtkIdType* GetCellBatch(vtkIdType batchNum, vtkIdType& numCells) override;
151 
152 protected:
155 
156  int MaxLevel;
157  int Level;
158  int BranchingFactor; // number of children per node
159  vtkScalarNode* Tree; // pointerless scalar range tree
160  int TreeSize; // allocated size of tree
161  vtkIdType LeafOffset; // offset to leaf nodes of tree
162 
163 private:
164  vtkIdType NumCells; // the number of cells in this dataset
165  vtkIdType TreeIndex; // traversal location within tree
166  int ChildNumber; // current child in traversal
167  vtkIdType CellId; // current cell id being examined
168  int FindStartLeaf(vtkIdType index, int level);
169  int FindNextLeaf(vtkIdType index, int level);
170 
171  vtkIdType* CandidateCells; // to support parallel computing
172  vtkIdType NumCandidates;
173 
174 private:
175  vtkSimpleScalarTree(const vtkSimpleScalarTree&) = delete;
176  void operator=(const vtkSimpleScalarTree&) = delete;
177 };
178 
179 #endif
abstract class to specify cell behavior
Definition: vtkCell.h:150
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:165
list of point or cell ids
Definition: vtkIdList.h:143
a simple class to control print indentation
Definition: vtkIndent.h:119
organize data according to scalar values (used to accelerate contouring operations)
Definition: vtkScalarTree.h:55
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:401
@ index
Definition: vtkX3D.h:252
int vtkIdType
Definition: vtkType.h:332
#define VTK_INT_MAX
Definition: vtkType.h:155