VTK  9.2.6
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 "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
51 #include "vtkFiltersFlowPathsModule.h" // For export macro
52 #include "vtkFunctionSet.h"
53 #include "vtkSmartPointer.h" // For vtkSmartPointer
54 
55 #include <vector> // For internal structures
56 
60 class vtkDataArray;
61 class vtkDataSet;
62 class vtkDoubleArray;
64 class vtkGenericCell;
65 class vtkLocator;
66 class vtkPointData;
67 
68 class VTKFILTERSFLOWPATHS_EXPORT vtkTemporalInterpolatedVelocityField : public vtkFunctionSet
69 {
70 public:
72  void PrintSelf(ostream& os, vtkIndent indent) override;
73 
79 
83  enum IDStates
84  {
85  INSIDE_ALL = 0,
86  OUTSIDE_ALL = 1,
87  OUTSIDE_T0 = 2,
88  OUTSIDE_T1 = 3
89  };
90 
95  {
96  DIFFERENT = 0,
97  STATIC = 1,
98  LINEAR_TRANSFORMATION = 2,
99  SAME_TOPOLOGY = 3
100  };
101 
103  /*
104  * Set/Get the type of variance of the mesh over time.
105  *
106  * DIFFERENT = 0,
107  * STATIC = 1,
108  * LINEAR_TRANSFORMATION = 2
109  * SAME_TOPOLOGY = 3
110  */
111  vtkSetClampMacro(MeshOverTime, int, DIFFERENT, SAME_TOPOLOGY);
112  void SetMeshOverTimeToDifferent() { this->SetMeshOverTime(DIFFERENT); }
113  void SetMeshOverTimeToStatic() { this->SetMeshOverTime(STATIC); }
114  void SetMeshOverTimeToLinearTransformation() { this->SetMeshOverTime(LINEAR_TRANSFORMATION); }
115  void SetMeshOverTimeToSameTopology() { this->SetMeshOverTime(SAME_TOPOLOGY); }
116  vtkGetMacro(MeshOverTime, int);
118 
126  void Initialize(vtkCompositeDataSet* t0, vtkCompositeDataSet* t1);
127 
134  virtual void CopyParameters(vtkTemporalInterpolatedVelocityField* from);
135 
136  using Superclass::FunctionValues;
138 
142  int FunctionValues(double* x, double* u) override;
143  int FunctionValuesAtT(int T, double* x, double* u);
145 
151  void SelectVectors(const char* fieldName) { this->SetVectorsSelection(fieldName); }
152 
154 
159  void AddDataSetAtTime(int N, double T, vtkDataSet* dataset);
160  VTK_DEPRECATED_IN_9_2_0("Use AddDataSetAtTime and SetMeshOverTime instead")
161  void SetDataSetAtTime(int, int, double, vtkDataSet*, bool) {}
163 
165 
170  bool GetCachedCellIds(vtkIdType id[2], int ds[2]);
171  void SetCachedCellIds(vtkIdType id[2], int ds[2]);
173 
178  void ClearCache();
179 
181 
185  int TestPoint(double* x);
186  int QuickTestPoint(double* x);
188 
190 
194  vtkGetVector3Macro(LastGoodVelocity, double);
196 
198 
201  vtkGetMacro(CurrentWeight, double);
203 
204  bool InterpolatePoint(vtkPointData* outPD1, vtkPointData* outPD2, vtkIdType outIndex);
205 
206  bool InterpolatePoint(int T, vtkPointData* outPD1, vtkIdType outIndex);
207 
208  bool GetVorticityData(
209  int T, double pcoords[3], double* weights, vtkGenericCell*& cell, vtkDoubleArray* cellVectors);
210 
211  void ShowCacheResults();
212  VTK_DEPRECATED_IN_9_2_0("Use GetMeshOverTime() instead.")
213  bool IsStatic(int) { return this->MeshOverTime == STATIC; }
214 
215  void AdvanceOneTimeStep();
216 
218 
224  virtual void SetFindCellStrategy(vtkFindCellStrategy*);
225  vtkGetObjectMacro(FindCellStrategy, vtkFindCellStrategy);
227 
228 protected:
231 
232  virtual void SetVectorsSelection(const char* v);
233 
234  int MeshOverTime = MeshOverTimeTypes::DIFFERENT;
235 
236  void InitializeWithLocators(vtkCompositeInterpolatedVelocityField* ivf,
237  const std::vector<vtkDataSet*>& datasets, vtkFindCellStrategy* strategy,
238  const std::vector<vtkSmartPointer<vtkLocator>>& locators,
240 
241  void CreateLocators(const std::vector<vtkDataSet*>& datasets, vtkFindCellStrategy* strategy,
243  void CreateLinks(const std::vector<vtkDataSet*>& datasets,
245  void CreateLinearTransformCellLocators(const std::vector<vtkSmartPointer<vtkLocator>>& locators,
246  std::vector<vtkSmartPointer<vtkLocator>>& linearCellLocators);
247 
248  double Vals1[3];
249  double Vals2[3];
250  double Times[2];
251  double LastGoodVelocity[3];
252 
253  static const double WEIGHT_TO_TOLERANCE;
254 
255  // The weight (0.0->1.0) of the value of T between the two available
256  // time values for the current computation
258  // One minus the CurrentWeight
260  // A scaling factor used when calculating the CurrentWeight { 1.0/(T2-T1) }
261  double ScaleCoeff;
262 
264  std::vector<vtkSmartPointer<vtkLocator>> Locators[2];
265  std::vector<vtkSmartPointer<vtkLocator>> InitialCellLocators;
266  std::vector<vtkSmartPointer<vtkAbstractCellLinks>> Links[2];
267  std::vector<size_t> MaxCellSizes[2];
268 
270 
271 private:
272  // Hide this since we need multiple time steps and are using a different
273  // function prototype
274  virtual void AddDataSet(vtkDataSet*) {}
275 
276 private:
278  void operator=(const vtkTemporalInterpolatedVelocityField&) = delete;
279 };
280 
281 #endif
A helper class for interpolating between times during particle tracing.
represent and manipulate point attribute data
Definition: vtkPointData.h:41
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
MeshOverTimeTypes
Types of Variance of Mesh over time.
#define VTK_DEPRECATED_IN_9_2_0(reason)
IDStates
States that define where the cell id are.
abstract base class for objects that accelerate spatial searches
Definition: vtkLocator.h:69
std::vector< vtkSmartPointer< vtkLocator > > InitialCellLocators
An abstract class for obtaining the interpolated velocity values at a point.
Hold a reference to a vtkObjectBase instance.
Definition: vtkMeta.h:32
int vtkIdType
Definition: vtkType.h:332
provides thread-safe access to cells
dynamic, self-adjusting array of double
helper class to manage the vtkPointSet::FindCell() METHOD
void SelectVectors(const char *fieldName)
If you want to work with an arbitrary vector array, then set its name here.
abstract superclass for composite (multi-block or AMR) datasets
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:55
Abstract interface for sets of functions.
virtual int FunctionValues(double *x, double *f)
Evaluate functions at x_j.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...