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 =========================================================================*/
50 #ifndef vtkSimpleScalarTree_h
51 #define vtkSimpleScalarTree_h
52 
53 #include "vtkCommonExecutionModelModule.h" // For export macro
54 #include "vtkScalarTree.h"
55 
56 class vtkScalarNode;
57 
58 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkSimpleScalarTree : public vtkScalarTree
59 {
60 public:
65  static vtkSimpleScalarTree *New();
66 
68 
72  void PrintSelf(ostream& os, vtkIndent indent) override;
74 
76 
82  vtkSetClampMacro(BranchingFactor,int,2,VTK_INT_MAX);
83  vtkGetMacro(BranchingFactor,int);
85 
87 
91  vtkGetMacro(Level,int);
93 
95 
98  vtkSetClampMacro(MaxLevel,int,1,VTK_INT_MAX);
99  vtkGetMacro(MaxLevel,int);
101 
106  void BuildTree() override;
107 
111  void Initialize() override;
112 
117  void InitTraversal(double scalarValue) override;
118 
125  vtkCell *GetNextCell(vtkIdType &cellId, vtkIdList* &ptIds,
126  vtkDataArray *cellScalars) override;
127 
128  // The following methods supports parallel (threaded)
129  // applications. Basically batches of cells (which represent a
130  // portion of the whole dataset) are available for processing in a
131  // parallel For() operation.
132 
142 
148  const vtkIdType* GetCellBatch(vtkIdType batchNum,
149  vtkIdType& numCells) override;
150 
151 protected:
153  ~vtkSimpleScalarTree() override;
154 
155  int MaxLevel;
156  int Level;
157  int BranchingFactor; //number of children per node
158  vtkScalarNode *Tree; //pointerless scalar range tree
159  int TreeSize; //allocated size of tree
160  vtkIdType LeafOffset; //offset to leaf nodes of tree
161 
162 private:
163  vtkIdType NumCells; //the number of cells in this dataset
164  vtkIdType TreeIndex; //traversal location within tree
165  int ChildNumber; //current child in traversal
166  vtkIdType CellId; //current cell id being examined
167  int FindStartLeaf(vtkIdType index, int level);
168  int FindNextLeaf(vtkIdType index,int level);
169 
170  vtkIdType *CandidateCells; //to support parallel computing
171  vtkIdType NumCandidates;
172 
173 private:
174  vtkSimpleScalarTree(const vtkSimpleScalarTree&) = delete;
175  void operator=(const vtkSimpleScalarTree&) = delete;
176 };
177 
178 #endif
#define VTK_INT_MAX
Definition: vtkType.h:159
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int vtkIdType
Definition: vtkType.h:347
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:59
a simple class to control print indentation
Definition: vtkIndent.h:39
list of point or cell ids
Definition: vtkIdList.h:36
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
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) ...