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
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:33
vtkEvenlySpacedStreamlines2D::MinimumNumberOfStreamlinePoints
vtkIdType MinimumNumberOfStreamlinePoints
Definition: vtkEvenlySpacedStreamlines2D.h:356
vtkPolyDataCollection
maintain a list of polygonal data objects
Definition: vtkPolyDataCollection.h:34
vtkEvenlySpacedStreamlines2D::AllPoints
std::vector< std::vector< std::array< double, 3 > > > AllPoints
Definition: vtkEvenlySpacedStreamlines2D.h:373
vtkEvenlySpacedStreamlines2D::GetIntegrationStepUnit
int GetIntegrationStepUnit()
Definition: vtkEvenlySpacedStreamlines2D.h:176
vtkEvenlySpacedStreamlines2D::InterpolatorPrototype
vtkAbstractInterpolatedVelocityField * InterpolatorPrototype
Definition: vtkEvenlySpacedStreamlines2D.h:364
vtkEvenlySpacedStreamlines2D::SeparatingDistance
double SeparatingDistance
Definition: vtkEvenlySpacedStreamlines2D.h:341
vtkX3D::type
Definition: vtkX3D.h:516
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkX3D::direction
Definition: vtkX3D.h:260
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkEvenlySpacedStreamlines2D::DistanceType
DistanceType
Do we test for separating distance or a ratio of the separating distance.
Definition: vtkEvenlySpacedStreamlines2D.h:288
vtkEvenlySpacedStreamlines2D::CurrentPoints
std::vector< std::vector< vtkIdType > > CurrentPoints
Definition: vtkEvenlySpacedStreamlines2D.h:378
vtkEvenlySpacedStreamlines2D::Integrator
vtkInitialValueProblemSolver * Integrator
Definition: vtkEvenlySpacedStreamlines2D.h:360
vtkEvenlySpacedStreamlines2D
Evenly spaced streamline generator for 2D.
Definition: vtkEvenlySpacedStreamlines2D.h:113
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
vtkPolyDataAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkCompositeDataSet
abstract superclass for composite (multi-block or AMR) datasets
Definition: vtkCompositeDataSet.h:45
vtkEvenlySpacedStreamlines2D::MinPointIds
std::vector< vtkIdType > MinPointIds
Definition: vtkEvenlySpacedStreamlines2D.h:380
vtkEvenlySpacedStreamlines2D::AddInput
void AddInput(vtkDataObject *)
Definition: vtkEvenlySpacedStreamlines2D.h:294
vtkPolyDataAlgorithm.h
vtkEvenlySpacedStreamlines2D::IntegrationStepUnit
int IntegrationStepUnit
Definition: vtkEvenlySpacedStreamlines2D.h:353
vtkX3D::points
Definition: vtkX3D.h:446
vtkExecutive
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:46
vtkX3D::point
Definition: vtkX3D.h:236
vtkEvenlySpacedStreamlines2D::MinimumNumberOfLoopPoints
vtkIdType MinimumNumberOfLoopPoints
Definition: vtkEvenlySpacedStreamlines2D.h:357
vtkPolyDataAlgorithm::RequestData
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
vtkEvenlySpacedStreamlines2D::ClosedLoopMaximumDistanceArcLength
double ClosedLoopMaximumDistanceArcLength
Definition: vtkEvenlySpacedStreamlines2D.h:351
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkIntArray
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:39
vtkEvenlySpacedStreamlines2D::SuperposedGrid
vtkImageData * SuperposedGrid
Definition: vtkEvenlySpacedStreamlines2D.h:369
vtkEvenlySpacedStreamlines2D::InitialIntegrationStep
double InitialIntegrationStep
Definition: vtkEvenlySpacedStreamlines2D.h:340
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:30
vtkEvenlySpacedStreamlines2D::ClosedLoopMaximumDistance
double ClosedLoopMaximumDistance
Definition: vtkEvenlySpacedStreamlines2D.h:347
vtkStreamTracer
Streamline generator.
Definition: vtkStreamTracer.h:101
vtkPolyDataAlgorithm::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkEvenlySpacedStreamlines2D::PreviousDirection
int PreviousDirection
Definition: vtkEvenlySpacedStreamlines2D.h:386
vtkEvenlySpacedStreamlines2D::InputData
vtkCompositeDataSet * InputData
Definition: vtkEvenlySpacedStreamlines2D.h:366
vtkEvenlySpacedStreamlines2D::SeparatingDistanceRatio
double SeparatingDistanceRatio
Definition: vtkEvenlySpacedStreamlines2D.h:346
vtkEvenlySpacedStreamlines2D::SeparatingDistanceArcLength
double SeparatingDistanceArcLength
Definition: vtkEvenlySpacedStreamlines2D.h:345
vtkAbstractInterpolatedVelocityField
An abstract class for obtaining the interpolated velocity values at a point.
Definition: vtkAbstractInterpolatedVelocityField.h:84
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:80
vtkEvenlySpacedStreamlines2D::Streamlines
vtkPolyDataCollection * Streamlines
Definition: vtkEvenlySpacedStreamlines2D.h:389
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
vtkGenericCell
provides thread-safe access to cells
Definition: vtkGenericCell.h:36
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:35
vtkEvenlySpacedStreamlines2D::MaximumNumberOfSteps
vtkIdType MaximumNumberOfSteps
Definition: vtkEvenlySpacedStreamlines2D.h:355
vtkEvenlySpacedStreamlines2D::TerminalSpeed
double TerminalSpeed
Definition: vtkEvenlySpacedStreamlines2D.h:338
vtkInitialValueProblemSolver
Integrate a set of ordinary differential equations (initial value problem) in time.
Definition: vtkInitialValueProblemSolver.h:40
vtkEvenlySpacedStreamlines2D::LoopAngle
double LoopAngle
Definition: vtkEvenlySpacedStreamlines2D.h:352
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:58
vtkEvenlySpacedStreamlines2D::DISTANCE
Definition: vtkEvenlySpacedStreamlines2D.h:290
vtkEvenlySpacedStreamlines2D::ComputeVorticity
bool ComputeVorticity
Definition: vtkEvenlySpacedStreamlines2D.h:362
vtkPolyDataAlgorithm::New
static vtkPolyDataAlgorithm * New()
vtkEvenlySpacedStreamlines2D::DirectionStart
vtkIdType DirectionStart
Definition: vtkEvenlySpacedStreamlines2D.h:384
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:41