VTK  9.2.6
vtkEvenlySpacedStreamlines2D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkEvenlySpacedStreamlines2D.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 =========================================================================*/
92 #ifndef vtkEvenlySpacedStreamlines2D_h
93 #define vtkEvenlySpacedStreamlines2D_h
94 
95 #include "vtkFiltersFlowPathsModule.h" // For export macro
96 #include "vtkPolyDataAlgorithm.h"
97 
98 #include <array> // for std::array
99 #include <vector> // for std::vector
100 
102 class vtkCompositeDataSet;
103 class vtkDataArray;
104 class vtkDoubleArray;
105 class vtkExecutive;
106 class vtkGenericCell;
107 class vtkIdList;
109 class vtkImageData;
110 class vtkIntArray;
112 class vtkPoints;
113 class vtkStreamTracer;
114 
115 class VTKFILTERSFLOWPATHS_EXPORT vtkEvenlySpacedStreamlines2D : public vtkPolyDataAlgorithm
116 {
117 public:
119  void PrintSelf(ostream& os, vtkIndent indent) override;
120 
129 
131 
137  vtkSetVector3Macro(StartPosition, double);
138  vtkGetVector3Macro(StartPosition, double);
140 
142 
152  vtkGetObjectMacro(Integrator, vtkInitialValueProblemSolver);
158 
164 
170 
177  void SetIntegrationStepUnit(int unit);
178  int GetIntegrationStepUnit() { return this->IntegrationStepUnit; }
179 
181 
184  vtkSetMacro(MaximumNumberOfSteps, vtkIdType);
185  vtkGetMacro(MaximumNumberOfSteps, vtkIdType);
187 
189 
193  vtkSetMacro(MinimumNumberOfLoopPoints, vtkIdType);
194  vtkGetMacro(MinimumNumberOfLoopPoints, vtkIdType);
196 
198 
205  vtkSetMacro(InitialIntegrationStep, double);
206  vtkGetMacro(InitialIntegrationStep, double);
208 
210 
214  vtkSetMacro(SeparatingDistance, double);
215  vtkGetMacro(SeparatingDistance, double);
217 
219 
223  vtkSetMacro(SeparatingDistanceRatio, double);
224  vtkGetMacro(SeparatingDistanceRatio, double);
226 
228 
232  vtkSetMacro(ClosedLoopMaximumDistance, double);
233  vtkGetMacro(ClosedLoopMaximumDistance, double);
235 
237 
242  vtkSetMacro(LoopAngle, double);
243  vtkGetMacro(LoopAngle, double);
245 
247 
250  vtkSetMacro(TerminalSpeed, double);
251  vtkGetMacro(TerminalSpeed, double);
253 
255 
260  vtkSetMacro(ComputeVorticity, bool);
261  vtkGetMacro(ComputeVorticity, bool);
263 
269 
278  void SetInterpolatorType(int interpType);
279 
280 protected:
283 
288  {
290  DISTANCE_RATIO
291  };
292  // hide the superclass' AddInput() from the user and the compiler
294  {
295  vtkErrorMacro(<< "AddInput() must be called with a vtkDataSet not a vtkDataObject.");
296  }
297 
300 
301  int SetupOutput(vtkInformation* inInfo, vtkInformation* outInfo);
302  int CheckInputs(vtkAbstractInterpolatedVelocityField*& func, int* maxCellSize);
303  double ConvertToLength(double interval, int unit, double cellLength);
304 
305  static void GetBounds(vtkCompositeDataSet* cds, double bounds[6]);
306  void InitializeSuperposedGrid(double* bounds);
307  void AddToAllPoints(vtkPolyData* streamline);
309  template <typename T>
312 
313  static bool IsStreamlineLooping(
314  void* clientdata, vtkPoints* points, vtkDataArray* velocity, int direction);
316  void* clientdata, vtkPoints* points, vtkDataArray* velocity, int direction);
317  template <typename CellCheckerType>
318  bool ForEachCell(double* point, CellCheckerType checker, vtkPoints* points = nullptr,
319  vtkDataArray* velocity = nullptr, int direction = 1);
320  template <int distanceType>
322  double* point, vtkIdType cellId, vtkPoints* points, vtkDataArray* velocity, int direction);
323  bool IsLooping(
324  double* point, vtkIdType cellId, vtkPoints* points, vtkDataArray* velocity, int direction);
326  int ComputeCellLength(double* cellLength);
327 
328  // starting from global x-y-z position
329  double StartPosition[3];
330 
332 
335  // SeparatingDistance can be in cell length or arc length. This member
336  // stores SeparatingDistance in arc length. It is computed when
337  // the filter executes.
341  // ClosedLoopMaximumDistance can be in cell length or arc length.
342  // This member stores ClosedLoopMaximumDistance in arc length. It is
343  // computed when the filter executes.
345  double LoopAngle;
347 
351 
352  // Prototype showing the integrator type to be set by the user.
354 
356 
358 
360  // grid superposed over InputData. The grid cell height and width is
361  // SeparatingDistance
363  // AllPoints[i][j] is the point for point j on the streamlines that
364  // falls over cell id i in SuperposedGrid. AllPoint[i].size() tell
365  // us how many points fall over cell id i.
366  std::vector<std::vector<std::array<double, 3>>> AllPoints;
367 
368  // CurrentPoints[i][j] is the point id for point j on the current streamline that
369  // falls over cell id i in SuperposedGrid. CurrentPoints[i].size() tell us
370  // how many points fall over cell id i.
371  std::vector<std::vector<vtkIdType>> CurrentPoints;
372  // Min and Max point ids stored in a cell of SuperposedGrid
373  std::vector<vtkIdType> MinPointIds;
374  // The index of the first point for the current
375  // direction. Note we integrate streamlines both forward and
376  // backward.
378  // The previous integration direction.
380 
381  // queue of streamlines to be processed
383 
384 private:
386  void operator=(const vtkEvenlySpacedStreamlines2D&) = delete;
387 };
388 
389 #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:165
general representation of visualization data
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:79
provides thread-safe access to cells
list of point or cell ids
Definition: vtkIdList.h:143
topologically and geometrically regular array of data
Definition: vtkImageData.h:163
a simple class to control print indentation
Definition: vtkIndent.h:119
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:155
represent and manipulate 3D points
Definition: vtkPoints.h:149
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:200
Streamline generator.
@ point
Definition: vtkX3D.h:242
@ points
Definition: vtkX3D.h:452
@ direction
Definition: vtkX3D.h:266
@ type
Definition: vtkX3D.h:522
int vtkIdType
Definition: vtkType.h:332