VTK  9.3.0
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 
141  vtkGetObjectMacro(Integrator, vtkInitialValueProblemSolver);
147 
153 
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 
258 
267  void SetInterpolatorType(int interpType);
268 
269 protected:
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 
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);
298  template <typename T>
301 
302  static bool IsStreamlineLooping(
303  void* clientdata, vtkPoints* points, vtkDataArray* velocity, int direction);
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>
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);
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
An abstract class for obtaining the interpolated velocity values at a point.
abstract superclass for composite (multi-block or AMR) datasets
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:45
general representation of visualization data
Definition: vtkDataObject.h:55
dynamic, self-adjusting array of double
Evenly spaced streamline generator for 2D.
double ConvertToLength(double interval, int unit, double cellLength)
void SetIntegrator(vtkInitialValueProblemSolver *)
Set/get the integrator type to be used for streamline generation.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
void SetIntegrationStepUnit(int unit)
Specify a uniform integration step unit for InitialIntegrationStep, and SeparatingDistance.
std::vector< std::vector< std::array< double, 3 > > > AllPoints
int GetIntegratorType()
Set/get the integrator type to be used for streamline generation.
vtkInitialValueProblemSolver * Integrator
void SetInterpolatorType(int interpType)
Set the type of the velocity field interpolator to determine whether INTERPOLATOR_WITH_DATASET_POINT_...
static bool IsStreamlineTooCloseToOthers(void *clientdata, vtkPoints *points, vtkDataArray *velocity, int direction)
~vtkEvenlySpacedStreamlines2D() override
void SetInterpolatorTypeToCellLocator()
Set the velocity field interpolator type to the one involving a cell locator.
DistanceType
Do we test for separating distance or a ratio of the separating distance.
void InitializePoints(T &points)
void SetIntegratorTypeToRungeKutta4()
Set/get the integrator type to be used for streamline generation.
void AddToCurrentPoints(vtkIdType pointId)
static vtkEvenlySpacedStreamlines2D * New()
Construct object to start from position (0,0,0), with forward integration, terminal speed 1....
void AddToAllPoints(vtkPolyData *streamline)
int SetupOutput(vtkInformation *inInfo, vtkInformation *outInfo)
void InitializeSuperposedGrid(double *bounds)
int ComputeCellLength(double *cellLength)
void SetInterpolatorPrototype(vtkAbstractInterpolatedVelocityField *ivf)
The object used to interpolate the velocity field during integration is of the same class as this pro...
int CheckInputs(vtkAbstractInterpolatedVelocityField *&func, int *maxCellSize)
bool IsTooClose(double *point, vtkIdType cellId, vtkPoints *points, vtkDataArray *velocity, int direction)
void SetIntegratorType(int type)
Set/get the integrator type to be used for streamline generation.
void SetIntegratorTypeToRungeKutta2()
Set/get the integrator type to be used for streamline generation.
void SetInterpolatorTypeToDataSetPointLocator()
Set the velocity field interpolator type to the one involving a dataset point locator.
bool IsLooping(double *point, vtkIdType cellId, vtkPoints *points, vtkDataArray *velocity, int direction)
bool ForEachCell(double *point, CellCheckerType checker, vtkPoints *points=nullptr, vtkDataArray *velocity=nullptr, int direction=1)
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkAbstractInterpolatedVelocityField * InterpolatorPrototype
static void GetBounds(vtkCompositeDataSet *cds, double bounds[6])
static bool IsStreamlineLooping(void *clientdata, vtkPoints *points, vtkDataArray *velocity, int direction)
std::vector< std::vector< vtkIdType > > CurrentPoints
const char * GetInputArrayToProcessName()
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:39
provides thread-safe access to cells
list of point or cell ids
Definition: vtkIdList.h:23
topologically and geometrically regular array of data
Definition: vtkImageData.h:43
a simple class to control print indentation
Definition: vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Integrate a set of ordinary differential equations (initial value problem) in time.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:35
represent and manipulate 3D points
Definition: vtkPoints.h:29
Superclass for algorithms that produce only polydata as output.
maintain a list of polygonal data objects
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:80
Streamline generator.
@ point
Definition: vtkX3D.h:236
@ points
Definition: vtkX3D.h:446
@ direction
Definition: vtkX3D.h:260
@ type
Definition: vtkX3D.h:516
int vtkIdType
Definition: vtkType.h:315