VTK
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 "vtkFunctionSet.h"
50 #include "vtkSmartPointer.h" // because it is good
51 //BTX
52 #include <vtkstd/vector> // Because they are good
53 //ETX
54 
55 #define ID_INSIDE_ALL 00
56 #define ID_OUTSIDE_ALL 01
57 #define ID_OUTSIDE_T0 02
58 #define ID_OUTSIDE_T1 03
59 
60 class vtkDataSet;
61 class vtkDataArray;
62 class vtkPointData;
63 class vtkGenericCell;
64 class vtkDoubleArray;
66 
68 {
69 public:
71  virtual void PrintSelf(ostream& os, vtkIndent indent);
72 
76 
78 
80  virtual int FunctionValues(double* x, double* u);
81  int FunctionValuesAtT(int T, double* x, double* u);
83 
85 
88  void SelectVectors(const char *fieldName)
89  {this->SetVectorsSelection(fieldName);}
91 
94  void SetDataSetAtTime(int I, int N, double T, vtkDataSet* dataset, bool staticdataset);
95 
97 
100  bool GetCachedCellIds(vtkIdType id[2], int ds[2]);
101  void SetCachedCellIds(vtkIdType id[2], int ds[2]);
103 
106  void ClearCache();
107 
109 
111  int TestPoint(double* x);
112  int QuickTestPoint(double* x);
114 
116 
118  vtkGetVector3Macro(LastGoodVelocity,double);
120 
122 
124  vtkGetMacro(CurrentWeight,double);
126 
127  bool InterpolatePoint(vtkPointData *outPD1,
128  vtkPointData *outPD2, vtkIdType outIndex);
129 
130  bool InterpolatePoint(int T, vtkPointData *outPD1, vtkIdType outIndex);
131 
132  bool GetVorticityData(
133  int T, double pcoords[3], double *weights,
134  vtkGenericCell *&cell, vtkDoubleArray *cellVectors);
135 
136  void ShowCacheResults();
137  bool IsStatic(int datasetIndex);
138 
139  void AdvanceOneTimeStep();
140 
141 protected:
144 
145  int FunctionValues(vtkDataSet* ds, double* x, double* f);
146  virtual void SetVectorsSelection(const char *v);
147 
148  double vals1[3];
149  double vals2[3];
150  double times[2];
151  double LastGoodVelocity[3];
152 
153  // The weight (0.0->1.0) of the value of T between the two avaiable
154  // time values for the current computation
156  // One minus the CurrentWeight
158  // A scaling factor used when calculating the CurrentWeight { 1.0/(T2-T1) }
159  double ScaleCoeff;
160 //BTX
162  // we want to keep track of static datasets so we can optimize caching
163  vtkstd::vector<bool> StaticDataSets;
164 //ETX
165 private:
166  // Hide this since we need multiple time steps and are using a different
167  // function prototype
168  virtual void AddDataSet(vtkDataSet*) {};
169 
170 private:
172  void operator=(const vtkTemporalInterpolatedVelocityField&); // Not implemented.
173 };
174 
175 #endif