VTK  9.3.0
vtkCachingInterpolatedVelocityField.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
32#ifndef vtkCachingInterpolatedVelocityField_h
33#define vtkCachingInterpolatedVelocityField_h
34
35#include "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_2_0
36#include "vtkFiltersFlowPathsModule.h" // For export macro
37#include "vtkFunctionSet.h"
38#include "vtkSmartPointer.h" // this is allowed
39
40#include <vector> // we need them
41
42VTK_ABI_NAMESPACE_BEGIN
43class vtkDataSet;
44class vtkDataArray;
45class vtkPointData;
46class vtkGenericCell;
48
49//---------------------------------------------------------------------------
50class IVFDataSetInfo;
51//---------------------------------------------------------------------------
52class IVFCacheList : public std::vector<IVFDataSetInfo>
53{
54};
55//---------------------------------------------------------------------------
56
58 "Use vtkCompositeInterpolatedVelocityField instead of vtkCachingInterpolatedVelocityField "
59 "and set the desired strategy.") VTKFILTERSFLOWPATHS_EXPORT vtkCachingInterpolatedVelocityField
60 : public vtkFunctionSet
61{
62public:
64 void PrintSelf(ostream& os, vtkIndent indent) override;
65
71
72 using Superclass::FunctionValues;
74
78 int FunctionValues(double* x, double* f) override;
79 virtual int InsideTest(double* x);
81
85 virtual void SetDataSet(
86 int I, vtkDataSet* dataset, bool staticdataset, vtkAbstractCellLocator* locator);
87
89
94 vtkGetStringMacro(VectorsSelection);
95 void SelectVectors(const char* fieldName) { this->SetVectorsSelection(fieldName); }
97
103 void SetLastCellInfo(vtkIdType c, int datasetindex);
104
110
112
117 int GetLastWeights(double* w);
118 int GetLastLocalCoordinates(double pcoords[3]);
120
122
125 vtkGetMacro(CellCacheHit, int);
126 vtkGetMacro(DataSetCacheHit, int);
127 vtkGetMacro(CacheMiss, int);
129
130protected:
133
140 IVFDataSetInfo* Cache;
143
144 std::vector<double> Weights;
145
146 vtkSetStringMacro(VectorsSelection);
147
148 // private versions which work on the passed dataset/cache
149 // these do the real computation
150 int FunctionValues(IVFDataSetInfo* cache, double* x, double* f);
151 int InsideTest(IVFDataSetInfo* cache, double* x);
152
155
162 void FastCompute(IVFDataSetInfo* cache, double f[3]);
168
169private:
171 void operator=(const vtkCachingInterpolatedVelocityField&) = delete;
172};
173
174//---------------------------------------------------------------------------
175
177// IVFDataSetInfo
179#ifndef DOXYGEN_SHOULD_SKIP_THIS
180//
181
182//
183class IVFDataSetInfo
184{
185public:
189 double PCoords[3];
190 float* VelocityFloat;
191 double* VelocityDouble;
192 double Tolerance;
193 bool StaticDataSet;
194 IVFDataSetInfo();
195 IVFDataSetInfo(const IVFDataSetInfo& ivfci);
196 IVFDataSetInfo& operator=(const IVFDataSetInfo& ivfci);
197 void SetDataSet(
198 vtkDataSet* data, char* velocity, bool staticdataset, vtkAbstractCellLocator* locator);
199 //
200 static const double TOLERANCE_SCALE;
201};
202
203//
204
205//
206
207#endif /* DOXYGEN_SHOULD_SKIP_THIS */
208
209VTK_ABI_NAMESPACE_END
210#endif
211
212// VTK-HeaderTest-Exclude: vtkCachingInterpolatedVelocityField.h
an abstract base class for locators which find cells
Interface for obtaining interpolated velocity values.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int GetLastWeights(double *w)
Returns the interpolation weights/pcoords cached from last evaluation if the cached cell is valid (re...
bool InterpolatePoint(vtkPointData *outPD, vtkIdType outIndex)
If all weights have been computed (parametric coords etc all valid) then we can quickly interpolate a...
vtkGenericCell * GetLastCell()
If all weights have been computed (parametric coords etc all valid) then we can quickly interpolate a...
int InsideTest(IVFDataSetInfo *cache, double *x)
void SetLastCellInfo(vtkIdType c, int datasetindex)
Set LastCellId to c and LastCacheIndex datasetindex, cached from last evaluation.
int FunctionValues(IVFDataSetInfo *cache, double *x, double *f)
int FunctionValues(double *x, double *f) override
Evaluate the velocity field, f={u,v,w}, at {x, y, z}.
void FastCompute(IVFDataSetInfo *cache, double f[3])
If all weights have been computed (parametric coords etc all valid) then we can quickly interpolate a...
void ClearLastCellInfo()
Set LastCellId to -1 and Cache to nullptr so that the next search does not start from the previous ce...
int GetLastLocalCoordinates(double pcoords[3])
Returns the interpolation weights/pcoords cached from last evaluation if the cached cell is valid (re...
virtual int InsideTest(double *x)
Evaluate the velocity field, f={u,v,w}, at {x, y, z}.
virtual void SetDataSet(int I, vtkDataSet *dataset, bool staticdataset, vtkAbstractCellLocator *locator)
Add a dataset used by the interpolation function evaluation.
bool InterpolatePoint(vtkCachingInterpolatedVelocityField *inCIVF, vtkPointData *outPD, vtkIdType outIndex)
If all weights have been computed (parametric coords etc all valid) then we can quickly interpolate a...
void SelectVectors(const char *fieldName)
If you want to work with an arbitrary vector array, then set its name here.
static vtkCachingInterpolatedVelocityField * New()
Construct a vtkCachingInterpolatedVelocityField with no initial data set.
abstract superclass for arrays of numeric data
abstract class to specify dataset behavior
Definition vtkDataSet.h:53
Abstract interface for sets of functions.
provides thread-safe access to cells
a simple class to control print indentation
Definition vtkIndent.h:29
represent and manipulate point attribute data
Hold a reference to a vtkObjectBase instance.
A helper class for interpolating between times during particle tracing.
#define VTK_DEPRECATED_IN_9_2_0(reason)
int vtkIdType
Definition vtkType.h:315