VTK  9.0.1
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 =========================================================================*/
47 #ifndef vtkSimpleScalarTree_h
48 #define vtkSimpleScalarTree_h
49 
50 #include "vtkCommonExecutionModelModule.h" // For export macro
51 #include "vtkScalarTree.h"
52 
53 class vtkScalarNode;
55 
56 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkSimpleScalarTree : public vtkScalarTree
57 {
58 public:
63  static vtkSimpleScalarTree* New();
64 
66 
70  void PrintSelf(ostream& os, vtkIndent indent) override;
72 
77  void ShallowCopy(vtkScalarTree* stree) override;
78 
80 
86  vtkSetClampMacro(BranchingFactor, int, 2, VTK_INT_MAX);
87  vtkGetMacro(BranchingFactor, int);
89 
91 
95  vtkGetMacro(Level, int);
97 
99 
102  vtkSetClampMacro(MaxLevel, int, 1, VTK_INT_MAX);
103  vtkGetMacro(MaxLevel, int);
105 
110  void BuildTree() override;
111 
115  void Initialize() override;
116 
121  void InitTraversal(double scalarValue) override;
122 
129  vtkCell* GetNextCell(vtkIdType& cellId, vtkIdList*& ptIds, vtkDataArray* cellScalars) override;
130 
131  // The following methods supports parallel (threaded) traversal. Basically
132  // batches of cells (which are a portion of the whole dataset) are available for
133  // processing in a parallel For() operation.
134 
140  vtkIdType GetNumberOfCellBatches(double scalarValue) override;
141 
147  const vtkIdType* GetCellBatch(vtkIdType batchNum, vtkIdType& numCells) override;
148 
149 protected:
151  ~vtkSimpleScalarTree() override;
152 
153  int MaxLevel;
154  int Level;
155  int BranchingFactor; // number of children per node
156  vtkScalarNode* Tree; // pointerless scalar range tree
157  int TreeSize; // allocated size of tree
158  vtkIdType LeafOffset; // offset to leaf nodes of tree
159 
160 private:
161  vtkIdType NumCells; // the number of cells in this dataset
162  vtkIdType TreeIndex; // traversal location within tree
163  int ChildNumber; // current child in traversal
164  vtkIdType CellId; // current cell id being examined
165  int FindStartLeaf(vtkIdType index, int level);
166  int FindNextLeaf(vtkIdType index, int level);
167 
168  vtkIdType* CandidateCells; // to support parallel computing
169  vtkIdType NumCandidates;
170 
171 private:
172  vtkSimpleScalarTree(const vtkSimpleScalarTree&) = delete;
173  void operator=(const vtkSimpleScalarTree&) = delete;
174 };
175 
176 #endif
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:155
vtkScalarTree::GetNextCell
virtual vtkCell * GetNextCell(vtkIdType &cellId, vtkIdList *&ptIds, vtkDataArray *cellScalars)=0
Return the next cell that may contain scalar value specified to InitTraversal() (serial traversal).
vtkSimpleScalarTree::LeafOffset
vtkIdType LeafOffset
Definition: vtkSimpleScalarTree.h:158
vtkScalarTree::GetCellBatch
virtual const vtkIdType * GetCellBatch(vtkIdType batchNum, vtkIdType &numCells)=0
Return the array of cell ids in the specified batch.
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkScalarTree.h
vtkScalarTree::GetNumberOfCellBatches
virtual vtkIdType GetNumberOfCellBatches(double scalarValue)=0
Get the number of cell batches available for processing as a function of the specified scalar value.
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
vtkX3D::level
@ level
Definition: vtkX3D.h:401
vtkScalarTree::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkScalarTree::InitTraversal
virtual void InitTraversal(double scalarValue)=0
Begin to traverse the cells based on a scalar value (serial traversal).
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:56
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkScalarTree::ShallowCopy
virtual void ShallowCopy(vtkScalarTree *stree)
This method is used to copy data members when cloning an instance of the class.
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:30
vtkSimpleScalarTree::Level
int Level
Definition: vtkSimpleScalarTree.h:154
vtkScalarTree::Initialize
virtual void Initialize()=0
Initialize locator.
vtkSimpleScalarTree::TreeSize
int TreeSize
Definition: vtkSimpleScalarTree.h:157
vtkSimpleScalarTree
organize data according to scalar values (used to accelerate contouring operations)
Definition: vtkSimpleScalarTree.h:56
vtkScalarTree::BuildTree
virtual void BuildTree()=0
Construct the scalar tree from the dataset provided.
vtkSimpleScalarTree::BranchingFactor
int BranchingFactor
Definition: vtkSimpleScalarTree.h:155
vtkSimpleScalarTree::MaxLevel
int MaxLevel
Definition: vtkSimpleScalarTree.h:153
vtkScalarTree
organize data according to scalar values (used to accelerate contouring operations)
Definition: vtkScalarTree.h:54
vtkX3D::index
@ index
Definition: vtkX3D.h:252
vtkSimpleScalarTree::Tree
vtkScalarNode * Tree
Definition: vtkSimpleScalarTree.h:156