VTK  9.2.20230528
vtkScalarTree.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkScalarTree.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 =========================================================================*/
42 #ifndef vtkScalarTree_h
43 #define vtkScalarTree_h
44 
45 #include "vtkCommonExecutionModelModule.h" // For export macro
46 #include "vtkObject.h"
47 
48 VTK_ABI_NAMESPACE_BEGIN
49 class vtkCell;
50 class vtkDataArray;
51 class vtkDataSet;
52 class vtkIdList;
53 class vtkTimeStamp;
54 
55 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkScalarTree : public vtkObject
56 {
57 public:
59 
62  vtkTypeMacro(vtkScalarTree, vtkObject);
63  void PrintSelf(ostream& os, vtkIndent indent) override;
65 
70  virtual void ShallowCopy(vtkScalarTree* stree);
71 
73 
77  virtual void SetDataSet(vtkDataSet*);
78  vtkGetObjectMacro(DataSet, vtkDataSet);
80 
82 
90  virtual void SetScalars(vtkDataArray*);
91  vtkGetObjectMacro(Scalars, vtkDataArray);
93 
98  virtual void BuildTree() = 0;
99 
103  virtual void Initialize() = 0;
104 
111  virtual void InitTraversal(double scalarValue) = 0;
112 
119  virtual vtkCell* GetNextCell(vtkIdType& cellId, vtkIdList*& ptIds, vtkDataArray* cellScalars) = 0;
120 
125  double GetScalarValue() { return this->ScalarValue; }
126 
127  // The following methods supports parallel (threaded) traversal. Basically
128  // batches of cells (which are a portion of the whole dataset) are available for
129  // processing in a parallel For() operation.
130 
136  virtual vtkIdType GetNumberOfCellBatches(double scalarValue) = 0;
137 
143  virtual const vtkIdType* GetCellBatch(vtkIdType batchNum, vtkIdType& numCells) = 0;
144 
145 protected:
147  ~vtkScalarTree() override;
148 
149  vtkDataSet* DataSet; // the dataset over which the scalar tree is built
150  vtkDataArray* Scalars; // the scalars of the DataSet
151  double ScalarValue; // current scalar value for traversal
152 
153  vtkTimeStamp BuildTime; // time at which tree was built
154 
155 private:
156  vtkScalarTree(const vtkScalarTree&) = delete;
157  void operator=(const vtkScalarTree&) = delete;
158 };
159 
160 VTK_ABI_NAMESPACE_END
161 #endif
abstract class to specify cell behavior
Definition: vtkCell.h:151
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:166
abstract class to specify dataset behavior
Definition: vtkDataSet.h:174
list of point or cell ids
Definition: vtkIdList.h:144
a simple class to control print indentation
Definition: vtkIndent.h:120
abstract base class for most VTK objects
Definition: vtkObject.h:83
organize data according to scalar values (used to accelerate contouring operations)
Definition: vtkScalarTree.h:56
virtual vtkCell * GetNextCell(vtkIdType &cellId, vtkIdList *&ptIds, vtkDataArray *cellScalars)=0
Return the next cell that may contain scalar value specified to InitTraversal() (serial traversal).
vtkTimeStamp BuildTime
vtkDataSet * DataSet
double ScalarValue
virtual void SetScalars(vtkDataArray *)
Build the tree from the points/cells and scalars defining the dataset and scalars provided.
virtual vtkIdType GetNumberOfCellBatches(double scalarValue)=0
Get the number of cell batches available for processing as a function of the specified scalar value.
virtual void Initialize()=0
Initialize locator.
virtual void BuildTree()=0
Construct the scalar tree from the dataset provided.
double GetScalarValue()
Return the current scalar value over which tree traversal is proceeding.
virtual void SetDataSet(vtkDataSet *)
Build the tree from the points/cells and scalars defining this dataset.
~vtkScalarTree() override
virtual void InitTraversal(double scalarValue)=0
Begin to traverse the cells based on a scalar value (serial traversal).
vtkDataArray * Scalars
virtual const vtkIdType * GetCellBatch(vtkIdType batchNum, vtkIdType &numCells)=0
Return the array of cell ids in the specified batch.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard type related macros and PrintSelf() method.
virtual void ShallowCopy(vtkScalarTree *stree)
This method is used to copy data members when cloning an instance of the class.
record modification and/or execution time
Definition: vtkTimeStamp.h:56
std::map< std::string, DataArray > DataSet
key: variable name, value: DataArray
Definition: VTXTypes.h:40
int vtkIdType
Definition: vtkType.h:327