VTK  9.3.20240328
vtkScalarTree.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
30 #ifndef vtkScalarTree_h
31 #define vtkScalarTree_h
32 
33 #include "vtkCommonExecutionModelModule.h" // For export macro
34 #include "vtkObject.h"
35 
36 VTK_ABI_NAMESPACE_BEGIN
37 class vtkCell;
38 class vtkDataArray;
39 class vtkDataSet;
40 class vtkIdList;
41 class vtkTimeStamp;
42 
43 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkScalarTree : public vtkObject
44 {
45 public:
47 
50  vtkTypeMacro(vtkScalarTree, vtkObject);
51  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
58  virtual void ShallowCopy(vtkScalarTree* stree);
59 
61 
65  virtual void SetDataSet(vtkDataSet*);
66  vtkGetObjectMacro(DataSet, vtkDataSet);
68 
70 
78  virtual void SetScalars(vtkDataArray*);
79  vtkGetObjectMacro(Scalars, vtkDataArray);
81 
86  virtual void BuildTree() = 0;
87 
91  virtual void Initialize() = 0;
92 
99  virtual void InitTraversal(double scalarValue) = 0;
100 
107  virtual vtkCell* GetNextCell(vtkIdType& cellId, vtkIdList*& ptIds, vtkDataArray* cellScalars) = 0;
108 
113  double GetScalarValue() { return this->ScalarValue; }
114 
115  // The following methods supports parallel (threaded) traversal. Basically
116  // batches of cells (which are a portion of the whole dataset) are available for
117  // processing in a parallel For() operation.
118 
124  virtual vtkIdType GetNumberOfCellBatches(double scalarValue) = 0;
125 
131  virtual const vtkIdType* GetCellBatch(vtkIdType batchNum, vtkIdType& numCells) = 0;
132 
133 protected:
135  ~vtkScalarTree() override;
136 
137  vtkDataSet* DataSet; // the dataset over which the scalar tree is built
138  vtkDataArray* Scalars; // the scalars of the DataSet
139  double ScalarValue; // current scalar value for traversal
140 
141  vtkTimeStamp BuildTime; // time at which tree was built
142 
143 private:
144  vtkScalarTree(const vtkScalarTree&) = delete;
145  void operator=(const vtkScalarTree&) = delete;
146 };
147 
148 VTK_ABI_NAMESPACE_END
149 #endif
abstract class to specify cell behavior
Definition: vtkCell.h:130
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:154
abstract class to specify dataset behavior
Definition: vtkDataSet.h:165
list of point or cell ids
Definition: vtkIdList.h:132
a simple class to control print indentation
Definition: vtkIndent.h:108
abstract base class for most VTK objects
Definition: vtkObject.h:161
organize data according to scalar values (used to accelerate contouring operations)
Definition: vtkScalarTree.h:44
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:44
std::map< std::string, DataArray > DataSet
key: variable name, value: DataArray
Definition: VTXTypes.h:28
int vtkIdType
Definition: vtkType.h:315