VTK
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;
54 
55 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkSimpleScalarTree : public vtkScalarTree
56 {
57 public:
62  static vtkSimpleScalarTree *New();
63 
65 
69  void PrintSelf(ostream& os, vtkIndent indent) override;
71 
73 
79  vtkSetClampMacro(BranchingFactor,int,2,VTK_INT_MAX);
80  vtkGetMacro(BranchingFactor,int);
82 
84 
88  vtkGetMacro(Level,int);
90 
92 
95  vtkSetClampMacro(MaxLevel,int,1,VTK_INT_MAX);
96  vtkGetMacro(MaxLevel,int);
98 
103  void BuildTree() override;
104 
108  void Initialize() override;
109 
114  void InitTraversal(double scalarValue) override;
115 
122  vtkCell *GetNextCell(vtkIdType &cellId, vtkIdList* &ptIds,
123  vtkDataArray *cellScalars) override;
124 
125  // The following methods supports parallel (threaded)
126  // applications. Basically batches of cells (which represent a
127  // portion of the whole dataset) are available for processing in a
128  // parallel For() operation.
129 
139 
145  const vtkIdType* GetCellBatch(vtkIdType batchNum,
146  vtkIdType& numCells) override;
147 
148 protected:
150  ~vtkSimpleScalarTree() override;
151 
152  int MaxLevel;
153  int Level;
154  int BranchingFactor; //number of children per node
155  vtkScalarNode *Tree; //pointerless scalar range tree
156  int TreeSize; //allocated size of tree
157  vtkIdType LeafOffset; //offset to leaf nodes of tree
158 
159 private:
160  vtkIdType NumCells; //the number of cells in this dataset
161  vtkIdType TreeIndex; //traversal location within tree
162  int ChildNumber; //current child in traversal
163  vtkIdType CellId; //current cell id being examined
164  int FindStartLeaf(vtkIdType index, int level);
165  int FindNextLeaf(vtkIdType index,int level);
166 
167  vtkIdType *CandidateCells; //to support parallel computing
168  vtkIdType NumCandidates;
169 
170 private:
171  vtkSimpleScalarTree(const vtkSimpleScalarTree&) = delete;
172  void operator=(const vtkSimpleScalarTree&) = delete;
173 };
174 
175 #endif
#define VTK_INT_MAX
Definition: vtkType.h:157
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int vtkIdType
Definition: vtkType.h:345
virtual void InitTraversal(double scalarValue)=0
Begin to traverse the cells based on a scalar value.
abstract class to specify cell behavior
Definition: vtkCell.h:56
a simple class to control print indentation
Definition: vtkIndent.h:33
list of point or cell ids
Definition: vtkIdList.h:30
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
virtual vtkCell * GetNextCell(vtkIdType &cellId, vtkIdList *&ptIds, vtkDataArray *cellScalars)=0
Return the next cell that may contain scalar value specified to initialize traversal.
organize data according to scalar values (used to accelerate contouring operations) ...
Definition: vtkScalarTree.h:54
virtual const vtkIdType * GetCellBatch(vtkIdType batchNum, vtkIdType &numCells)=0
Return the array of cell ids in the specified batch.
virtual void Initialize()=0
Initialize locator.
virtual vtkIdType GetNumberOfCellBatches()=0
Get the number of cell batches available for processing.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual void BuildTree()=0
Construct the scalar tree from the dataset provided.
organize data according to scalar values (used to accelerate contouring operations) ...