VTK  9.4.20241222
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
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 <set>
114#include <unordered_map>
115
116VTK_ABI_NAMESPACE_BEGIN
117
119class vtkPointSet;
120
121class VTKCOMMONDATAMODEL_EXPORT vtkCellGridEvaluator : public vtkCellGridQuery
122{
123public:
126 void PrintSelf(ostream& os, vtkIndent indent) override;
127
130 {
134 Interpolate
135 };
136
138 struct VTKCOMMONDATAMODEL_EXPORT AllocationsByCellType
139 {
140 std::map<vtkIdType, std::set<vtkIdType>> InputPoints;
141 vtkIdType Offset{ 0 };
142
144 };
145
149 vtkSetObjectMacro(CellAttribute, vtkCellAttribute);
150 vtkGetObjectMacro(CellAttribute, vtkCellAttribute);
151
154 vtkGetObjectMacro(InputPoints, vtkDataArray);
155
157 vtkGetObjectMacro(ClassifierCellTypes, vtkTypeUInt32Array);
158
160 vtkGetObjectMacro(ClassifierCellOffsets, vtkTypeUInt64Array);
161
163 vtkGetObjectMacro(ClassifierPointIDs, vtkTypeUInt64Array);
164
166 vtkGetObjectMacro(ClassifierCellIndices, vtkTypeUInt64Array);
167
169 vtkGetObjectMacro(ClassifierPointParameters, vtkDataArray);
170
172 vtkGetObjectMacro(InterpolatedValues, vtkDataArray);
173
176
179
185 void InterpolateCellParameters(vtkTypeUInt32Array* cellTypes, vtkTypeUInt64Array* cellOffsets,
186 vtkTypeUInt64Array* cellIndices, vtkDataArray* pointParameters);
187
190
192 bool Initialize() override;
194 void StartPass() override;
196 bool IsAnotherPassRequired() override;
198 bool Finalize() override;
199
200 // Return a point locator that can be used to find input points quickly.
201 // vtkStaticPointLocator* GetLocator();
202 vtkGetObjectMacro(Locator, vtkStaticPointLocator);
203
207
208protected:
211
214 vtkSetObjectMacro(InputPoints, vtkDataArray);
215
217 vtkSetObjectMacro(ClassifierCellTypes, vtkTypeUInt32Array);
218
220 vtkSetObjectMacro(ClassifierCellOffsets, vtkTypeUInt64Array);
221
223 vtkSetObjectMacro(ClassifierPointIDs, vtkTypeUInt64Array);
224
226 vtkSetObjectMacro(ClassifierCellIndices, vtkTypeUInt64Array);
227
229 vtkSetObjectMacro(ClassifierPointParameters, vtkDataArray);
230
232 vtkSetObjectMacro(InterpolatedValues, vtkDataArray);
233
237
238 vtkCellGrid* CellGrid{ nullptr };
239 vtkCellAttribute* CellAttribute{ nullptr };
240 vtkDataArray* InputPoints{ nullptr };
241 vtkTypeUInt32Array* ClassifierCellTypes{ nullptr };
242 vtkTypeUInt64Array* ClassifierCellOffsets{ nullptr };
243 vtkTypeUInt64Array* ClassifierPointIDs{ nullptr };
244 vtkTypeUInt64Array* ClassifierCellIndices{ nullptr };
245 vtkDataArray* ClassifierPointParameters{ nullptr };
246 vtkDataArray* InterpolatedValues{ nullptr };
247
249
251 Phases PhasesToPerform{ Phases::None };
253 vtkIdType NumberOfOutputPoints{ 0 };
255 std::unordered_map<vtkStringToken, AllocationsByCellType> Allocations;
256
257private:
259 void operator=(const vtkCellGridEvaluator&) = delete;
260};
261
262VTK_ABI_NAMESPACE_END
263#endif // vtkCellGridEvaluator_h
A function defined over the physical domain of a vtkCellGrid.
Evaluate a field (vtkCellAttribute) at some points inside cells.
bool Finalize() override
Invoked during evaluation after all cell-grid responders are run.
~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()
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()
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()
bool IsAnotherPassRequired() override
Invoked at the end of each pass.
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.
Perform an operation on cells in a vtkCellMetadata instance.
Visualization data composed of cells of arbitrary type.
Definition vtkCellGrid.h:49
abstract superclass for arrays of numeric data
a simple class to control print indentation
Definition vtkIndent.h:108
Allocate and hold a VTK object.
Definition vtkNew.h:167
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.
Hold per-type input point assignment and an offset for output arrays.
std::map< vtkIdType, std::set< vtkIdType > > InputPoints
int vtkIdType
Definition vtkType.h:315