VTK  9.7.1
vtkTemporalInterpolatedVelocityField.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
35 #ifndef vtkTemporalInterpolatedVelocityField_h
36 #define vtkTemporalInterpolatedVelocityField_h
37 
38 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_7_0
39 #include "vtkFiltersFlowPathsModule.h" // For export macro
40 #include "vtkFunctionSet.h"
41 #include "vtkSmartPointer.h" // For vtkSmartPointer
42 
43 #include <vector> // For internal structures
44 
45 VTK_ABI_NAMESPACE_BEGIN
50 class vtkDataArray;
51 class vtkDataSet;
52 class vtkDoubleArray;
54 class vtkGenericCell;
55 class vtkLocator;
56 class vtkPointData;
57 
58 class VTKFILTERSFLOWPATHS_EXPORT vtkTemporalInterpolatedVelocityField : public vtkFunctionSet
59 {
60 public:
62  void PrintSelf(ostream& os, vtkIndent indent) override;
63 
69 
73  enum IDStates
74  {
75  INSIDE_ALL = 0,
76  OUTSIDE_ALL = 1,
77  OUTSIDE_T0 = 2,
78  OUTSIDE_T1 = 3
79  };
80 
85  {
86  DIFFERENT = 0,
87  STATIC = 1,
88  LINEAR_TRANSFORMATION = 2,
89  SAME_TOPOLOGY = 3
90  };
91 
93  /*
94  * Set/Get the type of variance of the mesh over time.
95  *
96  * DIFFERENT = 0,
97  * STATIC = 1,
98  * LINEAR_TRANSFORMATION = 2
99  * SAME_TOPOLOGY = 3
100  */
101  vtkSetClampMacro(MeshOverTime, int, DIFFERENT, SAME_TOPOLOGY);
102  void SetMeshOverTimeToDifferent() { this->SetMeshOverTime(DIFFERENT); }
103  void SetMeshOverTimeToStatic() { this->SetMeshOverTime(STATIC); }
104  void SetMeshOverTimeToLinearTransformation() { this->SetMeshOverTime(LINEAR_TRANSFORMATION); }
105  void SetMeshOverTimeToSameTopology() { this->SetMeshOverTime(SAME_TOPOLOGY); }
106  vtkGetMacro(MeshOverTime, int);
108 
116  void Initialize(vtkCompositeDataSet* t0, vtkCompositeDataSet* t1);
117 
124  virtual void CopyParameters(vtkTemporalInterpolatedVelocityField* from);
125 
126  using Superclass::FunctionValues;
128 
132  int FunctionValues(double* x, double* u) override;
133  int FunctionValuesAtT(int T, double* x, double* u);
135 
141  void SelectVectors(const char* fieldName) { this->SetVectorsSelection(fieldName); }
142 
144 
149  void AddDataSetAtTime(int N, double T, vtkDataSet* dataset);
151 
153 
158  bool GetCachedCellIds(vtkIdType id[2], int ds[2]);
159  void SetCachedCellIds(vtkIdType id[2], int ds[2]);
161 
166  void ClearCache();
167 
169 
173  int TestPoint(double* x);
174  int QuickTestPoint(double* x);
176 
178 
182  vtkGetVector3Macro(LastGoodVelocity, double);
184 
186 
189  vtkGetMacro(CurrentWeight, double);
191 
192  bool InterpolatePoint(vtkPointData* outPD1, vtkPointData* outPD2, vtkIdType outIndex);
193 
194  bool InterpolatePoint(int T, vtkPointData* outPD1, vtkIdType outIndex);
195 
196  bool GetVorticityData(
197  int T, double pcoords[3], double* weights, vtkGenericCell*& cell, vtkDoubleArray* cellVectors);
198 
199  void ShowCacheResults();
200 
201  void AdvanceOneTimeStep();
202 
204 
210  VTK_DEPRECATED_IN_9_7_0("Use SetCellLocator() instead.")
211  virtual void SetFindCellStrategy(vtkFindCellStrategy*);
213  "GetFindCellStrategy() always returns nullptr. Use GetCellLocator() instead.")
214  virtual vtkFindCellStrategy* GetFindCellStrategy() { return nullptr; }
216 
218 
223  virtual void SetCellLocator(vtkAbstractCellLocator*);
224  vtkGetObjectMacro(CellLocator, vtkAbstractCellLocator);
226 
227 protected:
230 
231  virtual void SetVectorsSelection(const char* v);
232 
233  int MeshOverTime = MeshOverTimeTypes::DIFFERENT;
234 
235  void InitializeWithCellLocators(vtkCompositeInterpolatedVelocityField* ivf,
236  const std::vector<vtkDataSet*>& datasets, vtkAbstractCellLocator* cellLocatorPrototype,
239 
240  void CreateCellLocators(const std::vector<vtkDataSet*>& datasets,
241  vtkAbstractCellLocator* cellLocatorProtoType,
243  void CreateLinks(const std::vector<vtkDataSet*>& datasets,
245  void CreateLinearTransformCellLocators(
248 
249  double Vals1[3];
250  double Vals2[3];
251  double Times[2];
252  double LastGoodVelocity[3];
253 
254  static const double WEIGHT_TO_TOLERANCE;
255 
256  // The weight (0.0->1.0) of the value of T between the two available
257  // time values for the current computation
259  // One minus the CurrentWeight
261  // A scaling factor used when calculating the CurrentWeight { 1.0/(T2-T1) }
262  double ScaleCoeff;
263 
265  std::vector<vtkSmartPointer<vtkAbstractCellLocator>> CellLocators[2];
266  std::vector<vtkSmartPointer<vtkAbstractCellLocator>> InitialCellLocators;
267  std::vector<vtkSmartPointer<vtkAbstractCellLinks>> Links[2];
268  std::vector<size_t> MaxCellSizes[2];
269 
271 
272 private:
273  // Hide this since we need multiple time steps and are using a different
274  // function prototype
275  virtual void AddDataSet(vtkDataSet*) {}
276 
278  void operator=(const vtkTemporalInterpolatedVelocityField&) = delete;
279 };
280 
281 VTK_ABI_NAMESPACE_END
282 #endif
A helper class for interpolating between times during particle tracing.
represent and manipulate point attribute data
Definition: vtkPointData.h:30
std::vector< vtkSmartPointer< vtkAbstractCellLocator > > InitialCellLocators
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
MeshOverTimeTypes
Types of Variance of Mesh over time.
IDStates
States that define where the cell id are.
an abstract base class for locators which find cells
abstract base class for objects that accelerate spatial searches
Definition: vtkLocator.h:59
An abstract class for obtaining the interpolated velocity values at a point.
int vtkIdType
Definition: vtkType.h:363
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:28
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
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...
#define VTK_DEPRECATED_IN_9_7_0(reason)