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 =========================================================================*/
47 #ifndef vtkTemporalInterpolatedVelocityField_h
48 #define vtkTemporalInterpolatedVelocityField_h
49 
50 #include "vtkFiltersFlowPathsModule.h" // For export macro
51 #include "vtkFunctionSet.h"
52 #include "vtkSmartPointer.h" // because it is good
53 
54 #include <vector> // Because they are good
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:
72  void PrintSelf(ostream& os, vtkIndent indent) override;
73 
79 
81 
85  int FunctionValues(double* x, double* u) override;
86  int FunctionValuesAtT(int T, double* x, double* u);
88 
94  void SelectVectors(const char *fieldName)
95  {this->SetVectorsSelection(fieldName);}
96 
102  void SetDataSetAtTime(int I, int N, double T, vtkDataSet* dataset, bool staticdataset);
103 
105 
110  bool GetCachedCellIds(vtkIdType id[2], int ds[2]);
111  void SetCachedCellIds(vtkIdType id[2], int ds[2]);
113 
118  void ClearCache();
119 
121 
125  int TestPoint(double* x);
126  int QuickTestPoint(double* x);
128 
130 
134  vtkGetVector3Macro(LastGoodVelocity,double);
136 
138 
141  vtkGetMacro(CurrentWeight,double);
143 
144  bool InterpolatePoint(vtkPointData *outPD1,
145  vtkPointData *outPD2, vtkIdType outIndex);
146 
147  bool InterpolatePoint(int T, vtkPointData *outPD1, vtkIdType outIndex);
148 
149  bool GetVorticityData(
150  int T, double pcoords[3], double *weights,
151  vtkGenericCell *&cell, vtkDoubleArray *cellVectors);
152 
153  void ShowCacheResults();
154  bool IsStatic(int datasetIndex);
155 
156  void AdvanceOneTimeStep();
157 
158 protected:
161 
162  int FunctionValues(vtkDataSet* ds, double* x, double* f);
163  virtual void SetVectorsSelection(const char *v);
164 
165  double Vals1[3];
166  double Vals2[3];
167  double Times[2];
168  double LastGoodVelocity[3];
169 
170  // The weight (0.0->1.0) of the value of T between the two available
171  // time values for the current computation
173  // One minus the CurrentWeight
175  // A scaling factor used when calculating the CurrentWeight { 1.0/(T2-T1) }
176  double ScaleCoeff;
177 
179  // we want to keep track of static datasets so we can optimize caching
180  std::vector<bool> StaticDataSets;
181 
182 private:
183  // Hide this since we need multiple time steps and are using a different
184  // function prototype
185  virtual void AddDataSet(vtkDataSet*) {}
186 
187 private:
189  void operator=(const vtkTemporalInterpolatedVelocityField&) = delete;
190 };
191 
192 #endif
A helper class for interpolating between times during particle tracing.
represent and manipulate point attribute data
Definition: vtkPointData.h:37
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
Interface for obtaining interpolated velocity values.
int vtkIdType
Definition: vtkType.h:347
virtual int FunctionValues(double *x, double *f)=0
Evaluate functions at x_j.
provides thread-safe access to cells
dynamic, self-adjusting array of double
void SelectVectors(const char *fieldName)
If you want to work with an arbitrary vector array, then set its name here.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:39
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
Abstract interface for sets of functions.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...