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
53class vtkDataSet;
54class vtkDataArray;
55class vtkPointData;
56class vtkGenericCell;
58
59//---------------------------------------------------------------------------
60class IVFDataSetInfo;
61//---------------------------------------------------------------------------
62class IVFCacheList : public std::vector< IVFDataSetInfo > {};
63//---------------------------------------------------------------------------
64
65class VTKFILTERSFLOWPATHS_EXPORT vtkCachingInterpolatedVelocityField : public vtkFunctionSet
66{
67public:
69 void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
70
76
78
82 virtual int FunctionValues(double* x, double* f);
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
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
134protected:
137
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]);
169 vtkPointData *outPD, vtkIdType outIndex);
172
173private:
175 void operator=(const vtkCachingInterpolatedVelocityField&) VTK_DELETE_FUNCTION;
176};
177
178//---------------------------------------------------------------------------
179
181// IVFDataSetInfo
183#ifndef DOXYGEN_SHOULD_SKIP_THIS
184//
185
186//
188{
189public:
193 double PCoords[3];
196 double Tolerance;
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
vtkSmartPointer< vtkGenericCell > Cell
void SetDataSet(vtkDataSet *data, char *velocity, bool staticdataset, vtkAbstractCellLocator *locator)
vtkSmartPointer< vtkDataSet > DataSet
vtkSmartPointer< vtkAbstractCellLocator > BSPTree
IVFDataSetInfo(const IVFDataSetInfo &ivfci)
IVFDataSetInfo & operator=(const IVFDataSetInfo &ivfci)
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)
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)
virtual int FunctionValues(double *x, double *f)
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 NULL so that the next search does not start from the previous cell.
int GetLastLocalCoordinates(double pcoords[3])
virtual int InsideTest(double *x)
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)
static vtkCachingInterpolatedVelocityField * New()
Construct a vtkCachingInterpolatedVelocityField with no initial data set.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
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:38
A helper class for interpolating between times during particle tracing.
@ vector
Definition: vtkX3D.h:237
@ data
Definition: vtkX3D.h:315
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
int vtkIdType
Definition: vtkType.h:287