VTK  9.0.1
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 =========================================================================*/
90 #ifndef vtkEvenlySpacedStreamlines2D_h
91 #define vtkEvenlySpacedStreamlines2D_h
92 
93 #include "vtkFiltersFlowPathsModule.h" // For export macro
94 #include "vtkPolyDataAlgorithm.h"
95 
96 #include <array>
97 #include <vector>
98 
100 class vtkCompositeDataSet;
101 class vtkDataArray;
102 class vtkDoubleArray;
103 class vtkExecutive;
104 class vtkGenericCell;
105 class vtkIdList;
107 class vtkImageData;
108 class vtkIntArray;
110 class vtkPoints;
111 class vtkStreamTracer;
112 
113 class VTKFILTERSFLOWPATHS_EXPORT vtkEvenlySpacedStreamlines2D : public vtkPolyDataAlgorithm
114 {
115 public:
117  void PrintSelf(ostream& os, vtkIndent indent) override;
118 
127 
129 
135  vtkSetVector3Macro(StartPosition, double);
136  vtkGetVector3Macro(StartPosition, double);
138 
140 
149  void SetIntegrator(vtkInitialValueProblemSolver*);
150  vtkGetObjectMacro(Integrator, vtkInitialValueProblemSolver);
151  void SetIntegratorType(int type);
152  int GetIntegratorType();
153  void SetIntegratorTypeToRungeKutta2();
154  void SetIntegratorTypeToRungeKutta4();
156 
161  void SetInterpolatorTypeToDataSetPointLocator();
162 
167  void SetInterpolatorTypeToCellLocator();
168 
175  void SetIntegrationStepUnit(int unit);
176  int GetIntegrationStepUnit() { return this->IntegrationStepUnit; }
177 
179 
182  vtkSetMacro(MaximumNumberOfSteps, vtkIdType);
183  vtkGetMacro(MaximumNumberOfSteps, vtkIdType);
185 
187 
191  vtkSetMacro(MinimumNumberOfLoopPoints, vtkIdType);
192  vtkGetMacro(MinimumNumberOfLoopPoints, vtkIdType);
194 
196 
203  vtkSetMacro(InitialIntegrationStep, double);
204  vtkGetMacro(InitialIntegrationStep, double);
206 
208 
212  vtkSetMacro(SeparatingDistance, double);
213  vtkGetMacro(SeparatingDistance, double);
215 
217 
221  vtkSetMacro(SeparatingDistanceRatio, double);
222  vtkGetMacro(SeparatingDistanceRatio, double);
224 
226 
230  vtkSetMacro(ClosedLoopMaximumDistance, double);
231  vtkGetMacro(ClosedLoopMaximumDistance, double);
233 
235 
240  vtkSetMacro(LoopAngle, double);
241  vtkGetMacro(LoopAngle, double);
243 
245 
248  vtkSetMacro(TerminalSpeed, double);
249  vtkGetMacro(TerminalSpeed, double);
251 
253 
258  vtkSetMacro(ComputeVorticity, bool);
259  vtkGetMacro(ComputeVorticity, bool);
261 
266  void SetInterpolatorPrototype(vtkAbstractInterpolatedVelocityField* ivf);
267 
277  void SetInterpolatorType(int interpType);
278 
279 protected:
281  ~vtkEvenlySpacedStreamlines2D() override;
282 
287  {
289  DISTANCE_RATIO
290  };
291  // hide the superclass' AddInput() from the user and the compiler
293  {
294  vtkErrorMacro(<< "AddInput() must be called with a vtkDataSet not a vtkDataObject.");
295  }
296 
298  int FillInputPortInformation(int, vtkInformation*) override;
299 
300  int SetupOutput(vtkInformation* inInfo, vtkInformation* outInfo);
301  int CheckInputs(vtkAbstractInterpolatedVelocityField*& func, int* maxCellSize);
302  double ConvertToLength(double interval, int unit, double cellLength);
303 
304  static void GetBounds(vtkCompositeDataSet* cds, double bounds[6]);
305  void InitializeSuperposedGrid(double* bounds);
306  void AddToAllPoints(vtkPolyData* streamline);
307  void AddToCurrentPoints(vtkIdType pointId);
308  template <typename T>
309  void InitializePoints(T& points);
310  void InitializeMinPointIds();
311 
312  static bool IsStreamlineLooping(
313  void* clientdata, vtkPoints* points, vtkDataArray* velocity, int direction);
314  static bool IsStreamlineTooCloseToOthers(
315  void* clientdata, vtkPoints* points, vtkDataArray* velocity, int direction);
316  template <typename CellCheckerType>
317  bool ForEachCell(double* point, CellCheckerType checker, vtkPoints* points = nullptr,
318  vtkDataArray* velocity = nullptr, int direction = 1);
319  template <int distanceType>
320  bool IsTooClose(
321  double* point, vtkIdType cellId, vtkPoints* points, vtkDataArray* velocity, int direction);
322  bool IsLooping(
323  double* point, vtkIdType cellId, vtkPoints* points, vtkDataArray* velocity, int direction);
324  const char* GetInputArrayToProcessName();
325  int ComputeCellLength(double* cellLength);
326 
327  // starting from global x-y-z position
328  double StartPosition[3];
329 
331 
334  // SeparatingDistance can be in cell length or arc length. This member
335  // stores SeparatingDistance in arc length. It is computed when
336  // the filter executes.
340  // ClosedLoopMaximumDistance can be in cell length or arc length.
341  // This member stores ClosedLoopMaximumDistance in arc length. It is
342  // computed when the filter executes.
344  double LoopAngle;
346 
350 
351  // Prototype showing the integrator type to be set by the user.
353 
355 
357 
359  // grid superposed over InputData. The grid cell height and width is
360  // SeparatingDistance
362  // AllPoints[i][j] is the point for point j on the streamlines that
363  // falls over cell id i in SuperposedGrid. AllPoint[i].size() tell
364  // us how many points fall over cell id i.
365  std::vector<std::vector<std::array<double, 3> > > AllPoints;
366 
367  // CurrentPoints[i][j] is the point id for point j on the current streamline that
368  // falls over cell id i in SuperposedGrid. CurrentPoints[i].size() tell us
369  // how many points fall over cell id i.
370  std::vector<std::vector<vtkIdType> > CurrentPoints;
371  // Min and Max point ids stored in a cell of SuperposedGrid
372  std::vector<vtkIdType> MinPointIds;
373  // The index of the first point for the current
374  // direction. Note we integrate streamlines both forward and
375  // backward.
377  // The previous integration direction.
379 
380  // queue of streamlines to be processed
382 
383 private:
385  void operator=(const vtkEvenlySpacedStreamlines2D&) = delete;
386 };
387 
388 #endif
389 
390 // VTK-HeaderTest-Exclude: vtkEvenlySpacedStreamlines2D.h
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:338
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:46
provides thread-safe access to cells
dynamic, self-adjusting array of double
static vtkPolyDataAlgorithm * New()
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:39
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:33
topologically and geometrically regular array of data
Definition: vtkImageData.h:41
list of point or cell ids
Definition: vtkIdList.h:30
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
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:59
represent and manipulate 3D points
Definition: vtkPoints.h:33
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.