VTK  9.0.1
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 //---------------------------------------------------------------------------
66 
67 class VTKFILTERSFLOWPATHS_EXPORT vtkCachingInterpolatedVelocityField : public vtkFunctionSet
68 {
69 public:
71  void PrintSelf(ostream& os, vtkIndent indent) override;
72 
78 
79  using Superclass::FunctionValues;
81 
85  int FunctionValues(double* x, double* f) override;
86  virtual int InsideTest(double* x);
88 
92  virtual void SetDataSet(
93  int I, vtkDataSet* dataset, bool staticdataset, vtkAbstractCellLocator* locator);
94 
96 
101  vtkGetStringMacro(VectorsSelection);
102  void SelectVectors(const char* fieldName) { this->SetVectorsSelection(fieldName); }
104 
110  void SetLastCellInfo(vtkIdType c, int datasetindex);
111 
116  void ClearLastCellInfo();
117 
119 
124  int GetLastWeights(double* w);
125  int GetLastLocalCoordinates(double pcoords[3]);
127 
129 
132  vtkGetMacro(CellCacheHit, int);
133  vtkGetMacro(DataSetCacheHit, int);
134  vtkGetMacro(CacheMiss, int);
136 
137 protected:
140 
147  IVFDataSetInfo* Cache;
150 
151  std::vector<double> Weights;
152 
153  vtkSetStringMacro(VectorsSelection);
154 
155  // private versions which work on the passed dataset/cache
156  // these do the real computation
157  int FunctionValues(IVFDataSetInfo* cache, double* x, double* f);
158  int InsideTest(IVFDataSetInfo* cache, double* x);
159 
162 
169  void FastCompute(IVFDataSetInfo* cache, double f[3]);
170  bool InterpolatePoint(vtkPointData* outPD, vtkIdType outIndex);
171  bool InterpolatePoint(
173  vtkGenericCell* GetLastCell();
175 
176 private:
178  void operator=(const vtkCachingInterpolatedVelocityField&) = delete;
179 };
180 
181 //---------------------------------------------------------------------------
182 
184 // IVFDataSetInfo
186 #ifndef DOXYGEN_SHOULD_SKIP_THIS
187 //
188 
189 //
190 class IVFDataSetInfo
191 {
192 public:
196  double PCoords[3];
197  float* VelocityFloat;
198  double* VelocityDouble;
199  double Tolerance;
200  bool StaticDataSet;
201  IVFDataSetInfo();
202  IVFDataSetInfo(const IVFDataSetInfo& ivfci);
203  IVFDataSetInfo& operator=(const IVFDataSetInfo& ivfci);
204  void SetDataSet(
205  vtkDataSet* data, char* velocity, bool staticdataset, vtkAbstractCellLocator* locator);
206  //
207  static const double TOLERANCE_SCALE;
208 };
209 
210 //
211 
212 //
213 
214 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
215 
216 #endif
vtkCachingInterpolatedVelocityField::CacheList
IVFCacheList CacheList
Definition: vtkCachingInterpolatedVelocityField.h:148
vtx::types::DataSet
std::map< std::string, DataArray > DataSet
key: variable name, value: DataArray
Definition: VTXTypes.h:39
vtkX3D::vector
@ vector
Definition: vtkX3D.h:243
vtkFunctionSet
Abstract interface for sets of functions.
Definition: vtkFunctionSet.h:35
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:31
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkX3D::data
@ data
Definition: vtkX3D.h:321
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkCachingInterpolatedVelocityField::SelectVectors
void SelectVectors(const char *fieldName)
Definition: vtkCachingInterpolatedVelocityField.h:102
vtkTemporalInterpolatedVelocityField::InterpolatePoint
bool InterpolatePoint(vtkPointData *outPD1, vtkPointData *outPD2, vtkIdType outIndex)
vtkSmartPointer< vtkDataSet >
vtkFunctionSet.h
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
vtkCachingInterpolatedVelocityField::Weights
std::vector< double > Weights
Definition: vtkCachingInterpolatedVelocityField.h:151
vtkFunctionSet::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkCachingInterpolatedVelocityField::LastCellId
int LastCellId
Definition: vtkCachingInterpolatedVelocityField.h:146
vtkCachingInterpolatedVelocityField
Interface for obtaining interpolated velocity values.
Definition: vtkCachingInterpolatedVelocityField.h:67
vtkCachingInterpolatedVelocityField::Cache
IVFDataSetInfo * Cache
Definition: vtkCachingInterpolatedVelocityField.h:147
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkSmartPointer.h
vtkCachingInterpolatedVelocityField::VectorsSelection
char * VectorsSelection
Definition: vtkCachingInterpolatedVelocityField.h:149
IVFCacheList
Definition: vtkCachingInterpolatedVelocityField.h:62
vtkCachingInterpolatedVelocityField::CacheMiss
int CacheMiss
Definition: vtkCachingInterpolatedVelocityField.h:144
vtkCachingInterpolatedVelocityField::DataSetCacheHit
int DataSetCacheHit
Definition: vtkCachingInterpolatedVelocityField.h:143
vtkFunctionSet::FunctionValues
virtual int FunctionValues(double *x, double *f)
Evaluate functions at x_j.
Definition: vtkFunctionSet.h:49
vtkCachingInterpolatedVelocityField::CellCacheHit
int CellCacheHit
Definition: vtkCachingInterpolatedVelocityField.h:142
vtkAbstractCellLocator
an abstract base class for locators which find cells
Definition: vtkAbstractCellLocator.h:48
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
vtkCachingInterpolatedVelocityField::LastCacheIndex
int LastCacheIndex
Definition: vtkCachingInterpolatedVelocityField.h:145
vtkCachingInterpolatedVelocityField::TempCell
vtkGenericCell * TempCell
Definition: vtkCachingInterpolatedVelocityField.h:141
vtkTemporalInterpolatedVelocityField
A helper class for interpolating between times during particle tracing.
Definition: vtkTemporalInterpolatedVelocityField.h:69
vtkGenericCell
provides thread-safe access to cells
Definition: vtkGenericCell.h:36