VTK  9.2.6
vtkAbstractInterpolatedVelocityField.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAbstractInterpolatedVelocityField.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 =========================================================================*/
77 #ifndef vtkAbstractInterpolatedVelocityField_h
78 #define vtkAbstractInterpolatedVelocityField_h
79 
80 #include "vtkFiltersFlowPathsModule.h" // For export macro
81 #include "vtkFunctionSet.h"
82 #include "vtkNew.h" // for vtkNew
83 #include "vtkSmartPointer.h" // for vtkSmartPointer
84 
85 #include <vector> // for weights
86 
91 class vtkDataObject;
92 class vtkDataSet;
93 class vtkDataArray;
94 class vtkIdList;
95 class vtkPointData;
96 class vtkGenericCell;
98 
99 class VTKFILTERSFLOWPATHS_EXPORT vtkAbstractInterpolatedVelocityField : public vtkFunctionSet
100 {
101 public:
103 
107  void PrintSelf(ostream& os, vtkIndent indent) override;
109 
110  // Keep track of how the interpolated velocity field is
111  // initialized. Currently, all datasets that compose the velocity field are
112  // initialized (meaning that supporting structures like locators are
113  // built).
115  {
116  NOT_INITIALIZED = 0,
117  INITIALIZE_ALL_DATASETS = 1,
118  SELF_INITIALIZE = 2
119  };
120 
122 
136  virtual void Initialize(vtkCompositeDataSet* compDS, int initStrategy = INITIALIZE_ALL_DATASETS);
137  vtkGetMacro(InitializationState, int);
139 
141 
147  vtkSetMacro(Caching, bool);
148  vtkGetMacro(Caching, bool);
150 
152 
156  vtkGetMacro(CacheHit, int);
157  vtkGetMacro(CacheMiss, int);
159 
160  vtkGetObjectMacro(LastDataSet, vtkDataSet);
161 
163 
166  vtkGetMacro(LastCellId, vtkIdType);
167  virtual void SetLastCellId(vtkIdType c) { this->LastCellId = c; }
169 
173  virtual void SetLastCellId(vtkIdType c, int dataindex) = 0;
174 
176 
180  vtkGetStringMacro(VectorsSelection);
181  vtkGetMacro(VectorsType, int);
183 
188  void SelectVectors(int fieldAssociation, const char* fieldName);
189 
191 
208  vtkSetMacro(NormalizeVector, bool);
209  vtkGetMacro(NormalizeVector, bool);
211 
213 
218  vtkSetMacro(ForceSurfaceTangentVector, bool);
219  vtkGetMacro(ForceSurfaceTangentVector, bool);
221 
223 
226  vtkSetMacro(SurfaceDataset, bool);
227  vtkGetMacro(SurfaceDataset, bool);
229 
236  virtual void CopyParameters(vtkAbstractInterpolatedVelocityField* from);
237 
238  using Superclass::FunctionValues;
242  int FunctionValues(double* x, double* f) override = 0;
243 
247  void ClearLastCellId() { this->LastCellId = -1; }
248 
250 
254  int GetLastWeights(double* w);
255  int GetLastLocalCoordinates(double pcoords[3]);
257 
259 
265  virtual void SetFindCellStrategy(vtkFindCellStrategy*);
266  vtkGetObjectMacro(FindCellStrategy, vtkFindCellStrategy);
268 
269 protected:
272 
273  static const double TOLERANCE_SCALE;
274  static const double SURFACE_TOLERANCE_SCALE;
275 
276  int CacheHit;
278  bool Caching;
284  std::vector<double> Weights;
285  double LastPCoords[3];
287  double LastClosestPoint[3];
293 
299 
300  // This is used to keep track of the find cell strategy and vector array
301  // associated with each dataset forming the velocity field. Note that the
302  // find cells strategy can be null, this means the find cell is invoked
303  // using the dataset's FindCell() method.
305  {
309 
311  : DataSet(dataSet)
312  , Strategy(strategy)
313  , Vectors(vectors)
314  {
315  }
316  };
318 
323  std::vector<vtkDataSetInformation> DataSetsInfo;
324  std::vector<vtkDataSetInformation>::iterator GetDataSetInfo(vtkDataSet* dataset);
326 
328 
331  vtkSetStringMacro(VectorsSelection);
333 
345  virtual int FunctionValues(vtkDataSet* ds, double* x, double* f);
346 
353  virtual bool FindAndUpdateCell(vtkDataSet* ds, vtkFindCellStrategy* strategy, double* x);
354 
357 
363  void FastCompute(vtkDataArray* vectors, double f[3]);
364  void FastCompute(vtkAbstractInterpolatedVelocityField* inIVF, vtkDataArray* vectors, double f[3]);
365  bool InterpolatePoint(vtkPointData* outPD, vtkIdType outIndex);
366  bool InterpolatePoint(
369  {
370  return (this->LastCellId != -1) ? this->CurrentCell.Get() : nullptr;
371  }
373 
375 
381  virtual int SelfInitialize() { return 0; }
382  void AddToDataSetsInfo(vtkDataSet*, vtkFindCellStrategy*, vtkDataArray* vectors);
383  size_t GetDataSetsInfoSize();
385 
386 private:
388  void operator=(const vtkAbstractInterpolatedVelocityField&) = delete;
389 };
390 
391 #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
T * Get() const noexcept
Get a raw pointer to the contained object.
Definition: vtkNew.h:152
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:332
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:39
list of point or cell ids
Definition: vtkIdList.h:33
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
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:65
implement a specific vtkPointSet::FindCell() strategy based on using a cell locator ...
vtkDataSetInformation(vtkDataSet *dataSet, vtkFindCellStrategy *strategy, vtkDataArray *vectors)