VTK  9.6.20260530
vtkAbstractInterpolatedVelocityField.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
62
63#ifndef vtkAbstractInterpolatedVelocityField_h
64#define vtkAbstractInterpolatedVelocityField_h
65
66#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_7_0
67#include "vtkFiltersFlowPathsModule.h" // For export macro
68#include "vtkFunctionSet.h"
69#include "vtkNew.h" // for vtkNew
70#include "vtkSmartPointer.h" // for vtkSmartPointer
71
72#include <vector> // for weights
73
74VTK_ABI_NAMESPACE_BEGIN
77class vtkDataObject;
78class vtkDataSet;
79class vtkDataArray;
80class vtkIdList;
81class vtkPointData;
82class vtkGenericCell;
84
85class VTKFILTERSFLOWPATHS_EXPORT vtkAbstractInterpolatedVelocityField : public vtkFunctionSet
86{
87public:
89
93 void PrintSelf(ostream& os, vtkIndent indent) override;
95
96 // Keep track of how the interpolated velocity field is
97 // initialized. Currently, all datasets that compose the velocity field are
98 // initialized (meaning that supporting structures like locators are
99 // built).
106
108
122 virtual void Initialize(
123 vtkCompositeDataSet* compDS, int initCellLocator = INITIALIZE_ALL_DATASETS);
124 vtkGetMacro(InitializationState, int);
126
128
132 vtkSetMacro(Caching, bool);
133 vtkGetMacro(Caching, bool);
135
137
141 vtkGetMacro(CacheHit, int);
142 vtkGetMacro(CacheMiss, int);
144
145 vtkGetObjectMacro(LastDataSet, vtkDataSet);
146
148
151 vtkGetMacro(LastCellId, vtkIdType);
152 virtual void SetLastCellId(vtkIdType c) { this->LastCellId = c; }
154
158 virtual void SetLastCellId(vtkIdType c, int dataindex) = 0;
159
161
165 vtkGetStringMacro(VectorsSelection);
166 vtkGetMacro(VectorsType, int);
168
173 void SelectVectors(int fieldAssociation, const char* fieldName);
174
176
193 vtkSetMacro(NormalizeVector, bool);
194 vtkGetMacro(NormalizeVector, bool);
196
198
205 vtkSetMacro(ForceSurfaceTangentVector, bool);
206 vtkGetMacro(ForceSurfaceTangentVector, bool);
208
210
214 vtkSetMacro(SurfaceDataset, bool);
215 vtkGetMacro(SurfaceDataset, bool);
217
225
230 int FunctionValues(double* x, double* f) override = 0;
231
235 void ClearLastCellId() { this->LastCellId = -1; }
236
238
242 int GetLastWeights(double* w);
243 int GetLastLocalCoordinates(double pcoords[3]);
245
247
253 VTK_DEPRECATED_IN_9_7_0("Use SetCellLocator() instead.")
256 "GetFindCellStrategy() always returns nullptr. Use GetCellLocator() instead.")
257 virtual vtkFindCellStrategy* GetFindCellStrategy() { return nullptr; }
259
261
269
270protected:
273
274 static const double TOLERANCE_SCALE;
275 static const double SURFACE_TOLERANCE_SCALE;
276
285 std::vector<double> Weights;
286 double LastPCoords[3];
293
299
300 // This is used to keep track of the cellLocator and vector array
301 // associated with each dataset forming the velocity field. Note that the
302 // cellLocator can be null, this means the FindCell is invoked
303 // using the dataset's FindCell() method.
315
316
321 std::vector<vtkDataSetInformation> DataSetsInfo;
322 std::vector<vtkDataSetInformation>::iterator GetDataSetInfo(vtkDataSet* dataset);
324
326
329 vtkSetStringMacro(VectorsSelection);
331
343 virtual int FunctionValues(vtkDataSet* ds, double* x, double* f);
344
351 virtual bool FindAndUpdateCell(const vtkDataSetInformation& dsInfo, double* x);
352
355
361 void FastCompute(vtkDataArray* vectors, double f[3]);
367 {
368 return (this->LastCellId != -1) ? this->CurrentCell.Get() : nullptr;
369 }
370
371
373
379 virtual int SelfInitialize() { return 0; }
383
384private:
386 void operator=(const vtkAbstractInterpolatedVelocityField&) = delete;
387};
388
389VTK_ABI_NAMESPACE_END
390#endif
an abstract base class for locators which find cells
std::vector< vtkDataSetInformation >::iterator GetDataSetInfo(vtkDataSet *dataset)
Define a Cell Locator to perform FindCell(), keep track of them (and other cached information) associ...
int FunctionValues(double *x, double *f) override=0
Evaluate the velocity field f at point (x, y, z).
virtual int FunctionValues(vtkDataSet *ds, double *x, double *f)
Evaluate the velocity field f at point (x, y, z) in a specified dataset by invoking vtkDataSet::FindC...
virtual int SelfInitialize()
These methods pertain to initializing the vector field by subclasses (which may have special initiali...
virtual void SetCellLocator(vtkAbstractCellLocator *)
Set / get the cell locator used to perform the FindCell() operation.
virtual void Initialize(vtkCompositeDataSet *compDS, int initCellLocator=INITIALIZE_ALL_DATASETS)
The Initialize() method is used to build and cache supporting structures (such as locators) which are...
int GetLastWeights(double *w)
Get the interpolation weights cached from last evaluation.
int GetLastLocalCoordinates(double pcoords[3])
Get the interpolation weights cached from last evaluation.
void AddToDataSetsInfo(vtkDataSet *, vtkAbstractCellLocator *, vtkDataArray *vectors)
These methods pertain to initializing the vector field by subclasses (which may have special initiali...
virtual bool FindAndUpdateCell(const vtkDataSetInformation &dsInfo, double *x)
Try to find the cell closest to provided x point in provided dataset, By first testing inclusion in i...
int InitializationState
Make sure the velocity field is initialized: record the initialization cellLocator.
size_t GetDataSetsInfoSize()
These methods pertain to initializing the vector field by subclasses (which may have special initiali...
void ClearLastCellId()
Set the last cell id to -1 to incur a global cell search for the next point.
virtual void SetFindCellStrategy(vtkFindCellStrategy *)
Set / get the strategy used to perform the FindCell() operation.
virtual vtkFindCellStrategy * GetFindCellStrategy()
Set / get the strategy used to perform the FindCell() operation.
void FastCompute(vtkDataArray *vectors, double f[3])
If all weights have been computed (parametric coords etc all valid), a scalar/vector can be quickly i...
std::vector< vtkDataSetInformation > DataSetsInfo
Define a Cell Locator to perform FindCell(), keep track of them (and other cached information) associ...
bool InterpolatePoint(vtkPointData *outPD, vtkIdType outIndex)
If all weights have been computed (parametric coords etc all valid), a scalar/vector can be quickly i...
bool InterpolatePoint(vtkAbstractInterpolatedVelocityField *inIVF, vtkPointData *outPD, vtkIdType outIndex)
If all weights have been computed (parametric coords etc all valid), a scalar/vector can be quickly i...
vtkGenericCell * GetLastCell()
If all weights have been computed (parametric coords etc all valid), a scalar/vector can be quickly i...
virtual void CopyParameters(vtkAbstractInterpolatedVelocityField *from)
Copy essential parameters between instances of this class.
virtual void SetLastCellId(vtkIdType c)
Get/Set the id of the cell cached from last evaluation.
virtual void SetLastCellId(vtkIdType c, int dataindex)=0
Set the id of the most recently visited cell of a dataset.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for obtaining type information and printing the object state.
void FastCompute(vtkAbstractInterpolatedVelocityField *inIVF, vtkDataArray *vectors, double f[3])
If all weights have been computed (parametric coords etc all valid), a scalar/vector can be quickly i...
void SelectVectors(int fieldAssociation, const char *fieldName)
the association type (see vtkDataObject::FieldAssociations) and the name of the velocity data field
vtkAbstractCellLocator * CellLocator
Define a Cell Locator to perform FindCell(), keep track of them (and other cached information) associ...
abstract superclass for composite (multi-block or AMR) datasets
general representation of visualization data
abstract class to specify dataset behavior
Definition vtkDataSet.h:166
helper class to manage the vtkPointSet::FindCell() method
virtual int FunctionValues(double *x, double *f)
Evaluate functions at x_j.
provides thread-safe access to cells
list of point or cell ids
Definition vtkIdList.h:135
a simple class to control print indentation
Definition vtkIndent.h:108
Allocate and hold a VTK object.
Definition vtkNew.h:168
T * Get() const noexcept
Get a raw pointer to the contained object.
Definition vtkNew.h:258
represent and manipulate point attribute data
vtkDataSetInformation(vtkDataSet *dataSet, vtkAbstractCellLocator *cellLocator, vtkDataArray *vectors)
#define vtkDataArray
#define VTK_DEPRECATED_IN_9_7_0(reason)
int vtkIdType
Definition vtkType.h:363