00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00043 #ifndef __vtkTInterpolatedVelocityField_h
00044 #define __vtkTInterpolatedVelocityField_h
00045
00046 #include "vtkFunctionSet.h"
00047 #include "vtkSmartPointer.h"
00048
00049 #include <vtkstd/vector>
00050
00051
00052 class vtkDataSet;
00053 class vtkDataArray;
00054 class vtkPointData;
00055 class vtkGenericCell;
00056 class vtkAbstractCellLocator;
00057
00058
00059 class IVFDataSetInfo;
00060
00061 class IVFCacheList : public vtkstd::vector< IVFDataSetInfo > {};
00062
00063
00064 class VTK_PARALLEL_EXPORT vtkCachingInterpolatedVelocityField : public vtkFunctionSet
00065 {
00066 public:
00067 vtkTypeMacro(vtkCachingInterpolatedVelocityField,vtkFunctionSet);
00068 virtual void PrintSelf(ostream& os, vtkIndent indent);
00069
00072 static vtkCachingInterpolatedVelocityField *New();
00073
00075
00077 virtual int FunctionValues(double* x, double* f);
00078 virtual int InsideTest(double* x);
00080
00082 virtual void SetDataSet(int I, vtkDataSet* dataset, bool staticdataset, vtkAbstractCellLocator *locator);
00083
00085
00088 vtkGetStringMacro(VectorsSelection);
00089 void SelectVectors(const char *fieldName)
00090 {this->SetVectorsSelection(fieldName);}
00092
00094 void SetLastCellInfo(vtkIdType c, int datasetindex);
00095
00098 void ClearLastCellInfo();
00099
00101
00104 int GetLastWeights(double* w);
00105 int GetLastLocalCoordinates(double pcoords[3]);
00107
00109
00110 vtkGetMacro(CellCacheHit, int);
00111 vtkGetMacro(DataSetCacheHit, int);
00112 vtkGetMacro(CacheMiss, int);
00114
00115 protected:
00116 vtkCachingInterpolatedVelocityField();
00117 ~vtkCachingInterpolatedVelocityField();
00118
00119 vtkGenericCell *TempCell;
00120 int CellCacheHit;
00121 int DataSetCacheHit;
00122 int CacheMiss;
00123 int LastCacheIndex;
00124 int LastCellId;
00125 IVFDataSetInfo *Cache;
00126 IVFCacheList CacheList;
00127 char *VectorsSelection;
00128
00129 vtkstd::vector<double> Weights;
00130
00131
00132 vtkSetStringMacro(VectorsSelection);
00133
00134
00135
00136 int FunctionValues(IVFDataSetInfo *cache, double *x, double *f);
00137 int InsideTest(IVFDataSetInfo *cache, double* x);
00138
00139
00140 friend class vtkTemporalInterpolatedVelocityField;
00142
00146 void FastCompute(IVFDataSetInfo *cache, double f[3]);
00147 bool InterpolatePoint(vtkPointData *outPD, vtkIdType outIndex);
00148 vtkGenericCell *GetLastCell();
00149
00151
00152 private:
00153 vtkCachingInterpolatedVelocityField(const vtkCachingInterpolatedVelocityField&);
00154 void operator=(const vtkCachingInterpolatedVelocityField&);
00155 };
00156
00157
00158
00160
00162 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00163
00164
00165
00166 class IVFDataSetInfo
00167 {
00168 public:
00169 vtkSmartPointer<vtkDataSet> DataSet;
00170 vtkSmartPointer<vtkAbstractCellLocator> BSPTree;
00171 vtkSmartPointer<vtkGenericCell> Cell;
00172 double PCoords[3];
00173 float *VelocityFloat;
00174 double *VelocityDouble;
00175 double Tolerance;
00176 bool StaticDataSet;
00177 IVFDataSetInfo();
00178 IVFDataSetInfo(const IVFDataSetInfo &ivfci);
00179 IVFDataSetInfo &operator=(const IVFDataSetInfo &ivfci);
00180 void SetDataSet(vtkDataSet *data, char *velocity, bool staticdataset, vtkAbstractCellLocator *locator);
00181
00182 static const double TOLERANCE_SCALE;
00183 };
00184
00185
00186
00187
00188
00189 #endif
00190
00191 #endif