VTK  9.7.20260802
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
189 vtkSetClampMacro(ClassifierTolerance, double, 0.0, VTK_DOUBLE_MAX);
190 vtkGetMacro(ClassifierTolerance, double);
192
194 vtkGetObjectMacro(ClassifierCellTypes, vtkTypeUInt32Array);
195
197 vtkGetObjectMacro(ClassifierCellOffsets, vtkTypeUInt64Array);
198
200 vtkGetObjectMacro(ClassifierPointIDs, vtkTypeUInt64Array);
201
203 vtkGetObjectMacro(ClassifierCellIndices, vtkTypeUInt64Array);
204
207
209 vtkGetObjectMacro(InterpolatedValues, vtkDataArray);
210
213
216
222 void InterpolateCellParameters(vtkTypeUInt32Array* cellTypes, vtkTypeUInt64Array* cellOffsets,
223 vtkTypeUInt64Array* cellIndices, vtkDataArray* pointParameters);
224
227
229 bool Initialize() override;
231 void StartPass() override;
233 bool IsAnotherPassRequired() override;
235 bool Finalize() override;
236
237 // Return a point locator that can be used to find input points quickly.
238 // vtkStaticPointLocator* GetLocator();
239 vtkGetObjectMacro(Locator, vtkStaticPointLocator);
240
244
245protected:
248
251 vtkSetObjectMacro(InputPoints, vtkDataArray);
252
254 vtkSetObjectMacro(ClassifierCellTypes, vtkTypeUInt32Array);
255
257 vtkSetObjectMacro(ClassifierCellOffsets, vtkTypeUInt64Array);
258
260 vtkSetObjectMacro(ClassifierPointIDs, vtkTypeUInt64Array);
261
263 vtkSetObjectMacro(ClassifierCellIndices, vtkTypeUInt64Array);
264
267
269 vtkSetObjectMacro(InterpolatedValues, vtkDataArray);
270
274
278 vtkTypeUInt32Array* ClassifierCellTypes{ nullptr };
279 vtkTypeUInt64Array* ClassifierCellOffsets{ nullptr };
280 vtkTypeUInt64Array* ClassifierPointIDs{ nullptr };
281 vtkTypeUInt64Array* ClassifierCellIndices{ nullptr };
284
286
288 double ClassifierTolerance{ 0.0 };
294 std::unordered_map<vtkStringToken, AllocationsByCellType> Allocations;
295
296private:
298 void operator=(const vtkCellGridEvaluator&) = delete;
299};
300
301VTK_ABI_NAMESPACE_END
302#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.
double ClassifierTolerance
Parametric-space tolerance for accepting points near the reference-element boundary.
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
#define VTK_DOUBLE_MAX
Definition vtkType.h:202