VTK: Filters/FlowPaths/vtkAbstractInterpolatedVelocityField.h Source File

| VTK 9.3.1

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
65 #ifndef vtkAbstractInterpolatedVelocityField_h
66 #define vtkAbstractInterpolatedVelocityField_h
67
68 #include "vtkFiltersFlowPathsModule.h" // For export macro
69 #include "vtkFunctionSet.h"
70 #include "vtkNew.h" // for vtkNew
71 #include "vtkSmartPointer.h" // for vtkSmartPointer
72
73 #include <vector> // for weights
74
75 VTK_ABI_NAMESPACE_BEGIN
76 class vtkCellLocatorStrategy;
77 class vtkClosestPointStrategy;
78 class vtkClosestNPointsStrategy;
79 class vtkCompositeDataSet;
80 class vtkDataObject;
81 class vtkDataSet;
82 class vtkDataArray;
83 class vtkIdList;
84 class vtkPointData;
85 class vtkGenericCell;
86 class vtkFindCellStrategy;
87
88 class VTKFILTERSFLOWPATHS_EXPORT vtkAbstractInterpolatedVelocityField : public vtkFunctionSet
89 {
90 public:
92
95 vtkTypeMacro(vtkAbstractInterpolatedVelocityField, vtkFunctionSet);
96 void PrintSelf(ostream& os, vtkIndent indent) override;
98
99 // Keep track of how the interpolated velocity field is
100 // initialized. Currently, all datasets that compose the velocity field are
101 // initialized (meaning that supporting structures like locators are
102 // built).
103 enum VelocityFieldInitializationState
104 {
105 NOT_INITIALIZED = 0,
106 INITIALIZE_ALL_DATASETS = 1,
107 SELF_INITIALIZE = 2
108 };
109
111
125 virtual void Initialize(vtkCompositeDataSet* compDS, int initStrategy = INITIALIZE_ALL_DATASETS);
126 vtkGetMacro(InitializationState, int);
128
130
136 vtkSetMacro(Caching, bool);
137 vtkGetMacro(Caching, bool);
139
141
145 vtkGetMacro(CacheHit, int);
146 vtkGetMacro(CacheMiss, int);
148
149 vtkGetObjectMacro(LastDataSet, vtkDataSet);
150
152
155 vtkGetMacro(LastCellId, vtkIdType);
156 virtual void SetLastCellId(vtkIdType c) { this->LastCellId = c; }
158
162 virtual void SetLastCellId(vtkIdType c, int dataindex) = 0;
163
165
169 vtkGetStringMacro(VectorsSelection);
170 vtkGetMacro(VectorsType, int);
172
177 void SelectVectors(int fieldAssociation, const char* fieldName);
178
180
197 vtkSetMacro(NormalizeVector, bool);
198 vtkGetMacro(NormalizeVector, bool);
200
202
209 vtkSetMacro(ForceSurfaceTangentVector, bool);
210 vtkGetMacro(ForceSurfaceTangentVector, bool);
212
214
218 vtkSetMacro(SurfaceDataset, bool);
219 vtkGetMacro(SurfaceDataset, bool);
221
228 virtual void CopyParameters(vtkAbstractInterpolatedVelocityField* from);
229
230 using Superclass::FunctionValues;
234 int FunctionValues(double* x, double* f) override = 0;
235
239 void ClearLastCellId() { this->LastCellId = -1; }
240
242
246 int GetLastWeights(double* w);
247 int GetLastLocalCoordinates(double pcoords[3]);
249
251
257 virtual void SetFindCellStrategy(vtkFindCellStrategy*);
258 vtkGetObjectMacro(FindCellStrategy, vtkFindCellStrategy);
260
261 protected:
262 vtkAbstractInterpolatedVelocityField();
263 ~vtkAbstractInterpolatedVelocityField() override;
264
265 static const double TOLERANCE_SCALE;
266 static const double SURFACE_TOLERANCE_SCALE;
267
268 int CacheHit;
269 int CacheMiss;
270 bool Caching;
271 bool NormalizeVector;
272 bool ForceSurfaceTangentVector;
273 bool SurfaceDataset;
274 int VectorsType;
275 char* VectorsSelection;
276 std::vector<double> Weights;
277 double LastPCoords[3];
278 int LastSubId;
279 double LastClosestPoint[3];
280 vtkIdType LastCellId;
281 vtkDataSet* LastDataSet;
282 vtkNew<vtkGenericCell> LastCell;
283 vtkNew<vtkGenericCell> CurrentCell;
284 vtkNew<vtkIdList> PointIds;
285
290 int InitializationState;
291
292 // This is used to keep track of the find cell strategy and vector array
293 // associated with each dataset forming the velocity field. Note that the
294 // find cells strategy can be null, this means the find cell is invoked
295 // using the dataset's FindCell() method.
296 struct vtkDataSetInformation
297 {
298 vtkDataSet* DataSet;
299 vtkFindCellStrategy* Strategy;
300 vtkDataArray* Vectors;
301
302 vtkDataSetInformation(vtkDataSet* dataSet, vtkFindCellStrategy* strategy, vtkDataArray* vectors)
303 : DataSet(dataSet)
304 , Strategy(strategy)
305 , Vectors(vectors)
306 {
307 }
308 };
310
314 vtkFindCellStrategy* FindCellStrategy;
315 std::vector<vtkDataSetInformation> DataSetsInfo;
316 std::vector<vtkDataSetInformation>::iterator GetDataSetInfo(vtkDataSet* dataset);
318
320
323 vtkSetStringMacro(VectorsSelection);
325
337 virtual int FunctionValues(vtkDataSet* ds, double* x, double* f);
338
345 virtual bool FindAndUpdateCell(vtkDataSet* ds, vtkFindCellStrategy* strategy, double* x);
346
347 friend class vtkTemporalInterpolatedVelocityField;
349
355 void FastCompute(vtkDataArray* vectors, double f[3]);
356 void FastCompute(vtkAbstractInterpolatedVelocityField* inIVF, vtkDataArray* vectors, double f[3]);
357 bool InterpolatePoint(vtkPointData* outPD, vtkIdType outIndex);
358 bool InterpolatePoint(
359 vtkAbstractInterpolatedVelocityField* inIVF, vtkPointData* outPD, vtkIdType outIndex);
360 vtkGenericCell* GetLastCell()
361 {
362 return (this->LastCellId != -1) ? this->CurrentCell.Get() : nullptr;
363 }
365
367
373 virtual int SelfInitialize() { return 0; }
374 void AddToDataSetsInfo(vtkDataSet*, vtkFindCellStrategy*, vtkDataArray* vectors);
375 size_t GetDataSetsInfoSize();
377
378 private:
379 vtkAbstractInterpolatedVelocityField(const vtkAbstractInterpolatedVelocityField&) = delete;
380 void operator=(const vtkAbstractInterpolatedVelocityField&) = delete;
381 };
382
383 VTK_ABI_NAMESPACE_END
384 #endif
vtkAbstractInterpolatedVelocityField
An abstract class for obtaining the interpolated velocity values at a point.
Definition: vtkAbstractInterpolatedVelocityField.h:89
vtkAbstractInterpolatedVelocityField::LastCell
vtkNew< vtkGenericCell > LastCell
Definition: vtkAbstractInterpolatedVelocityField.h:282
vtkAbstractInterpolatedVelocityField::FunctionValues
int FunctionValues(double *x, double *f) override=0
Evaluate the velocity field f at point (x, y, z).
vtkAbstractInterpolatedVelocityField::Weights
std::vector< double > Weights
Definition: vtkAbstractInterpolatedVelocityField.h:276
vtkAbstractInterpolatedVelocityField::CacheHit
int CacheHit
Definition: vtkAbstractInterpolatedVelocityField.h:268
vtkAbstractInterpolatedVelocityField::ForceSurfaceTangentVector
bool ForceSurfaceTangentVector
Definition: vtkAbstractInterpolatedVelocityField.h:272
vtkAbstractInterpolatedVelocityField::SURFACE_TOLERANCE_SCALE
static const double SURFACE_TOLERANCE_SCALE
Definition: vtkAbstractInterpolatedVelocityField.h:266
vtkAbstractInterpolatedVelocityField::FunctionValues
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...
vtkAbstractInterpolatedVelocityField::SelfInitialize
virtual int SelfInitialize()
These methods pertain to initializing the vector field by subclasses (which may have special initiali...
Definition: vtkAbstractInterpolatedVelocityField.h:373
vtkAbstractInterpolatedVelocityField::LastDataSet
vtkDataSet * LastDataSet
Definition: vtkAbstractInterpolatedVelocityField.h:281
vtkAbstractInterpolatedVelocityField::VectorsSelection
char * VectorsSelection
Definition: vtkAbstractInterpolatedVelocityField.h:275
vtkAbstractInterpolatedVelocityField::GetLastWeights
int GetLastWeights(double *w)
Get the interpolation weights cached from last evaluation.
vtkAbstractInterpolatedVelocityField::GetLastLocalCoordinates
int GetLastLocalCoordinates(double pcoords[3])
Get the interpolation weights cached from last evaluation.
vtkAbstractInterpolatedVelocityField::vtkAbstractInterpolatedVelocityField
vtkAbstractInterpolatedVelocityField()
vtkAbstractInterpolatedVelocityField::InitializationState
int InitializationState
Make sure the velocity field is initialized: record the initialization strategy.
Definition: vtkAbstractInterpolatedVelocityField.h:290
vtkAbstractInterpolatedVelocityField::GetDataSetsInfoSize
size_t GetDataSetsInfoSize()
These methods pertain to initializing the vector field by subclasses (which may have special initiali...
vtkAbstractInterpolatedVelocityField::VelocityFieldInitializationState
VelocityFieldInitializationState
Definition: vtkAbstractInterpolatedVelocityField.h:104
vtkAbstractInterpolatedVelocityField::SurfaceDataset
bool SurfaceDataset
Definition: vtkAbstractInterpolatedVelocityField.h:273
vtkAbstractInterpolatedVelocityField::Initialize
virtual void Initialize(vtkCompositeDataSet *compDS, int initStrategy=INITIALIZE_ALL_DATASETS)
The Initialize() method is used to build and cache supporting structures (such as locators) which are...
vtkAbstractInterpolatedVelocityField::ClearLastCellId
void ClearLastCellId()
Set the last cell id to -1 to incur a global cell search for the next point.
Definition: vtkAbstractInterpolatedVelocityField.h:239
vtkAbstractInterpolatedVelocityField::SetFindCellStrategy
virtual void SetFindCellStrategy(vtkFindCellStrategy *)
Set / get the strategy used to perform the FindCell() operation.
vtkAbstractInterpolatedVelocityField::FastCompute
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...
vtkAbstractInterpolatedVelocityField::LastCellId
vtkIdType LastCellId
Definition: vtkAbstractInterpolatedVelocityField.h:280
vtkAbstractInterpolatedVelocityField::~vtkAbstractInterpolatedVelocityField
~vtkAbstractInterpolatedVelocityField() override
vtkAbstractInterpolatedVelocityField::DataSetsInfo
std::vector< vtkDataSetInformation > DataSetsInfo
Define a FindCell() strategy, keep track of the strategies (and other cached information) associated ...
Definition: vtkAbstractInterpolatedVelocityField.h:315
vtkAbstractInterpolatedVelocityField::GetDataSetInfo
std::vector< vtkDataSetInformation >::iterator GetDataSetInfo(vtkDataSet *dataset)
Define a FindCell() strategy, keep track of the strategies (and other cached information) associated ...
vtkAbstractInterpolatedVelocityField::AddToDataSetsInfo
void AddToDataSetsInfo(vtkDataSet *, vtkFindCellStrategy *, vtkDataArray *vectors)
These methods pertain to initializing the vector field by subclasses (which may have special initiali...
vtkAbstractInterpolatedVelocityField::VectorsType
int VectorsType
Definition: vtkAbstractInterpolatedVelocityField.h:274
vtkAbstractInterpolatedVelocityField::FindCellStrategy
vtkFindCellStrategy * FindCellStrategy
Define a FindCell() strategy, keep track of the strategies (and other cached information) associated ...
Definition: vtkAbstractInterpolatedVelocityField.h:314
vtkAbstractInterpolatedVelocityField::InterpolatePoint
bool InterpolatePoint(vtkPointData *outPD, vtkIdType outIndex)
If all weights have been computed (parametric coords etc all valid), a scalar/vector can be quickly i...
vtkAbstractInterpolatedVelocityField::CacheMiss
int CacheMiss
Definition: vtkAbstractInterpolatedVelocityField.h:269
vtkAbstractInterpolatedVelocityField::Caching
bool Caching
Definition: vtkAbstractInterpolatedVelocityField.h:270
vtkAbstractInterpolatedVelocityField::TOLERANCE_SCALE
static const double TOLERANCE_SCALE
Definition: vtkAbstractInterpolatedVelocityField.h:265
vtkAbstractInterpolatedVelocityField::PointIds
vtkNew< vtkIdList > PointIds
Definition: vtkAbstractInterpolatedVelocityField.h:284
vtkAbstractInterpolatedVelocityField::InterpolatePoint
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...
vtkAbstractInterpolatedVelocityField::LastSubId
int LastSubId
Definition: vtkAbstractInterpolatedVelocityField.h:278
vtkAbstractInterpolatedVelocityField::CopyParameters
virtual void CopyParameters(vtkAbstractInterpolatedVelocityField *from)
Copy essential parameters between instances of this class.
vtkAbstractInterpolatedVelocityField::SetLastCellId
virtual void SetLastCellId(vtkIdType c)
Get/Set the id of the cell cached from last evaluation.
Definition: vtkAbstractInterpolatedVelocityField.h:156
vtkAbstractInterpolatedVelocityField::GetLastCell
vtkGenericCell * GetLastCell()
If all weights have been computed (parametric coords etc all valid), a scalar/vector can be quickly i...
Definition: vtkAbstractInterpolatedVelocityField.h:360
vtkAbstractInterpolatedVelocityField::FindAndUpdateCell
virtual bool FindAndUpdateCell(vtkDataSet *ds, vtkFindCellStrategy *strategy, double *x)
Try to find the cell closest to provided x point in provided dataset, By first testing inclusion in i...
vtkAbstractInterpolatedVelocityField::SetLastCellId
virtual void SetLastCellId(vtkIdType c, int dataindex)=0
Set the id of the most recently visited cell of a dataset.
vtkAbstractInterpolatedVelocityField::CurrentCell
vtkNew< vtkGenericCell > CurrentCell
Definition: vtkAbstractInterpolatedVelocityField.h:283
vtkAbstractInterpolatedVelocityField::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for obtaining type information and printing the object state.
vtkAbstractInterpolatedVelocityField::FastCompute
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...
vtkAbstractInterpolatedVelocityField::NormalizeVector
bool NormalizeVector
Definition: vtkAbstractInterpolatedVelocityField.h:271
vtkAbstractInterpolatedVelocityField::SelectVectors
void SelectVectors(int fieldAssociation, const char *fieldName)
the association type (see vtkDataObject::FieldAssociations) and the name of the velocity data field
vtkCellLocatorStrategy
implement a specific vtkPointSet::FindCell() strategy based on using a cell locator
Definition: vtkCellLocatorStrategy.h:29
vtkClosestNPointsStrategy
implement a specific vtkPointSet::FindCell() strategy based on the N closest points
Definition: vtkClosestNPointsStrategy.h:28
vtkClosestPointStrategy
implement a specific vtkPointSet::FindCell() strategy based on closest point
Definition: vtkClosestPointStrategy.h:36
vtkCompositeDataSet
abstract superclass for composite (multi-block or AMR) datasets
Definition: vtkCompositeDataSet.h:51
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:64
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkFindCellStrategy
helper class to manage the vtkPointSet::FindCell() METHOD
Definition: vtkFindCellStrategy.h:48
vtkFunctionSet
Abstract interface for sets of functions.
Definition: vtkFunctionSet.h:25
vtkGenericCell
provides thread-safe access to cells
Definition: vtkGenericCell.h:38
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:32
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkNew< vtkGenericCell >
vtkNew::Get
T * Get() const noexcept
Get a raw pointer to the contained object.
Definition: vtkNew.h:150
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:39
vtkTemporalInterpolatedVelocityField
A helper class for interpolating between times during particle tracing.
Definition: vtkTemporalInterpolatedVelocityField.h:58
vtx::types::DataSet
std::map< std::string, DataArray > DataSet
key: variable name, value: DataArray
Definition: VTXTypes.h:28
vtkAbstractInterpolatedVelocityField::vtkDataSetInformation
Definition: vtkAbstractInterpolatedVelocityField.h:297
vtkAbstractInterpolatedVelocityField::vtkDataSetInformation::DataSet
vtkDataSet * DataSet
Definition: vtkAbstractInterpolatedVelocityField.h:298
vtkAbstractInterpolatedVelocityField::vtkDataSetInformation::vtkDataSetInformation
vtkDataSetInformation(vtkDataSet *dataSet, vtkFindCellStrategy *strategy, vtkDataArray *vectors)
Definition: vtkAbstractInterpolatedVelocityField.h:302
vtkAbstractInterpolatedVelocityField::vtkDataSetInformation::Vectors
vtkDataArray * Vectors
Definition: vtkAbstractInterpolatedVelocityField.h:300
vtkAbstractInterpolatedVelocityField::vtkDataSetInformation::Strategy
vtkFindCellStrategy * Strategy
Definition: vtkAbstractInterpolatedVelocityField.h:299
vtkFunctionSet.h
vtkNew.h
vtkSmartPointer.h
vtkIdType
int vtkIdType
Definition: vtkType.h:315