VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkCachingInterpolatedVelocityField.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00043 #ifndef __vtkTInterpolatedVelocityField_h 00044 #define __vtkTInterpolatedVelocityField_h 00045 00046 #include "vtkFunctionSet.h" 00047 #include "vtkSmartPointer.h" // this is allowed 00048 //BTX 00049 #include <vector> // we need them 00050 //ETX 00051 00052 class vtkDataSet; 00053 class vtkDataArray; 00054 class vtkPointData; 00055 class vtkGenericCell; 00056 class vtkAbstractCellLocator; 00057 //BTX 00058 //--------------------------------------------------------------------------- 00059 class IVFDataSetInfo; 00060 //--------------------------------------------------------------------------- 00061 class IVFCacheList : public std::vector< IVFDataSetInfo > {}; 00062 //--------------------------------------------------------------------------- 00063 //ETX 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 //BTX 00129 std::vector<double> Weights; 00130 //ETX 00131 00132 vtkSetStringMacro(VectorsSelection); 00133 00134 // private versions which work on the passed dataset/cache 00135 // these do the real computation 00136 int FunctionValues(IVFDataSetInfo *cache, double *x, double *f); 00137 int InsideTest(IVFDataSetInfo *cache, double* x); 00138 00139 //BTX 00140 friend class vtkTemporalInterpolatedVelocityField; 00142 00146 void FastCompute(IVFDataSetInfo *cache, double f[3]); 00147 bool InterpolatePoint(vtkPointData *outPD, vtkIdType outIndex); 00148 vtkGenericCell *GetLastCell(); 00149 //ETX 00151 00152 private: 00153 vtkCachingInterpolatedVelocityField(const vtkCachingInterpolatedVelocityField&); // Not implemented. 00154 void operator=(const vtkCachingInterpolatedVelocityField&); // Not implemented. 00155 }; 00156 00157 //--------------------------------------------------------------------------- 00158 00160 // IVFDataSetInfo 00162 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00163 // 00164 //BTX 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 //ETX 00187 // 00188 00189 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 00190 00191 #endif