VTK
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>
99 #include <vector>
100 
101 
103 class vtkCompositeDataSet;
104 class vtkDataArray;
105 class vtkDoubleArray;
106 class vtkExecutive;
107 class vtkGenericCell;
108 class vtkIdList;
110 class vtkImageData;
111 class vtkIntArray;
113 class vtkPoints;
114 class vtkStreamTracer;
115 
116 class VTKFILTERSFLOWPATHS_EXPORT vtkEvenlySpacedStreamlines2D : public vtkPolyDataAlgorithm
117 {
118 public:
120  void PrintSelf(ostream& os, vtkIndent indent) override;
121 
130 
132 
138  vtkSetVector3Macro(StartPosition, double);
139  vtkGetVector3Macro(StartPosition, double);
141 
143 
152  void SetIntegrator(vtkInitialValueProblemSolver *);
153  vtkGetObjectMacro ( Integrator, vtkInitialValueProblemSolver );
154  void SetIntegratorType(int type);
155  int GetIntegratorType();
156  void SetIntegratorTypeToRungeKutta2();
157  void SetIntegratorTypeToRungeKutta4();
159 
164  void SetInterpolatorTypeToDataSetPointLocator();
165 
170  void SetInterpolatorTypeToCellLocator();
171 
178  void SetIntegrationStepUnit( int unit );
179  int GetIntegrationStepUnit() { return this->IntegrationStepUnit; }
180 
182 
185  vtkSetMacro(MaximumNumberOfSteps, vtkIdType);
186  vtkGetMacro(MaximumNumberOfSteps, vtkIdType);
188 
190 
194  vtkSetMacro(MinimumNumberOfLoopPoints, vtkIdType);
195  vtkGetMacro(MinimumNumberOfLoopPoints, vtkIdType);
197 
198 
200 
207  vtkSetMacro(InitialIntegrationStep, double);
208  vtkGetMacro(InitialIntegrationStep, double);
210 
212 
216  vtkSetMacro(SeparatingDistance, double);
217  vtkGetMacro(SeparatingDistance, double);
219 
221 
225  vtkSetMacro(SeparatingDistanceRatio, double);
226  vtkGetMacro(SeparatingDistanceRatio, double);
228 
230 
234  vtkSetMacro(ClosedLoopMaximumDistance, double);
235  vtkGetMacro(ClosedLoopMaximumDistance, double);
237 
239 
244  vtkSetMacro(LoopAngle, double);
245  vtkGetMacro(LoopAngle, double);
247 
248 
250 
253  vtkSetMacro(TerminalSpeed, double);
254  vtkGetMacro(TerminalSpeed, double);
256 
258 
263  vtkSetMacro(ComputeVorticity, bool);
264  vtkGetMacro(ComputeVorticity, bool);
266 
271  void SetInterpolatorPrototype( vtkAbstractInterpolatedVelocityField * ivf );
272 
282  void SetInterpolatorType( int interpType );
283 
284 protected:
286  ~vtkEvenlySpacedStreamlines2D() override;
287 
292  {
294  DISTANCE_RATIO
295  };
296  // hide the superclass' AddInput() from the user and the compiler
298  {
299  vtkErrorMacro(<< "AddInput() must be called with a vtkDataSet not a vtkDataObject.");
300  }
301 
304  int FillInputPortInformation(int, vtkInformation *) override;
305 
306  int SetupOutput(vtkInformation* inInfo, vtkInformation* outInfo);
307  int CheckInputs(vtkAbstractInterpolatedVelocityField*& func,
308  int* maxCellSize);
309  double ConvertToLength(double interval, int unit, double cellLength );
310 
311  static void GetBounds(vtkCompositeDataSet* cds, double bounds[6]);
312  void InitializeSuperposedGrid(double* bounds);
313  void AddToAllPoints(vtkPolyData* streamline);
314  void AddToCurrentPoints(vtkIdType pointId);
315  template<typename T> void InitializePoints(T& points);
316  void InitializeMinPointIds();
317 
318  static bool IsStreamlineLooping(
319  void* clientdata,
320  vtkPoints* points, vtkDataArray* velocity, int direction);
321  static bool IsStreamlineTooCloseToOthers(
322  void* clientdata,
323  vtkPoints* points, vtkDataArray* velocity, int direction);
324  template<typename CellCheckerType>
325  bool ForEachCell(double* point, CellCheckerType checker,
326  vtkPoints* points = nullptr,
327  vtkDataArray* velocity = nullptr,
328  int direction = 1);
329  template <int distanceType>
330  bool IsTooClose(double* point, vtkIdType cellId,
331  vtkPoints* points,
332  vtkDataArray* velocity, int direction);
333  bool IsLooping(double* point, vtkIdType cellId,
334  vtkPoints* points, vtkDataArray* velocity, int direction);
335  const char* GetInputArrayToProcessName();
336  int ComputeCellLength(double* cellLength);
337 
338  // starting from global x-y-z position
339  double StartPosition[3];
340 
342 
345  // SeparatingDistance can be in cell length or arc length. This member
346  // stores SeparatingDistance in arc length. It is computed when
347  // the filter executes.
351  // ClosedLoopMaximumDistance can be in cell length or arc length.
352  // This member stores ClosedLoopMaximumDistance in arc length. It is
353  // computed when the filter executes.
355  double LoopAngle;
357 
361 
362  // Prototype showing the integrator type to be set by the user.
364 
366 
368 
370  // grid superposed over InputData. The grid cell height and width is
371  // SeparatingDistance
373  // AllPoints[i][j] is the point for point j on the streamlines that
374  // falls over cell id i in SuperposedGrid. AllPoint[i].size() tell
375  // us how many points fall over cell id i.
376  std::vector<std::vector<std::array<double,3> > > AllPoints;
377 
378  // CurrentPoints[i][j] is the point id for point j on the current streamline that
379  // falls over cell id i in SuperposedGrid. CurrentPoints[i].size() tell us
380  // how many points fall over cell id i.
381  std::vector<std::vector<vtkIdType> > CurrentPoints;
382  // Min and Max point ids stored in a cell of SuperposedGrid
383  std::vector<vtkIdType> MinPointIds;
384  // The index of the first point for the current
385  // direction. Note we integrate streamlines both forward and
386  // backward.
388  // The previous integration direction.
390 
391  // queue of streamlines to be processed
393 private:
395  const vtkEvenlySpacedStreamlines2D&) = delete;
396  void operator=(const vtkEvenlySpacedStreamlines2D&) = delete;
397 };
398 
399 
400 #endif
401 
402 // 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:347
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:49
provides thread-safe access to cells
dynamic, self-adjusting array of double
std::vector< std::vector< std::array< double, 3 > > > AllPoints
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:45
list of point or cell ids
Definition: vtkIdList.h:36
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
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:64
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.