VTK  9.3.1
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 
42 VTK_ABI_NAMESPACE_BEGIN
43 class vtkDataSet;
44 class vtkDataArray;
45 class vtkPointData;
46 class vtkGenericCell;
48 
49 //---------------------------------------------------------------------------
50 class IVFDataSetInfo;
51 //---------------------------------------------------------------------------
52 class IVFCacheList : public std::vector<IVFDataSetInfo>
53 {
54 };
55 //---------------------------------------------------------------------------
56 
59  "and set the desired strategy.") VTKFILTERSFLOWPATHS_EXPORT vtkCachingInterpolatedVelocityField
60  : public vtkFunctionSet
61 {
62 public:
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 
109  void ClearLastCellInfo();
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 
130 protected:
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]);
163  bool InterpolatePoint(vtkPointData* outPD, vtkIdType outIndex);
164  bool InterpolatePoint(
166  vtkGenericCell* GetLastCell();
168 
169 private:
171  void operator=(const vtkCachingInterpolatedVelocityField&) = delete;
172 };
173 
174 //---------------------------------------------------------------------------
175 
177 // IVFDataSetInfo
179 #ifndef DOXYGEN_SHOULD_SKIP_THIS
180 //
181 
182 //
183 class IVFDataSetInfo
184 {
185 public:
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 
209 VTK_ABI_NAMESPACE_END
210 #endif
211 
212 // VTK-HeaderTest-Exclude: vtkCachingInterpolatedVelocityField.h
A helper class for interpolating between times during particle tracing.
represent and manipulate point attribute data
Definition: vtkPointData.h:29
abstract class to specify dataset behavior
Definition: vtkDataSet.h:52
#define VTK_DEPRECATED_IN_9_2_0(reason)
an abstract base class for locators which find cells
Interface for obtaining interpolated velocity values.
An abstract class for obtaining the interpolated velocity values at a point.
int vtkIdType
Definition: vtkType.h:315
provides thread-safe access to cells
void SelectVectors(const char *fieldName)
If you want to work with an arbitrary vector array, then set its name here.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:28
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
std::map< std::string, DataArray > DataSet
key: variable name, value: DataArray
Definition: VTXTypes.h:28
Abstract interface for sets of functions.
virtual int FunctionValues(double *x, double *f)
Evaluate functions at x_j.
bool InterpolatePoint(vtkPointData *outPD1, vtkPointData *outPD2, vtkIdType outIndex)
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...