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 "vtkFunctionSet.h" 00050 #include "vtkSmartPointer.h" // because it is good 00051 //BTX 00052 #include <vector> // Because they are good 00053 //ETX 00054 00055 #define ID_INSIDE_ALL 00 00056 #define ID_OUTSIDE_ALL 01 00057 #define ID_OUTSIDE_T0 02 00058 #define ID_OUTSIDE_T1 03 00059 00060 class vtkDataSet; 00061 class vtkDataArray; 00062 class vtkPointData; 00063 class vtkGenericCell; 00064 class vtkDoubleArray; 00065 class vtkCachingInterpolatedVelocityField; 00066 00067 class VTK_PARALLEL_EXPORT vtkTemporalInterpolatedVelocityField : public vtkFunctionSet 00068 { 00069 public: 00070 vtkTypeMacro(vtkTemporalInterpolatedVelocityField,vtkFunctionSet); 00071 virtual void PrintSelf(ostream& os, vtkIndent indent); 00072 00075 static vtkTemporalInterpolatedVelocityField *New(); 00076 00078 00080 virtual int FunctionValues(double* x, double* u); 00081 int FunctionValuesAtT(int T, double* x, double* u); 00083 00085 00088 void SelectVectors(const char *fieldName) 00089 {this->SetVectorsSelection(fieldName);} 00091 00094 void SetDataSetAtTime(int I, int N, double T, vtkDataSet* dataset, bool staticdataset); 00095 00097 00100 bool GetCachedCellIds(vtkIdType id[2], int ds[2]); 00101 void SetCachedCellIds(vtkIdType id[2], int ds[2]); 00103 00106 void ClearCache(); 00107 00109 00111 int TestPoint(double* x); 00112 int QuickTestPoint(double* x); 00114 00116 00118 vtkGetVector3Macro(LastGoodVelocity,double); 00120 00122 00124 vtkGetMacro(CurrentWeight,double); 00126 00127 bool InterpolatePoint(vtkPointData *outPD1, 00128 vtkPointData *outPD2, vtkIdType outIndex); 00129 00130 bool InterpolatePoint(int T, vtkPointData *outPD1, vtkIdType outIndex); 00131 00132 bool GetVorticityData( 00133 int T, double pcoords[3], double *weights, 00134 vtkGenericCell *&cell, vtkDoubleArray *cellVectors); 00135 00136 void ShowCacheResults(); 00137 bool IsStatic(int datasetIndex); 00138 00139 void AdvanceOneTimeStep(); 00140 00141 protected: 00142 vtkTemporalInterpolatedVelocityField(); 00143 ~vtkTemporalInterpolatedVelocityField(); 00144 00145 int FunctionValues(vtkDataSet* ds, double* x, double* f); 00146 virtual void SetVectorsSelection(const char *v); 00147 00148 double vals1[3]; 00149 double vals2[3]; 00150 double times[2]; 00151 double LastGoodVelocity[3]; 00152 00153 // The weight (0.0->1.0) of the value of T between the two avaiable 00154 // time values for the current computation 00155 double CurrentWeight; 00156 // One minus the CurrentWeight 00157 double OneMinusWeight; 00158 // A scaling factor used when calculating the CurrentWeight { 1.0/(T2-T1) } 00159 double ScaleCoeff; 00160 //BTX 00161 vtkSmartPointer<vtkCachingInterpolatedVelocityField> ivf[2]; 00162 // we want to keep track of static datasets so we can optimize caching 00163 std::vector<bool> StaticDataSets; 00164 //ETX 00165 private: 00166 // Hide this since we need multiple time steps and are using a different 00167 // function prototype 00168 virtual void AddDataSet(vtkDataSet*) {}; 00169 00170 private: 00171 vtkTemporalInterpolatedVelocityField(const vtkTemporalInterpolatedVelocityField&); // Not implemented. 00172 void operator=(const vtkTemporalInterpolatedVelocityField&); // Not implemented. 00173 }; 00174 00175 #endif