VTK
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 "vtkFiltersFlowPathsModule.h" // For export macro
48 #include "vtkFunctionSet.h"
49 #include "vtkSmartPointer.h" // this is allowed
50 
51 #include <vector> // we need them
52 
53 class vtkDataSet;
54 class vtkDataArray;
55 class vtkPointData;
56 class vtkGenericCell;
58 
59 //---------------------------------------------------------------------------
60 class IVFDataSetInfo;
61 //---------------------------------------------------------------------------
62 class IVFCacheList : public std::vector< IVFDataSetInfo > {};
63 //---------------------------------------------------------------------------
64 
65 class VTKFILTERSFLOWPATHS_EXPORT vtkCachingInterpolatedVelocityField : public vtkFunctionSet
66 {
67 public:
69  void PrintSelf(ostream& os, vtkIndent indent) override;
70 
76 
78 
82  int FunctionValues(double* x, double* f) override;
83  virtual int InsideTest(double* x);
85 
89  virtual void SetDataSet(int I, vtkDataSet* dataset, bool staticdataset, vtkAbstractCellLocator *locator);
90 
92 
97  vtkGetStringMacro(VectorsSelection);
98  void SelectVectors(const char *fieldName)
99  {this->SetVectorsSelection(fieldName);}
101 
107  void SetLastCellInfo(vtkIdType c, int datasetindex);
108 
113  void ClearLastCellInfo();
114 
116 
121  int GetLastWeights(double* w);
122  int GetLastLocalCoordinates(double pcoords[3]);
124 
126 
129  vtkGetMacro(CellCacheHit, int);
130  vtkGetMacro(DataSetCacheHit, int);
131  vtkGetMacro(CacheMiss, int);
133 
134 protected:
137 
144  IVFDataSetInfo *Cache;
147 
148  std::vector<double> Weights;
149 
150  vtkSetStringMacro(VectorsSelection);
151 
152  // private versions which work on the passed dataset/cache
153  // these do the real computation
154  int FunctionValues(IVFDataSetInfo *cache, double *x, double *f);
155  int InsideTest(IVFDataSetInfo *cache, double* x);
156 
159 
166  void FastCompute(IVFDataSetInfo *cache, double f[3]);
167  bool InterpolatePoint(vtkPointData *outPD, vtkIdType outIndex);
169  vtkPointData *outPD, vtkIdType outIndex);
170  vtkGenericCell *GetLastCell();
172 
173 private:
175  void operator=(const vtkCachingInterpolatedVelocityField&) = delete;
176 };
177 
178 //---------------------------------------------------------------------------
179 
181 // IVFDataSetInfo
183 #ifndef DOXYGEN_SHOULD_SKIP_THIS
184 //
185 
186 //
187 class IVFDataSetInfo
188 {
189 public:
193  double PCoords[3];
194  float *VelocityFloat;
195  double *VelocityDouble;
196  double Tolerance;
197  bool StaticDataSet;
198  IVFDataSetInfo();
199  IVFDataSetInfo(const IVFDataSetInfo &ivfci);
200  IVFDataSetInfo &operator=(const IVFDataSetInfo &ivfci);
201  void SetDataSet(vtkDataSet *data, char *velocity, bool staticdataset, vtkAbstractCellLocator *locator);
202  //
203  static const double TOLERANCE_SCALE;
204 };
205 
206 //
207 
208 //
209 
210 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
211 
212 #endif
A helper class for interpolating between times during particle tracing.
represent and manipulate point attribute data
Definition: vtkPointData.h:37
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
an abstract base class for locators which find cells
Interface for obtaining interpolated velocity values.
int vtkIdType
Definition: vtkType.h:347
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.
a simple class to control print indentation
Definition: vtkIndent.h:39
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
Abstract interface for sets of functions.
bool InterpolatePoint(vtkPointData *outPD1, vtkPointData *outPD2, vtkIdType outIndex)