VTK  9.7.1
vtkEvenlySpacedStreamlines2D.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
80 #ifndef vtkEvenlySpacedStreamlines2D_h
81 #define vtkEvenlySpacedStreamlines2D_h
82 
83 #include "vtkDeprecation.h" // VTK_DEPRECATED_IN_9_7_0
84 #include "vtkFiltersFlowPathsModule.h" // For export macro
85 #include "vtkPolyDataAlgorithm.h"
86 
87 #include <array> // for std::array
88 #include <vector> // for std::vector
89 
90 VTK_ABI_NAMESPACE_BEGIN
93 class vtkDataArray;
94 class vtkDoubleArray;
95 class vtkExecutive;
96 class vtkGenericCell;
97 class vtkIdList;
99 class vtkImageData;
100 class vtkIntArray;
102 class vtkPoints;
103 class vtkStreamTracer;
104 
105 class VTKFILTERSFLOWPATHS_EXPORT vtkEvenlySpacedStreamlines2D : public vtkPolyDataAlgorithm
106 {
107 public:
109  void PrintSelf(ostream& os, vtkIndent indent) override;
110 
119 
121 
127  vtkSetVector3Macro(StartPosition, double);
128  vtkGetVector3Macro(StartPosition, double);
130 
132 
141  void SetIntegrator(vtkInitialValueProblemSolver*);
142  vtkGetObjectMacro(Integrator, vtkInitialValueProblemSolver);
143  void SetIntegratorType(int type);
144  int GetIntegratorType();
145  void SetIntegratorTypeToRungeKutta2();
146  void SetIntegratorTypeToRungeKutta4();
148 
153  VTK_DEPRECATED_IN_9_7_0("Use SetCellLocatorToJumpAndWalkCellLocator() instead")
154  void SetInterpolatorTypeToDataSetPointLocator();
155 
160  VTK_DEPRECATED_IN_9_7_0("Use SetCellLocatorToModifiedBSPTree() instead")
161  void SetInterpolatorTypeToCellLocator();
162 
169  void SetIntegrationStepUnit(int unit);
170  int GetIntegrationStepUnit() { return this->IntegrationStepUnit; }
171 
173 
176  vtkSetMacro(MaximumNumberOfSteps, vtkIdType);
177  vtkGetMacro(MaximumNumberOfSteps, vtkIdType);
179 
181 
185  vtkSetMacro(MinimumNumberOfLoopPoints, vtkIdType);
186  vtkGetMacro(MinimumNumberOfLoopPoints, vtkIdType);
188 
190 
197  vtkSetMacro(InitialIntegrationStep, double);
198  vtkGetMacro(InitialIntegrationStep, double);
200 
202 
206  vtkSetMacro(SeparatingDistance, double);
207  vtkGetMacro(SeparatingDistance, double);
209 
211 
215  vtkSetMacro(SeparatingDistanceRatio, double);
216  vtkGetMacro(SeparatingDistanceRatio, double);
218 
220 
224  vtkSetMacro(ClosedLoopMaximumDistance, double);
225  vtkGetMacro(ClosedLoopMaximumDistance, double);
227 
229 
234  vtkSetMacro(LoopAngle, double);
235  vtkGetMacro(LoopAngle, double);
237 
239 
242  vtkSetMacro(TerminalSpeed, double);
243  vtkGetMacro(TerminalSpeed, double);
245 
247 
252  vtkSetMacro(ComputeVorticity, bool);
253  vtkGetMacro(ComputeVorticity, bool);
255 
260  VTK_DEPRECATED_IN_9_7_0("Use SetCellLocator(vtkAbstractCellLocator*) instead")
261  void SetInterpolatorPrototype(vtkAbstractInterpolatedVelocityField* ivf);
262 
271  VTK_DEPRECATED_IN_9_7_0("Use SetCellLocator(vtkAbstractCellLocator*) instead")
272  void SetInterpolatorType(int interpType);
273 
275 
280  virtual void SetCellLocator(vtkAbstractCellLocator*);
281  virtual void SetCellLocatorToModifiedBSPTree();
282  virtual void SetCellLocatorToJumpAndWalkCellLocator();
283  vtkGetObjectMacro(CellLocator, vtkAbstractCellLocator);
285 
286 protected:
288  ~vtkEvenlySpacedStreamlines2D() override;
289 
294  {
296  DISTANCE_RATIO
297  };
298  // hide the superclass' AddInput() from the user and the compiler
300  {
301  vtkErrorMacro(<< "AddInput() must be called with a vtkDataSet not a vtkDataObject.");
302  }
303 
305  int FillInputPortInformation(int, vtkInformation*) override;
306 
307  int SetupOutput(vtkInformation* inInfo, vtkInformation* outInfo);
308  int CheckInputs(vtkAbstractInterpolatedVelocityField*& func, int* maxCellSize);
309  double ConvertToLength(double interval, int unit, double cellLength);
310 
311  static void GetBounds(vtkCompositeDataSet* cds, double bounds[6]);
312  void InitializeSuperposedGrid(double* bounds);
313  void AddToAllPoints(vtkPolyData* streamline);
314  void AddToCurrentPoints(vtkIdType pointId);
315  template <typename T>
316  void InitializePoints(T& points);
317  void InitializeMinPointIds();
318 
319  static bool IsStreamlineLooping(
320  void* clientdata, vtkPoints* points, vtkDataArray* velocity, int direction);
321  static bool IsStreamlineTooCloseToOthers(
322  void* clientdata, vtkPoints* points, vtkDataArray* velocity, int direction);
323  template <typename CellCheckerType>
324  bool ForEachCell(double* point, CellCheckerType checker, vtkPoints* points = nullptr,
325  vtkDataArray* velocity = nullptr, int direction = 1);
326  template <int distanceType>
327  bool IsTooClose(
328  double* point, vtkIdType cellId, vtkPoints* points, vtkDataArray* velocity, int direction);
329  bool IsLooping(
330  double* point, vtkIdType cellId, vtkPoints* points, vtkDataArray* velocity, int direction);
331  const char* GetInputArrayToProcessName();
332  int ComputeCellLength(double* cellLength);
333 
334  // starting from global x-y-z position
335  double StartPosition[3];
336 
338 
341  // SeparatingDistance can be in cell length or arc length. This member
342  // stores SeparatingDistance in arc length. It is computed when
343  // the filter executes.
347  // ClosedLoopMaximumDistance can be in cell length or arc length.
348  // This member stores ClosedLoopMaximumDistance in arc length. It is
349  // computed when the filter executes.
351  double LoopAngle;
353 
357 
358  // Prototype showing the integrator type to be set by the user.
360 
362 
364 
366  // grid superposed over InputData. The grid cell height and width is
367  // SeparatingDistance
369  // AllPoints[i][j] is the point for point j on the streamlines that
370  // falls over cell id i in SuperposedGrid. AllPoint[i].size() tell
371  // us how many points fall over cell id i.
372  std::vector<std::vector<std::array<double, 3>>> AllPoints;
373 
374  // CurrentPoints[i][j] is the point id for point j on the current streamline that
375  // falls over cell id i in SuperposedGrid. CurrentPoints[i].size() tell us
376  // how many points fall over cell id i.
377  std::vector<std::vector<vtkIdType>> CurrentPoints;
378  // Min and Max point ids stored in a cell of SuperposedGrid
379  std::vector<vtkIdType> MinPointIds;
380  // The index of the first point for the current
381  // direction. Note we integrate streamlines both forward and
382  // backward.
384  // The previous integration direction.
386 
387  // queue of streamlines to be processed
389 
390 private:
392  void operator=(const vtkEvenlySpacedStreamlines2D&) = delete;
393 };
394 
395 VTK_ABI_NAMESPACE_END
396 #endif
void GetBounds(T a, double bds[6])
Store vtkAlgorithm input/output information.
Evenly spaced streamline generator for 2D.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
std::vector< std::vector< vtkIdType > > CurrentPoints
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
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:39
provides thread-safe access to cells
dynamic, self-adjusting array of double
static vtkPolyDataAlgorithm * New()
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:35
abstract superclass for composite (multi-block or AMR) datasets
Superclass for algorithms that produce only polydata as output.
a simple class to control print indentation
Definition: vtkIndent.h:28
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
list of point or cell ids
Definition: vtkIdList.h:25
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
std::vector< std::vector< std::array< double, 3 > > > AllPoints
vtkInitialValueProblemSolver * Integrator
Streamline generator.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
Store zero or more vtkInformation instances.
DistanceType
Do we test for separating distance or a ratio of the separating distance.
maintain a list of polygonal data objects
general representation of visualization data
Definition: vtkDataObject.h:55
#define VTK_DEPRECATED_IN_9_7_0(reason)
represent and manipulate 3D points
Definition: vtkPoints.h:30
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Integrate a set of ordinary differential equations (initial value problem) in time.