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 
151  void SetIntegrator(vtkInitialValueProblemSolver*);
152  vtkGetObjectMacro(Integrator, vtkInitialValueProblemSolver);
153  void SetIntegratorType(int type);
154  int GetIntegratorType();
155  void SetIntegratorTypeToRungeKutta2();
156  void SetIntegratorTypeToRungeKutta4();
158 
163  void SetInterpolatorTypeToDataSetPointLocator();
164 
169  void SetInterpolatorTypeToCellLocator();
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 
268  void SetInterpolatorPrototype(vtkAbstractInterpolatedVelocityField* ivf);
269 
278  void SetInterpolatorType(int interpType);
279 
280 protected:
282  ~vtkEvenlySpacedStreamlines2D() override;
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 
299  int FillInputPortInformation(int, vtkInformation*) override;
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);
308  void AddToCurrentPoints(vtkIdType pointId);
309  template <typename T>
310  void InitializePoints(T& points);
311  void InitializeMinPointIds();
312 
313  static bool IsStreamlineLooping(
314  void* clientdata, vtkPoints* points, vtkDataArray* velocity, int direction);
315  static bool IsStreamlineTooCloseToOthers(
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>
321  bool IsTooClose(
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);
325  const char* GetInputArrayToProcessName();
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
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:332
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:90
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:49
provides thread-safe access to cells
dynamic, self-adjusting array of double
static vtkPolyDataAlgorithm * New()
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:45
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:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:53
list of point or cell ids
Definition: vtkIdList.h:33
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
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:65
represent and manipulate 3D points
Definition: vtkPoints.h:39
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.