VTK  9.6.20260523
vtkTemporalInterpolatedVelocityField.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
34
35#ifndef vtkTemporalInterpolatedVelocityField_h
36#define vtkTemporalInterpolatedVelocityField_h
37
38#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_7_0
39#include "vtkFiltersFlowPathsModule.h" // For export macro
40#include "vtkFunctionSet.h"
41#include "vtkSmartPointer.h" // For vtkSmartPointer
42
43#include <vector> // For internal structures
44
45VTK_ABI_NAMESPACE_BEGIN
50class vtkDataArray;
51class vtkDataSet;
52class vtkDoubleArray;
54class vtkGenericCell;
55class vtkLocator;
56class vtkPointData;
57
58class VTKFILTERSFLOWPATHS_EXPORT vtkTemporalInterpolatedVelocityField : public vtkFunctionSet
59{
60public:
62 void PrintSelf(ostream& os, vtkIndent indent) override;
63
69
80
91
93 /*
94 * Set/Get the type of variance of the mesh over time.
95 *
96 * DIFFERENT = 0,
97 * STATIC = 1,
98 * LINEAR_TRANSFORMATION = 2
99 * SAME_TOPOLOGY = 3
100 */
101 vtkSetClampMacro(MeshOverTime, int, DIFFERENT, SAME_TOPOLOGY);
106 vtkGetMacro(MeshOverTime, int);
108
117
125
128
132 int FunctionValues(double* x, double* u) override;
133 int FunctionValuesAtT(int T, double* x, double* u);
135
141 void SelectVectors(const char* fieldName) { this->SetVectorsSelection(fieldName); }
142
144
149 void AddDataSetAtTime(int N, double T, vtkDataSet* dataset);
151
153
158 bool GetCachedCellIds(vtkIdType id[2], int ds[2]);
159 void SetCachedCellIds(vtkIdType id[2], int ds[2]);
161
167
169
173 int TestPoint(double* x);
174 int QuickTestPoint(double* x);
176
178
182 vtkGetVector3Macro(LastGoodVelocity, double);
184
186
189 vtkGetMacro(CurrentWeight, double);
191
192 bool InterpolatePoint(vtkPointData* outPD1, vtkPointData* outPD2, vtkIdType outIndex);
193
194 bool InterpolatePoint(int T, vtkPointData* outPD1, vtkIdType outIndex);
195
197 int T, double pcoords[3], double* weights, vtkGenericCell*& cell, vtkDoubleArray* cellVectors);
198
200
202
204
210 VTK_DEPRECATED_IN_9_7_0("Use SetCellLocator() instead.")
213 "GetFindCellStrategy() always returns nullptr. Use GetCellLocator() instead.")
214 virtual vtkFindCellStrategy* GetFindCellStrategy() { return nullptr; }
216
218
226
227protected:
230
231 virtual void SetVectorsSelection(const char* v);
232
234
236 const std::vector<vtkDataSet*>& datasets, vtkAbstractCellLocator* cellLocatorPrototype,
237 const std::vector<vtkSmartPointer<vtkAbstractCellLocator>>& cellLocators,
238 const std::vector<vtkSmartPointer<vtkAbstractCellLinks>>& links);
239
240 void CreateCellLocators(const std::vector<vtkDataSet*>& datasets,
241 vtkAbstractCellLocator* cellLocatorProtoType,
242 std::vector<vtkSmartPointer<vtkAbstractCellLocator>>& cellLocators);
243 void CreateLinks(const std::vector<vtkDataSet*>& datasets,
244 std::vector<vtkSmartPointer<vtkAbstractCellLinks>>& links);
246 const std::vector<vtkSmartPointer<vtkAbstractCellLocator>>& cellLocators,
247 std::vector<vtkSmartPointer<vtkAbstractCellLocator>>& linearCellLocators);
248
249 double Vals1[3];
250 double Vals2[3];
251 double Times[2];
253
254 static const double WEIGHT_TO_TOLERANCE;
255
256 // The weight (0.0->1.0) of the value of T between the two available
257 // time values for the current computation
259 // One minus the CurrentWeight
261 // A scaling factor used when calculating the CurrentWeight { 1.0/(T2-T1) }
263
265 std::vector<vtkSmartPointer<vtkAbstractCellLocator>> CellLocators[2];
266 std::vector<vtkSmartPointer<vtkAbstractCellLocator>> InitialCellLocators;
267 std::vector<vtkSmartPointer<vtkAbstractCellLinks>> Links[2];
268 std::vector<size_t> MaxCellSizes[2];
269
271
272private:
273 // Hide this since we need multiple time steps and are using a different
274 // function prototype
275 virtual void AddDataSet(vtkDataSet*) {}
276
278 void operator=(const vtkTemporalInterpolatedVelocityField&) = delete;
279};
280
281VTK_ABI_NAMESPACE_END
282#endif
an abstract base class for locators which find cells
abstract superclass for composite (multi-block or AMR) datasets
An abstract class for obtaining the interpolated velocity values at a point.
abstract class to specify dataset behavior
Definition vtkDataSet.h:166
dynamic, self-adjusting array of double
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
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for objects that accelerate spatial searches
Definition vtkLocator.h:79
represent and manipulate point attribute data
Hold a reference to a vtkObjectBase instance.
A helper class for interpolating between times during particle tracing.
int QuickTestPoint(double *x)
A utility function which evaluates the point at T1, T2 to see if it is inside the data at both times ...
int TestPoint(double *x)
A utility function which evaluates the point at T1, T2 to see if it is inside the data at both times ...
IDStates
States that define where the cell id are.
void AddDataSetAtTime(int N, double T, vtkDataSet *dataset)
In order to use this class, two sets of data must be supplied, corresponding to times T1 and T2.
MeshOverTimeTypes
Types of Variance of Mesh over time.
virtual void CopyParameters(vtkTemporalInterpolatedVelocityField *from)
Copy essential parameters between instances of this class.
void CreateLinearTransformCellLocators(const std::vector< vtkSmartPointer< vtkAbstractCellLocator > > &cellLocators, std::vector< vtkSmartPointer< vtkAbstractCellLocator > > &linearCellLocators)
virtual vtkFindCellStrategy * GetFindCellStrategy()
Set / get the strategy used to perform the FindCell() operation.
bool InterpolatePoint(vtkPointData *outPD1, vtkPointData *outPD2, vtkIdType outIndex)
void SelectVectors(const char *fieldName)
If you want to work with an arbitrary vector array, then set its name here.
void CreateCellLocators(const std::vector< vtkDataSet * > &datasets, vtkAbstractCellLocator *cellLocatorProtoType, std::vector< vtkSmartPointer< vtkAbstractCellLocator > > &cellLocators)
virtual void SetVectorsSelection(const char *v)
bool GetVorticityData(int T, double pcoords[3], double *weights, vtkGenericCell *&cell, vtkDoubleArray *cellVectors)
void InitializeWithCellLocators(vtkCompositeInterpolatedVelocityField *ivf, const std::vector< vtkDataSet * > &datasets, vtkAbstractCellLocator *cellLocatorPrototype, const std::vector< vtkSmartPointer< vtkAbstractCellLocator > > &cellLocators, const std::vector< vtkSmartPointer< vtkAbstractCellLinks > > &links)
std::vector< vtkSmartPointer< vtkAbstractCellLocator > > InitialCellLocators
bool InterpolatePoint(int T, vtkPointData *outPD1, vtkIdType outIndex)
virtual void SetFindCellStrategy(vtkFindCellStrategy *)
Set / get the strategy used to perform the FindCell() operation.
void SetCachedCellIds(vtkIdType id[2], int ds[2])
Between iterations of the Particle Tracer, Id's of the Cell are stored and then at the start of the n...
bool GetCachedCellIds(vtkIdType id[2], int ds[2])
Between iterations of the Particle Tracer, Id's of the Cell are stored and then at the start of the n...
void CreateLinks(const std::vector< vtkDataSet * > &datasets, std::vector< vtkSmartPointer< vtkAbstractCellLinks > > &links)
std::vector< vtkSmartPointer< vtkAbstractCellLocator > > CellLocators[2]
void ClearCache()
Set the last cell id to -1 so that the next search does not start from the previous cell.
int FunctionValues(double *x, double *u) override
Evaluate the velocity field, f, at (x, y, z, t).
virtual void SetCellLocator(vtkAbstractCellLocator *)
Set / get the cell locator used to perform the FindCell() operation.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int FunctionValuesAtT(int T, double *x, double *u)
Evaluate the velocity field, f, at (x, y, z, t).
std::vector< vtkSmartPointer< vtkAbstractCellLinks > > Links[2]
void Initialize(vtkCompositeDataSet *t0, vtkCompositeDataSet *t1)
The Initialize() method is used to build and cache supporting structures (such as locators) which are...
static vtkTemporalInterpolatedVelocityField * New()
Construct a vtkTemporalInterpolatedVelocityField with no initial data set.
vtkSmartPointer< vtkCompositeInterpolatedVelocityField > IVF[2]
#define vtkDataArray
#define VTK_DEPRECATED_IN_9_7_0(reason)
int vtkIdType
Definition vtkType.h:363