VTK  9.6.20260617
vtkCellGridEvaluator.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
102
103#ifndef vtkCellGridEvaluator_h
104#define vtkCellGridEvaluator_h
105
106#include "vtkCellAttribute.h" // For Attribute ivar.
107#include "vtkCellGridQuery.h"
108#include "vtkNew.h" // For ivars.
109#include "vtkStringToken.h" // For Allocations ivar.
110#include "vtkTypeUInt32Array.h" // For ivars.
111#include "vtkTypeUInt64Array.h" // For ivars.
112
113#include <array>
114#include <unordered_map>
115#include <vector>
116
117VTK_ABI_NAMESPACE_BEGIN
118
120class vtkPointSet;
121
122class VTKCOMMONDATAMODEL_EXPORT vtkCellGridEvaluator : public vtkCellGridQuery
123{
124public:
127 void PrintSelf(ostream& os, vtkIndent indent) override;
128
137
139 struct VTKCOMMONDATAMODEL_EXPORT AllocationsByCellType
140 {
151
155 std::vector<ClassifiedPoint> InputPoints;
158
161 {
162 return static_cast<vtkIdType>(this->InputPoints.size());
163 }
164 };
165
169 vtkSetObjectMacro(CellAttribute, vtkCellAttribute);
170 vtkGetObjectMacro(CellAttribute, vtkCellAttribute);
171
174 vtkGetObjectMacro(InputPoints, vtkDataArray);
175
177 vtkGetObjectMacro(ClassifierCellTypes, vtkTypeUInt32Array);
178
180 vtkGetObjectMacro(ClassifierCellOffsets, vtkTypeUInt64Array);
181
183 vtkGetObjectMacro(ClassifierPointIDs, vtkTypeUInt64Array);
184
186 vtkGetObjectMacro(ClassifierCellIndices, vtkTypeUInt64Array);
187
190
192 vtkGetObjectMacro(InterpolatedValues, vtkDataArray);
193
196
199
205 void InterpolateCellParameters(vtkTypeUInt32Array* cellTypes, vtkTypeUInt64Array* cellOffsets,
206 vtkTypeUInt64Array* cellIndices, vtkDataArray* pointParameters);
207
210
212 bool Initialize() override;
214 void StartPass() override;
216 bool IsAnotherPassRequired() override;
218 bool Finalize() override;
219
220 // Return a point locator that can be used to find input points quickly.
221 // vtkStaticPointLocator* GetLocator();
222 vtkGetObjectMacro(Locator, vtkStaticPointLocator);
223
227
228protected:
231
234 vtkSetObjectMacro(InputPoints, vtkDataArray);
235
237 vtkSetObjectMacro(ClassifierCellTypes, vtkTypeUInt32Array);
238
240 vtkSetObjectMacro(ClassifierCellOffsets, vtkTypeUInt64Array);
241
243 vtkSetObjectMacro(ClassifierPointIDs, vtkTypeUInt64Array);
244
246 vtkSetObjectMacro(ClassifierCellIndices, vtkTypeUInt64Array);
247
250
252 vtkSetObjectMacro(InterpolatedValues, vtkDataArray);
253
257
261 vtkTypeUInt32Array* ClassifierCellTypes{ nullptr };
262 vtkTypeUInt64Array* ClassifierCellOffsets{ nullptr };
263 vtkTypeUInt64Array* ClassifierPointIDs{ nullptr };
264 vtkTypeUInt64Array* ClassifierCellIndices{ nullptr };
267
269
275 std::unordered_map<vtkStringToken, AllocationsByCellType> Allocations;
276
277private:
279 void operator=(const vtkCellGridEvaluator&) = delete;
280};
281
282VTK_ABI_NAMESPACE_END
283#endif // vtkCellGridEvaluator_h
A function defined over the physical domain of a vtkCellGrid.
bool Finalize() override
Invoked during evaluation after all cell-grid responders are run.
vtkIdType NumberOfOutputPoints
The total number of output points (across all cell types).
~vtkCellGridEvaluator() override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void InterpolateCellParameters(vtkTypeUInt32Array *cellTypes, vtkTypeUInt64Array *cellOffsets, vtkTypeUInt64Array *cellIndices, vtkDataArray *pointParameters)
Configure the query to run only the interpolator.
void AllocateClassificationOutput()
vtkTypeUInt32Array * ClassifierCellTypes
vtkCellAttribute * CellAttribute
std::unordered_map< vtkStringToken, AllocationsByCellType > Allocations
Internal state used during classification to compute the size of the output arrays.
vtkNew< vtkStaticPointLocator > Locator
void InterpolatePoints(vtkDataArray *points)
Configure the query to run the classifier followed by the interpolator.
static vtkCellGridEvaluator * New()
vtkTypeUInt64Array * ClassifierCellIndices
Phases
Indicate which phases of the query to perform.
void StartPass() override
Invoked at the start of each pass.
vtkGetEnumMacro(PhasesToPerform, vtkCellGridEvaluator::Phases)
Return what work the query has been configured to do.
void AllocateInterpolationOutput()
Phases PhasesToPerform
Which of the phases are the arrays above configured to perform?
bool IsAnotherPassRequired() override
Invoked at the end of each pass.
vtkTypeUInt64Array * ClassifierCellOffsets
AllocationsByCellType & GetAllocationsForCellType(vtkStringToken cellType)
Return a reference to a cellType's allocated input points for responders to fill out.
bool Initialize() override
Invoked during evaluation before any cell-grid responders are run.
void ClassifyPoints(vtkDataArray *points)
Configure the query to run the classifier but not the interpolator.
vtkTypeUInt64Array * ClassifierPointIDs
vtkDataArray * InterpolatedValues
vtkDataArray * ClassifierPointParameters
vtkCellGridQuery()=default
Visualization data composed of cells of arbitrary type.
Definition vtkCellGrid.h:49
a simple class to control print indentation
Definition vtkIndent.h:108
Allocate and hold a VTK object.
Definition vtkNew.h:168
concrete class for storing a set of points
Definition vtkPointSet.h:98
quickly locate points in 3-space
Represent a string by its integer hash.
The result of classifying a single probe point: the index of the input point, the cell that contains ...
Hold per-type input point assignment and an offset for output arrays.
vtkIdType GetNumberOfOutputPoints() const
Return the number of classified points for this cell type.
vtkIdType Offset
Offset into the global output arrays where this cell type's results begin.
std::vector< ClassifiedPoint > InputPoints
Flat list of classified probe points, populated by ClassifyPoints.
#define vtkDataArray
int vtkIdType
Definition vtkType.h:363