VTK  9.2.6
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 
54 class vtkDataSet;
55 class vtkDataArray;
56 class vtkPointData;
57 class vtkGenericCell;
59 
60 //---------------------------------------------------------------------------
61 class IVFDataSetInfo;
62 //---------------------------------------------------------------------------
63 class IVFCacheList : public std::vector<IVFDataSetInfo>
64 {
65 };
66 //---------------------------------------------------------------------------
67 
70  "and set the desired strategy.") VTKFILTERSFLOWPATHS_EXPORT vtkCachingInterpolatedVelocityField
71  : public vtkFunctionSet
72 {
73 public:
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 
120  void ClearLastCellInfo();
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 
141 protected:
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]);
174  bool InterpolatePoint(vtkPointData* outPD, vtkIdType outIndex);
175  bool InterpolatePoint(
177  vtkGenericCell* GetLastCell();
179 
180 private:
182  void operator=(const vtkCachingInterpolatedVelocityField&) = delete;
183 };
184 
185 //---------------------------------------------------------------------------
186 
188 // IVFDataSetInfo
190 #ifndef DOXYGEN_SHOULD_SKIP_THIS
191 //
192 
193 //
194 class IVFDataSetInfo
195 {
196 public:
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
A helper class for interpolating between times during particle tracing.
represent and manipulate point attribute data
Definition: vtkPointData.h:41
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
#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:332
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:39
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
std::map< std::string, DataArray > DataSet
key: variable name, value: DataArray
Definition: VTXTypes.h:39
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...