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 =========================================================================*/
89 #ifndef vtkEvenlySpacedStreamlines2D_h
90 #define vtkEvenlySpacedStreamlines2D_h
91 
92 #include "vtkFiltersFlowPathsModule.h" // For export macro
93 #include "vtkPolyDataAlgorithm.h"
94 
95 #include <array>
96 #include <vector>
97 
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 
195 
197 
204  vtkSetMacro(InitialIntegrationStep, double);
205  vtkGetMacro(InitialIntegrationStep, double);
207 
209 
213  vtkSetMacro(SeparatingDistance, double);
214  vtkGetMacro(SeparatingDistance, double);
216 
218 
222  vtkSetMacro(SeparatingDistanceRatio, double);
223  vtkGetMacro(SeparatingDistanceRatio, double);
225 
227 
231  vtkSetMacro(ClosedLoopMaximumDistance, double);
232  vtkGetMacro(ClosedLoopMaximumDistance, double);
234 
236 
241  vtkSetMacro(LoopAngle, double);
242  vtkGetMacro(LoopAngle, double);
244 
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 
279  void SetInterpolatorType( int interpType );
280 
281 protected:
283  ~vtkEvenlySpacedStreamlines2D() override;
284 
289  {
291  DISTANCE_RATIO
292  };
293  // hide the superclass' AddInput() from the user and the compiler
295  {
296  vtkErrorMacro(<< "AddInput() must be called with a vtkDataSet not a vtkDataObject.");
297  }
298 
301  int FillInputPortInformation(int, vtkInformation *) override;
302 
303  int SetupOutput(vtkInformation* inInfo, vtkInformation* outInfo);
304  int CheckInputs(vtkAbstractInterpolatedVelocityField*& func,
305  int* maxCellSize);
306  double ConvertToLength(double interval, int unit, double cellLength );
307 
308  static void GetBounds(vtkCompositeDataSet* cds, double bounds[6]);
309  void InitializeSuperposedGrid(double* bounds);
310  void AddToAllPoints(vtkPolyData* streamline);
311  void AddToCurrentPoints(vtkIdType pointId);
312  template<typename T> void InitializePoints(T& points);
313  void InitializeMinPointIds();
314 
315  static bool IsStreamlineLooping(
316  void* clientdata,
317  vtkPoints* points, vtkDataArray* velocity, int direction);
318  static bool IsStreamlineTooCloseToOthers(
319  void* clientdata,
320  vtkPoints* points, vtkDataArray* velocity, int direction);
321  template<typename CellCheckerType>
322  bool ForEachCell(double* point, CellCheckerType checker,
323  vtkPoints* points = nullptr,
324  vtkDataArray* velocity = nullptr,
325  int direction = 1);
326  template <int distanceType>
327  bool IsTooClose(double* point, vtkIdType cellId,
328  vtkPoints* points,
329  vtkDataArray* velocity, int direction);
330  bool IsLooping(double* point, vtkIdType cellId,
331  vtkPoints* points, vtkDataArray* velocity, int direction);
332  const char* GetInputArrayToProcessName();
333  int ComputeCellLength(double* cellLength);
334 
335  // starting from global x-y-z position
336  double StartPosition[3];
337 
339 
342  // SeparatingDistance can be in cell length or arc length. This member
343  // stores SeparatingDistance in arc length. It is computed when
344  // the filter executes.
348  // ClosedLoopMaximumDistance can be in cell length or arc length.
349  // This member stores ClosedLoopMaximumDistance in arc length. It is
350  // computed when the filter executes.
352  double LoopAngle;
354 
358 
359  // Prototype showing the integrator type to be set by the user.
361 
363 
365 
367  // grid superposed over InputData. The grid cell height and width is
368  // SeparatingDistance
370  // AllPoints[i][j] is the point for point j on the streamlines that
371  // falls over cell id i in SuperposedGrid. AllPoint[i].size() tell
372  // us how many points fall over cell id i.
373  std::vector<std::vector<std::array<double,3> > > AllPoints;
374 
375  // CurrentPoints[i][j] is the point id for point j on the current streamline that
376  // falls over cell id i in SuperposedGrid. CurrentPoints[i].size() tell us
377  // how many points fall over cell id i.
378  std::vector<std::vector<vtkIdType> > CurrentPoints;
379  // Min and Max point ids stored in a cell of SuperposedGrid
380  std::vector<vtkIdType> MinPointIds;
381  // The index of the first point for the current
382  // direction. Note we integrate streamlines both forward and
383  // backward.
385  // The previous integration direction.
387 
388  // queue of streamlines to be processed
390 private:
392  const vtkEvenlySpacedStreamlines2D&) = delete;
393  void operator=(const vtkEvenlySpacedStreamlines2D&) = delete;
394 };
395 
396 
397 #endif
398 
399 // 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:79
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:46
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: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:39
list of point or cell ids
Definition: vtkIdList.h:30
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
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:58
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.