VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkTemporalInterpolatedVelocityField.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 =========================================================================*/ 00046 #ifndef vtkTemporalInterpolatedVelocityField_h 00047 #define vtkTemporalInterpolatedVelocityField_h 00048 00049 #include "vtkFiltersFlowPathsModule.h" // For export macro 00050 #include "vtkFunctionSet.h" 00051 #include "vtkSmartPointer.h" // because it is good 00052 //BTX 00053 #include <vector> // Because they are good 00054 //ETX 00055 00056 #define ID_INSIDE_ALL 00 00057 #define ID_OUTSIDE_ALL 01 00058 #define ID_OUTSIDE_T0 02 00059 #define ID_OUTSIDE_T1 03 00060 00061 class vtkDataSet; 00062 class vtkDataArray; 00063 class vtkPointData; 00064 class vtkGenericCell; 00065 class vtkDoubleArray; 00066 class vtkCachingInterpolatedVelocityField; 00067 00068 class VTKFILTERSFLOWPATHS_EXPORT vtkTemporalInterpolatedVelocityField : public vtkFunctionSet 00069 { 00070 public: 00071 vtkTypeMacro(vtkTemporalInterpolatedVelocityField,vtkFunctionSet); 00072 virtual void PrintSelf(ostream& os, vtkIndent indent); 00073 00076 static vtkTemporalInterpolatedVelocityField *New(); 00077 00079 00081 virtual int FunctionValues(double* x, double* u); 00082 int FunctionValuesAtT(int T, double* x, double* u); 00084 00086 00089 void SelectVectors(const char *fieldName) 00090 {this->SetVectorsSelection(fieldName);} 00092 00095 void SetDataSetAtTime(int I, int N, double T, vtkDataSet* dataset, bool staticdataset); 00096 00098 00101 bool GetCachedCellIds(vtkIdType id[2], int ds[2]); 00102 void SetCachedCellIds(vtkIdType id[2], int ds[2]); 00104 00107 void ClearCache(); 00108 00110 00112 int TestPoint(double* x); 00113 int QuickTestPoint(double* x); 00115 00117 00119 vtkGetVector3Macro(LastGoodVelocity,double); 00121 00123 00125 vtkGetMacro(CurrentWeight,double); 00127 00128 bool InterpolatePoint(vtkPointData *outPD1, 00129 vtkPointData *outPD2, vtkIdType outIndex); 00130 00131 bool InterpolatePoint(int T, vtkPointData *outPD1, vtkIdType outIndex); 00132 00133 bool GetVorticityData( 00134 int T, double pcoords[3], double *weights, 00135 vtkGenericCell *&cell, vtkDoubleArray *cellVectors); 00136 00137 void ShowCacheResults(); 00138 bool IsStatic(int datasetIndex); 00139 00140 void AdvanceOneTimeStep(); 00141 00142 protected: 00143 vtkTemporalInterpolatedVelocityField(); 00144 ~vtkTemporalInterpolatedVelocityField(); 00145 00146 int FunctionValues(vtkDataSet* ds, double* x, double* f); 00147 virtual void SetVectorsSelection(const char *v); 00148 00149 double vals1[3]; 00150 double vals2[3]; 00151 double times[2]; 00152 double LastGoodVelocity[3]; 00153 00154 // The weight (0.0->1.0) of the value of T between the two avaiable 00155 // time values for the current computation 00156 double CurrentWeight; 00157 // One minus the CurrentWeight 00158 double OneMinusWeight; 00159 // A scaling factor used when calculating the CurrentWeight { 1.0/(T2-T1) } 00160 double ScaleCoeff; 00161 //BTX 00162 vtkSmartPointer<vtkCachingInterpolatedVelocityField> ivf[2]; 00163 // we want to keep track of static datasets so we can optimize caching 00164 std::vector<bool> StaticDataSets; 00165 //ETX 00166 private: 00167 // Hide this since we need multiple time steps and are using a different 00168 // function prototype 00169 virtual void AddDataSet(vtkDataSet*) {} 00170 00171 private: 00172 vtkTemporalInterpolatedVelocityField(const vtkTemporalInterpolatedVelocityField&); // Not implemented. 00173 void operator=(const vtkTemporalInterpolatedVelocityField&); // Not implemented. 00174 }; 00175 00176 #endif