VTK  9.3.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
65 #ifndef vtkAbstractInterpolatedVelocityField_h
66 #define vtkAbstractInterpolatedVelocityField_h
67 
68 #include "vtkFiltersFlowPathsModule.h" // For export macro
69 #include "vtkFunctionSet.h"
70 #include "vtkNew.h" // for vtkNew
71 #include "vtkSmartPointer.h" // for vtkSmartPointer
72 
73 #include <vector> // for weights
74 
75 VTK_ABI_NAMESPACE_BEGIN
80 class vtkDataObject;
81 class vtkDataSet;
82 class vtkDataArray;
83 class vtkIdList;
84 class vtkPointData;
85 class vtkGenericCell;
87 
88 class VTKFILTERSFLOWPATHS_EXPORT vtkAbstractInterpolatedVelocityField : public vtkFunctionSet
89 {
90 public:
92 
96  void PrintSelf(ostream& os, vtkIndent indent) override;
98 
99  // Keep track of how the interpolated velocity field is
100  // initialized. Currently, all datasets that compose the velocity field are
101  // initialized (meaning that supporting structures like locators are
102  // built).
104  {
105  NOT_INITIALIZED = 0,
106  INITIALIZE_ALL_DATASETS = 1,
107  SELF_INITIALIZE = 2
108  };
109 
111 
125  virtual void Initialize(vtkCompositeDataSet* compDS, int initStrategy = INITIALIZE_ALL_DATASETS);
126  vtkGetMacro(InitializationState, int);
128 
130 
136  vtkSetMacro(Caching, bool);
137  vtkGetMacro(Caching, bool);
139 
141 
145  vtkGetMacro(CacheHit, int);
146  vtkGetMacro(CacheMiss, int);
148 
149  vtkGetObjectMacro(LastDataSet, vtkDataSet);
150 
152 
155  vtkGetMacro(LastCellId, vtkIdType);
156  virtual void SetLastCellId(vtkIdType c) { this->LastCellId = c; }
158 
162  virtual void SetLastCellId(vtkIdType c, int dataindex) = 0;
163 
165 
169  vtkGetStringMacro(VectorsSelection);
170  vtkGetMacro(VectorsType, int);
172 
177  void SelectVectors(int fieldAssociation, const char* fieldName);
178 
180 
197  vtkSetMacro(NormalizeVector, bool);
198  vtkGetMacro(NormalizeVector, bool);
200 
202 
209  vtkSetMacro(ForceSurfaceTangentVector, bool);
210  vtkGetMacro(ForceSurfaceTangentVector, bool);
212 
214 
218  vtkSetMacro(SurfaceDataset, bool);
219  vtkGetMacro(SurfaceDataset, bool);
221 
228  virtual void CopyParameters(vtkAbstractInterpolatedVelocityField* from);
229 
230  using Superclass::FunctionValues;
234  int FunctionValues(double* x, double* f) override = 0;
235 
239  void ClearLastCellId() { this->LastCellId = -1; }
240 
242 
246  int GetLastWeights(double* w);
247  int GetLastLocalCoordinates(double pcoords[3]);
249 
251 
257  virtual void SetFindCellStrategy(vtkFindCellStrategy*);
258  vtkGetObjectMacro(FindCellStrategy, vtkFindCellStrategy);
260 
261 protected:
264 
265  static const double TOLERANCE_SCALE;
266  static const double SURFACE_TOLERANCE_SCALE;
267 
268  int CacheHit;
270  bool Caching;
276  std::vector<double> Weights;
277  double LastPCoords[3];
279  double LastClosestPoint[3];
285 
291 
292  // This is used to keep track of the find cell strategy and vector array
293  // associated with each dataset forming the velocity field. Note that the
294  // find cells strategy can be null, this means the find cell is invoked
295  // using the dataset's FindCell() method.
297  {
301 
303  : DataSet(dataSet)
304  , Strategy(strategy)
305  , Vectors(vectors)
306  {
307  }
308  };
310 
315  std::vector<vtkDataSetInformation> DataSetsInfo;
316  std::vector<vtkDataSetInformation>::iterator GetDataSetInfo(vtkDataSet* dataset);
318 
320 
323  vtkSetStringMacro(VectorsSelection);
325 
337  virtual int FunctionValues(vtkDataSet* ds, double* x, double* f);
338 
345  virtual bool FindAndUpdateCell(vtkDataSet* ds, vtkFindCellStrategy* strategy, double* x);
346 
349 
355  void FastCompute(vtkDataArray* vectors, double f[3]);
356  void FastCompute(vtkAbstractInterpolatedVelocityField* inIVF, vtkDataArray* vectors, double f[3]);
357  bool InterpolatePoint(vtkPointData* outPD, vtkIdType outIndex);
358  bool InterpolatePoint(
361  {
362  return (this->LastCellId != -1) ? this->CurrentCell.Get() : nullptr;
363  }
365 
367 
373  virtual int SelfInitialize() { return 0; }
374  void AddToDataSetsInfo(vtkDataSet*, vtkFindCellStrategy*, vtkDataArray* vectors);
375  size_t GetDataSetsInfoSize();
377 
378 private:
380  void operator=(const vtkAbstractInterpolatedVelocityField&) = delete;
381 };
382 
383 VTK_ABI_NAMESPACE_END
384 #endif
A helper class for interpolating between times during particle tracing.
represent and manipulate point attribute data
Definition: vtkPointData.h:29
abstract class to specify dataset behavior
Definition: vtkDataSet.h:52
T * Get() const noexcept
Get a raw pointer to the contained object.
Definition: vtkNew.h:141
std::vector< vtkDataSetInformation > DataSetsInfo
Define a FindCell() strategy, keep track of the strategies (and other cached information) associated ...
implement a specific vtkPointSet::FindCell() strategy based on closest point
An abstract class for obtaining the interpolated velocity values at a point.
int vtkIdType
Definition: vtkType.h:315
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:22
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
vtkFindCellStrategy * FindCellStrategy
Define a FindCell() strategy, keep track of the strategies (and other cached information) associated ...
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.
implement a specific vtkPointSet::FindCell() strategy based on the N closest points ...
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 strategy.
bool InterpolatePoint(vtkPointData *outPD1, vtkPointData *outPD2, vtkIdType outIndex)
general representation of visualization data
Definition: vtkDataObject.h:54
implement a specific vtkPointSet::FindCell() strategy based on using a cell locator ...
vtkDataSetInformation(vtkDataSet *dataSet, vtkFindCellStrategy *strategy, vtkDataArray *vectors)