VTK  9.2.5
vtkCachingInterpolatedVelocityField.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkCachingInterpolatedVelocityField.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
44#ifndef vtkCachingInterpolatedVelocityField_h
45#define vtkCachingInterpolatedVelocityField_h
46
47#include "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_2_0
48#include "vtkFiltersFlowPathsModule.h" // For export macro
49#include "vtkFunctionSet.h"
50#include "vtkSmartPointer.h" // this is allowed
51
52#include <vector> // we need them
53
54class vtkDataSet;
55class vtkDataArray;
56class vtkPointData;
57class vtkGenericCell;
59
60//---------------------------------------------------------------------------
61class IVFDataSetInfo;
62//---------------------------------------------------------------------------
63class IVFCacheList : public std::vector<IVFDataSetInfo>
64{
65};
66//---------------------------------------------------------------------------
67
69 "Use vtkCompositeInterpolatedVelocityField instead of vtkCachingInterpolatedVelocityField "
70 "and set the desired strategy.") VTKFILTERSFLOWPATHS_EXPORT vtkCachingInterpolatedVelocityField
71 : public vtkFunctionSet
72{
73public:
75 void PrintSelf(ostream& os, vtkIndent indent) override;
76
82
83 using Superclass::FunctionValues;
85
89 int FunctionValues(double* x, double* f) override;
90 virtual int InsideTest(double* x);
92
96 virtual void SetDataSet(
97 int I, vtkDataSet* dataset, bool staticdataset, vtkAbstractCellLocator* locator);
98
100
105 vtkGetStringMacro(VectorsSelection);
106 void SelectVectors(const char* fieldName) { this->SetVectorsSelection(fieldName); }
108
114 void SetLastCellInfo(vtkIdType c, int datasetindex);
115
121
123
128 int GetLastWeights(double* w);
129 int GetLastLocalCoordinates(double pcoords[3]);
131
133
136 vtkGetMacro(CellCacheHit, int);
137 vtkGetMacro(DataSetCacheHit, int);
138 vtkGetMacro(CacheMiss, int);
140
141protected:
144
151 IVFDataSetInfo* Cache;
154
155 std::vector<double> Weights;
156
157 vtkSetStringMacro(VectorsSelection);
158
159 // private versions which work on the passed dataset/cache
160 // these do the real computation
161 int FunctionValues(IVFDataSetInfo* cache, double* x, double* f);
162 int InsideTest(IVFDataSetInfo* cache, double* x);
163
166
173 void FastCompute(IVFDataSetInfo* cache, double f[3]);
179
180private:
182 void operator=(const vtkCachingInterpolatedVelocityField&) = delete;
183};
184
185//---------------------------------------------------------------------------
186
188// IVFDataSetInfo
190#ifndef DOXYGEN_SHOULD_SKIP_THIS
191//
192
193//
194class IVFDataSetInfo
195{
196public:
200 double PCoords[3];
201 float* VelocityFloat;
202 double* VelocityDouble;
203 double Tolerance;
204 bool StaticDataSet;
205 IVFDataSetInfo();
206 IVFDataSetInfo(const IVFDataSetInfo& ivfci);
207 IVFDataSetInfo& operator=(const IVFDataSetInfo& ivfci);
208 void SetDataSet(
209 vtkDataSet* data, char* velocity, bool staticdataset, vtkAbstractCellLocator* locator);
210 //
211 static const double TOLERANCE_SCALE;
212};
213
214//
215
216//
217
218#endif /* DOXYGEN_SHOULD_SKIP_THIS */
219
220#endif
221
222// 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
Definition: vtkDataArray.h:56
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
Abstract interface for sets of functions.
provides thread-safe access to cells
a simple class to control print indentation
Definition: vtkIndent.h:40
represent and manipulate point attribute data
Definition: vtkPointData.h:42
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:332