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:
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:
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
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 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
Methods invoked by print to print information about the object including superclasses.
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:338
#define VTK_INT_MAX
Definition: vtkType.h:155