VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vtkTemporalInterpolatedVelocityField.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkTemporalInterpolatedVelocityField.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
46 #ifndef __vtkTemporalInterpolatedVelocityField_h
47 #define __vtkTemporalInterpolatedVelocityField_h
48 
49 #include "vtkFiltersFlowPathsModule.h" // For export macro
50 #include "vtkFunctionSet.h"
51 #include "vtkSmartPointer.h" // because it is good
52 //BTX
53 #include <vector> // Because they are good
54 //ETX
55 
56 #define ID_INSIDE_ALL 00
57 #define ID_OUTSIDE_ALL 01
58 #define ID_OUTSIDE_T0 02
59 #define ID_OUTSIDE_T1 03
60 
61 class vtkDataSet;
62 class vtkDataArray;
63 class vtkPointData;
64 class vtkGenericCell;
65 class vtkDoubleArray;
67 
68 class VTKFILTERSFLOWPATHS_EXPORT vtkTemporalInterpolatedVelocityField : public vtkFunctionSet
69 {
70 public:
71  vtkTypeMacro(vtkTemporalInterpolatedVelocityField,vtkFunctionSet);
72  virtual void PrintSelf(ostream& os, vtkIndent indent);
73 
77 
79 
81  virtual int FunctionValues(double* x, double* u);
82  int FunctionValuesAtT(int T, double* x, double* u);
84 
86 
89  void SelectVectors(const char *fieldName)
90  {this->SetVectorsSelection(fieldName);}
92 
95  void SetDataSetAtTime(int I, int N, double T, vtkDataSet* dataset, bool staticdataset);
96 
98 
101  bool GetCachedCellIds(vtkIdType id[2], int ds[2]);
102  void SetCachedCellIds(vtkIdType id[2], int ds[2]);
104 
107  void ClearCache();
108 
110 
112  int TestPoint(double* x);
113  int QuickTestPoint(double* x);
115 
117 
119  vtkGetVector3Macro(LastGoodVelocity,double);
121 
123 
125  vtkGetMacro(CurrentWeight,double);
127 
128  bool InterpolatePoint(vtkPointData *outPD1,
129  vtkPointData *outPD2, vtkIdType outIndex);
130 
131  bool InterpolatePoint(int T, vtkPointData *outPD1, vtkIdType outIndex);
132 
133  bool GetVorticityData(
134  int T, double pcoords[3], double *weights,
135  vtkGenericCell *&cell, vtkDoubleArray *cellVectors);
136 
137  void ShowCacheResults();
138  bool IsStatic(int datasetIndex);
139 
140  void AdvanceOneTimeStep();
141 
142 protected:
145 
146  int FunctionValues(vtkDataSet* ds, double* x, double* f);
147  virtual void SetVectorsSelection(const char *v);
148 
149  double vals1[3];
150  double vals2[3];
151  double times[2];
152  double LastGoodVelocity[3];
153 
154  // The weight (0.0->1.0) of the value of T between the two avaiable
155  // time values for the current computation
157  // One minus the CurrentWeight
159  // A scaling factor used when calculating the CurrentWeight { 1.0/(T2-T1) }
160  double ScaleCoeff;
161 //BTX
162  vtkSmartPointer<vtkCachingInterpolatedVelocityField> ivf[2];
163  // we want to keep track of static datasets so we can optimize caching
164  std::vector<bool> StaticDataSets;
165 //ETX
166 private:
167  // Hide this since we need multiple time steps and are using a different
168  // function prototype
169  virtual void AddDataSet(vtkDataSet*) {};
170 
171 private:
173  void operator=(const vtkTemporalInterpolatedVelocityField&); // Not implemented.
174 };
175 
176 #endif
A helper class for interpolating between times during particle tracing.
Interface for obtaining interpolated velocity values.