VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkTemporalInterpolatedVelocityField.h,v $ 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 <vtkstd/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 vtkTypeRevisionMacro(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 00123 vtkGetMacro(CurrentWeight,double); 00125 00126 bool InterpolatePoint(vtkPointData *outPD1, 00127 vtkPointData *outPD2, vtkIdType outIndex); 00128 00129 bool InterpolatePoint(int T, vtkPointData *outPD1, vtkIdType outIndex); 00130 00131 bool GetVorticityData( 00132 int T, double pcoords[3], double *weights, 00133 vtkGenericCell *&cell, vtkDoubleArray *cellVectors); 00134 00135 void ShowCacheResults(); 00136 bool IsStatic(int datasetIndex); 00137 00138 void AdvanceOneTimeStep(); 00139 00140 protected: 00141 vtkTemporalInterpolatedVelocityField(); 00142 ~vtkTemporalInterpolatedVelocityField(); 00143 00144 int FunctionValues(vtkDataSet* ds, double* x, double* f); 00145 virtual void SetVectorsSelection(const char *v); 00146 00147 double vals1[3]; 00148 double vals2[3]; 00149 double times[2]; 00150 double LastGoodVelocity[3]; 00151 00152 // The weight (0.0->1.0) of the value of T between the two avaiable 00153 // time values for the current computation 00154 double CurrentWeight; 00155 // One minus the CurrentWeight 00156 double OneMinusWeight; 00157 // A scaling factor used when calculating the CurrentWeight { 1.0/(T2-T1) } 00158 double ScaleCoeff; 00159 //BTX 00160 vtkSmartPointer<vtkCachingInterpolatedVelocityField> ivf[2]; 00161 // we want to keep track of static datasets so we can optimize caching 00162 vtkstd::vector<bool> StaticDataSets; 00163 //ETX 00164 private: 00165 // Hide this since we need multiple time steps and are using a different 00166 // function prototype 00167 virtual void AddDataSet(vtkDataSet*) {}; 00168 00169 private: 00170 vtkTemporalInterpolatedVelocityField(const vtkTemporalInterpolatedVelocityField&); // Not implemented. 00171 void operator=(const vtkTemporalInterpolatedVelocityField&); // Not implemented. 00172 }; 00173 00174 #endif