VTK  9.7.1
vtkAbstractInterpolatedVelocityField.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
63 #ifndef vtkAbstractInterpolatedVelocityField_h
64 #define vtkAbstractInterpolatedVelocityField_h
65 
66 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_7_0
67 #include "vtkFiltersFlowPathsModule.h" // For export macro
68 #include "vtkFunctionSet.h"
69 #include "vtkNew.h" // for vtkNew
70 #include "vtkSmartPointer.h" // for vtkSmartPointer
71 
72 #include <vector> // for weights
73 
74 VTK_ABI_NAMESPACE_BEGIN
77 class vtkDataObject;
78 class vtkDataSet;
79 class vtkDataArray;
80 class vtkIdList;
81 class vtkPointData;
82 class vtkGenericCell;
84 
85 class VTKFILTERSFLOWPATHS_EXPORT vtkAbstractInterpolatedVelocityField : public vtkFunctionSet
86 {
87 public:
89 
93  void PrintSelf(ostream& os, vtkIndent indent) override;
95 
96  // Keep track of how the interpolated velocity field is
97  // initialized. Currently, all datasets that compose the velocity field are
98  // initialized (meaning that supporting structures like locators are
99  // built).
101  {
102  NOT_INITIALIZED = 0,
103  INITIALIZE_ALL_DATASETS = 1,
104  SELF_INITIALIZE = 2
105  };
106 
108 
122  virtual void Initialize(
123  vtkCompositeDataSet* compDS, int initCellLocator = INITIALIZE_ALL_DATASETS);
124  vtkGetMacro(InitializationState, int);
126 
128 
132  vtkSetMacro(Caching, bool);
133  vtkGetMacro(Caching, bool);
135 
137 
141  vtkGetMacro(CacheHit, int);
142  vtkGetMacro(CacheMiss, int);
144 
145  vtkGetObjectMacro(LastDataSet, vtkDataSet);
146 
148 
151  vtkGetMacro(LastCellId, vtkIdType);
152  virtual void SetLastCellId(vtkIdType c) { this->LastCellId = c; }
154 
158  virtual void SetLastCellId(vtkIdType c, int dataindex) = 0;
159 
161 
165  vtkGetStringMacro(VectorsSelection);
166  vtkGetMacro(VectorsType, int);
168 
173  void SelectVectors(int fieldAssociation, const char* fieldName);
174 
176 
193  vtkSetMacro(NormalizeVector, bool);
194  vtkGetMacro(NormalizeVector, bool);
196 
198 
205  vtkSetMacro(ForceSurfaceTangentVector, bool);
206  vtkGetMacro(ForceSurfaceTangentVector, bool);
208 
210 
214  vtkSetMacro(SurfaceDataset, bool);
215  vtkGetMacro(SurfaceDataset, bool);
217 
224  virtual void CopyParameters(vtkAbstractInterpolatedVelocityField* from);
225 
226  using Superclass::FunctionValues;
230  int FunctionValues(double* x, double* f) override = 0;
231 
235  void ClearLastCellId() { this->LastCellId = -1; }
236 
238 
242  int GetLastWeights(double* w);
243  int GetLastLocalCoordinates(double pcoords[3]);
245 
247 
253  VTK_DEPRECATED_IN_9_7_0("Use SetCellLocator() instead.")
254  virtual void SetFindCellStrategy(vtkFindCellStrategy*);
256  "GetFindCellStrategy() always returns nullptr. Use GetCellLocator() instead.")
257  virtual vtkFindCellStrategy* GetFindCellStrategy() { return nullptr; }
259 
261 
266  virtual void SetCellLocator(vtkAbstractCellLocator*);
267  vtkGetObjectMacro(CellLocator, vtkAbstractCellLocator);
269 
270 protected:
273 
274  static const double TOLERANCE_SCALE;
275  static const double SURFACE_TOLERANCE_SCALE;
276 
277  int CacheHit;
279  bool Caching;
285  std::vector<double> Weights;
286  double LastPCoords[3];
288  double LastClosestPoint[3];
293 
299 
300  // This is used to keep track of the cellLocator and vector array
301  // associated with each dataset forming the velocity field. Note that the
302  // cellLocator can be null, this means the FindCell is invoked
303  // using the dataset's FindCell() method.
305  {
307  const double SampledMaxCellLength2;
308  const double Length2;
311 
313  vtkDataSet* dataSet, vtkAbstractCellLocator* cellLocator, vtkDataArray* vectors);
314  };
316 
321  std::vector<vtkDataSetInformation> DataSetsInfo;
322  std::vector<vtkDataSetInformation>::iterator GetDataSetInfo(vtkDataSet* dataset);
324 
326 
329  vtkSetStringMacro(VectorsSelection);
331 
343  virtual int FunctionValues(vtkDataSet* ds, double* x, double* f);
344 
351  virtual bool FindAndUpdateCell(const vtkDataSetInformation& dsInfo, double* x);
352 
355 
361  void FastCompute(vtkDataArray* vectors, double f[3]);
362  void FastCompute(vtkAbstractInterpolatedVelocityField* inIVF, vtkDataArray* vectors, double f[3]);
363  bool InterpolatePoint(vtkPointData* outPD, vtkIdType outIndex);
364  bool InterpolatePoint(
367  {
368  return (this->LastCellId != -1) ? this->CurrentCell.Get() : nullptr;
369  }
371 
373 
379  virtual int SelfInitialize() { return 0; }
380  void AddToDataSetsInfo(vtkDataSet*, vtkAbstractCellLocator*, vtkDataArray* vectors);
381  size_t GetDataSetsInfoSize();
383 
384 private:
386  void operator=(const vtkAbstractInterpolatedVelocityField&) = delete;
387 };
388 
389 VTK_ABI_NAMESPACE_END
390 #endif
A helper class for interpolating between times during particle tracing.
represent and manipulate point attribute data
Definition: vtkPointData.h:30
vtkAbstractCellLocator * CellLocator
Define a Cell Locator to perform FindCell(), keep track of them (and other cached information) associ...
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
T * Get() const noexcept
Get a raw pointer to the contained object.
Definition: vtkNew.h:149
std::vector< vtkDataSetInformation > DataSetsInfo
Define a Cell Locator to perform FindCell(), keep track of them (and other cached information) associ...
an abstract base class for locators which find cells
An abstract class for obtaining the interpolated velocity values at a point.
int vtkIdType
Definition: vtkType.h:363
provides thread-safe access to cells
virtual int SelfInitialize()
These methods pertain to initializing the vector field by subclasses (which may have special initiali...
helper class to manage the vtkPointSet::FindCell() method
abstract superclass for composite (multi-block or AMR) datasets
void ClearLastCellId()
Set the last cell id to -1 to incur a global cell search for the next point.
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
list of point or cell ids
Definition: vtkIdList.h:25
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
vtkGenericCell * GetLastCell()
If all weights have been computed (parametric coords etc all valid), a scalar/vector can be quickly i...
Abstract interface for sets of functions.
virtual int FunctionValues(double *x, double *f)
Evaluate functions at x_j.
virtual void SetLastCellId(vtkIdType c)
Get/Set the id of the cell cached from last evaluation.
int InitializationState
Make sure the velocity field is initialized: record the initialization cellLocator.
bool InterpolatePoint(vtkPointData *outPD1, vtkPointData *outPD2, vtkIdType outIndex)
general representation of visualization data
Definition: vtkDataObject.h:55
#define VTK_DEPRECATED_IN_9_7_0(reason)