VTK  9.3.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 "vtkFiltersFlowPathsModule.h" // For export macro
84 #include "vtkPolyDataAlgorithm.h"
85 
86 #include <array> // for std::array
87 #include <vector> // for std::vector
88 
89 VTK_ABI_NAMESPACE_BEGIN
92 class vtkDataArray;
93 class vtkDoubleArray;
94 class vtkExecutive;
95 class vtkGenericCell;
96 class vtkIdList;
98 class vtkImageData;
99 class vtkIntArray;
101 class vtkPoints;
102 class vtkStreamTracer;
103 
104 class VTKFILTERSFLOWPATHS_EXPORT vtkEvenlySpacedStreamlines2D : public vtkPolyDataAlgorithm
105 {
106 public:
108  void PrintSelf(ostream& os, vtkIndent indent) override;
109 
118 
120 
126  vtkSetVector3Macro(StartPosition, double);
127  vtkGetVector3Macro(StartPosition, double);
129 
131 
140  void SetIntegrator(vtkInitialValueProblemSolver*);
141  vtkGetObjectMacro(Integrator, vtkInitialValueProblemSolver);
142  void SetIntegratorType(int type);
143  int GetIntegratorType();
144  void SetIntegratorTypeToRungeKutta2();
145  void SetIntegratorTypeToRungeKutta4();
147 
152  void SetInterpolatorTypeToDataSetPointLocator();
153 
158  void SetInterpolatorTypeToCellLocator();
159 
166  void SetIntegrationStepUnit(int unit);
167  int GetIntegrationStepUnit() { return this->IntegrationStepUnit; }
168 
170 
173  vtkSetMacro(MaximumNumberOfSteps, vtkIdType);
174  vtkGetMacro(MaximumNumberOfSteps, vtkIdType);
176 
178 
182  vtkSetMacro(MinimumNumberOfLoopPoints, vtkIdType);
183  vtkGetMacro(MinimumNumberOfLoopPoints, vtkIdType);
185 
187 
194  vtkSetMacro(InitialIntegrationStep, double);
195  vtkGetMacro(InitialIntegrationStep, double);
197 
199 
203  vtkSetMacro(SeparatingDistance, double);
204  vtkGetMacro(SeparatingDistance, double);
206 
208 
212  vtkSetMacro(SeparatingDistanceRatio, double);
213  vtkGetMacro(SeparatingDistanceRatio, double);
215 
217 
221  vtkSetMacro(ClosedLoopMaximumDistance, double);
222  vtkGetMacro(ClosedLoopMaximumDistance, double);
224 
226 
231  vtkSetMacro(LoopAngle, double);
232  vtkGetMacro(LoopAngle, double);
234 
236 
239  vtkSetMacro(TerminalSpeed, double);
240  vtkGetMacro(TerminalSpeed, double);
242 
244 
249  vtkSetMacro(ComputeVorticity, bool);
250  vtkGetMacro(ComputeVorticity, bool);
252 
257  void SetInterpolatorPrototype(vtkAbstractInterpolatedVelocityField* ivf);
258 
267  void SetInterpolatorType(int interpType);
268 
269 protected:
271  ~vtkEvenlySpacedStreamlines2D() override;
272 
277  {
279  DISTANCE_RATIO
280  };
281  // hide the superclass' AddInput() from the user and the compiler
283  {
284  vtkErrorMacro(<< "AddInput() must be called with a vtkDataSet not a vtkDataObject.");
285  }
286 
288  int FillInputPortInformation(int, vtkInformation*) override;
289 
290  int SetupOutput(vtkInformation* inInfo, vtkInformation* outInfo);
291  int CheckInputs(vtkAbstractInterpolatedVelocityField*& func, int* maxCellSize);
292  double ConvertToLength(double interval, int unit, double cellLength);
293 
294  static void GetBounds(vtkCompositeDataSet* cds, double bounds[6]);
295  void InitializeSuperposedGrid(double* bounds);
296  void AddToAllPoints(vtkPolyData* streamline);
297  void AddToCurrentPoints(vtkIdType pointId);
298  template <typename T>
299  void InitializePoints(T& points);
300  void InitializeMinPointIds();
301 
302  static bool IsStreamlineLooping(
303  void* clientdata, vtkPoints* points, vtkDataArray* velocity, int direction);
304  static bool IsStreamlineTooCloseToOthers(
305  void* clientdata, vtkPoints* points, vtkDataArray* velocity, int direction);
306  template <typename CellCheckerType>
307  bool ForEachCell(double* point, CellCheckerType checker, vtkPoints* points = nullptr,
308  vtkDataArray* velocity = nullptr, int direction = 1);
309  template <int distanceType>
310  bool IsTooClose(
311  double* point, vtkIdType cellId, vtkPoints* points, vtkDataArray* velocity, int direction);
312  bool IsLooping(
313  double* point, vtkIdType cellId, vtkPoints* points, vtkDataArray* velocity, int direction);
314  const char* GetInputArrayToProcessName();
315  int ComputeCellLength(double* cellLength);
316 
317  // starting from global x-y-z position
318  double StartPosition[3];
319 
321 
324  // SeparatingDistance can be in cell length or arc length. This member
325  // stores SeparatingDistance in arc length. It is computed when
326  // the filter executes.
330  // ClosedLoopMaximumDistance can be in cell length or arc length.
331  // This member stores ClosedLoopMaximumDistance in arc length. It is
332  // computed when the filter executes.
334  double LoopAngle;
336 
340 
341  // Prototype showing the integrator type to be set by the user.
343 
345 
347 
349  // grid superposed over InputData. The grid cell height and width is
350  // SeparatingDistance
352  // AllPoints[i][j] is the point for point j on the streamlines that
353  // falls over cell id i in SuperposedGrid. AllPoint[i].size() tell
354  // us how many points fall over cell id i.
355  std::vector<std::vector<std::array<double, 3>>> AllPoints;
356 
357  // CurrentPoints[i][j] is the point id for point j on the current streamline that
358  // falls over cell id i in SuperposedGrid. CurrentPoints[i].size() tell us
359  // how many points fall over cell id i.
360  std::vector<std::vector<vtkIdType>> CurrentPoints;
361  // Min and Max point ids stored in a cell of SuperposedGrid
362  std::vector<vtkIdType> MinPointIds;
363  // The index of the first point for the current
364  // direction. Note we integrate streamlines both forward and
365  // backward.
367  // The previous integration direction.
369 
370  // queue of streamlines to be processed
372 
373 private:
375  void operator=(const vtkEvenlySpacedStreamlines2D&) = delete;
376 };
377 
378 VTK_ABI_NAMESPACE_END
379 #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
vtkAbstractInterpolatedVelocityField * InterpolatorPrototype
An abstract class for obtaining the interpolated velocity values at a point.
int vtkIdType
Definition: vtkType.h:315
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:38
provides thread-safe access to cells
dynamic, self-adjusting array of double
static vtkPolyDataAlgorithm * New()
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:34
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:42
list of point or cell ids
Definition: vtkIdList.h:22
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:54
represent and manipulate 3D points
Definition: vtkPoints.h:28
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.