VTK
vtkStreamTracer.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkStreamTracer.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 =========================================================================*/
86 #ifndef vtkStreamTracer_h
87 #define vtkStreamTracer_h
88 
89 #include "vtkFiltersFlowPathsModule.h" // For export macro
90 #include "vtkPolyDataAlgorithm.h"
91 
92 #include "vtkInitialValueProblemSolver.h" // Needed for constants
93 
96 class vtkDataArray;
98 class vtkDoubleArray;
99 class vtkExecutive;
100 class vtkGenericCell;
101 class vtkIdList;
102 class vtkIntArray;
103 class vtkPoints;
104 
105 #include <vector>
106 
107 class VTKFILTERSFLOWPATHS_EXPORT vtkStreamTracer : public vtkPolyDataAlgorithm
108 {
109 public:
111  void PrintSelf(ostream& os, vtkIndent indent) override;
112 
120  static vtkStreamTracer *New();
121 
123 
128  vtkSetVector3Macro(StartPosition, double);
129  vtkGetVector3Macro(StartPosition, double);
131 
133 
139  void SetSourceData(vtkDataSet *source);
140  vtkDataSet *GetSource();
142 
147  void SetSourceConnection(vtkAlgorithmOutput* algOutput);
148 
149  // The previously-supported TIME_UNIT is excluded in this current
150  // enumeration definition because the underlying step size is ALWAYS in
151  // arc length unit (LENGTH_UNIT) while the 'real' time interval (virtual
152  // for steady flows) that a particle actually takes to trave in a single
153  // step is obtained by dividing the arc length by the LOCAL speed. The
154  // overall elapsed time (i.e., the life span) of the particle is the sum
155  // of those individual step-wise time intervals. The arc-length-to-time
156  // conversion only occurs for vorticity computation and for generating a
157  // point data array named 'IntegrationTime'.
158  enum Units
159  {
160  LENGTH_UNIT = 1,
161  CELL_LENGTH_UNIT = 2
162  };
163 
164  enum Solvers
165  {
170  UNKNOWN
171  };
172 
174  {
178  OUT_OF_LENGTH = 4,
179  OUT_OF_STEPS = 5,
180  STAGNATION = 6,
181  FIXED_REASONS_FOR_TERMINATION_COUNT
182  };
183 
185 
195  void SetIntegrator(vtkInitialValueProblemSolver *);
196  vtkGetObjectMacro ( Integrator, vtkInitialValueProblemSolver );
197  void SetIntegratorType(int type);
198  int GetIntegratorType();
200  {this->SetIntegratorType(RUNGE_KUTTA2);};
202  {this->SetIntegratorType(RUNGE_KUTTA4);};
204  {this->SetIntegratorType(RUNGE_KUTTA45);};
206 
211  void SetInterpolatorTypeToDataSetPointLocator();
212 
217  void SetInterpolatorTypeToCellLocator();
218 
220 
223  vtkSetMacro(MaximumPropagation, double);
224  vtkGetMacro(MaximumPropagation, double);
226 
233  void SetIntegrationStepUnit( int unit );
234  int GetIntegrationStepUnit() { return this->IntegrationStepUnit; }
235 
237 
244  vtkSetMacro(InitialIntegrationStep, double);
245  vtkGetMacro(InitialIntegrationStep, double);
247 
249 
255  vtkSetMacro(MinimumIntegrationStep, double);
256  vtkGetMacro(MinimumIntegrationStep, double);
258 
260 
266  vtkSetMacro(MaximumIntegrationStep, double);
267  vtkGetMacro(MaximumIntegrationStep, double);
269 
271 
274  vtkSetMacro(MaximumError, double);
275  vtkGetMacro(MaximumError, double);
277 
279 
282  vtkSetMacro(MaximumNumberOfSteps, vtkIdType);
283  vtkGetMacro(MaximumNumberOfSteps, vtkIdType);
285 
287 
290  vtkSetMacro(TerminalSpeed, double);
291  vtkGetMacro(TerminalSpeed, double);
293 
295 
298  vtkGetMacro(SurfaceStreamlines, bool);
299  vtkSetMacro(SurfaceStreamlines, bool);
300  vtkBooleanMacro(SurfaceStreamlines, bool);
302 
303  enum
304  {
307  BOTH
308  };
309 
310  enum
311  {
313  INTERPOLATOR_WITH_CELL_LOCATOR
314  };
315 
317 
321  vtkSetClampMacro(IntegrationDirection, int, FORWARD, BOTH);
322  vtkGetMacro(IntegrationDirection, int);
324  {this->SetIntegrationDirection(FORWARD);};
326  {this->SetIntegrationDirection(BACKWARD);};
328  {this->SetIntegrationDirection(BOTH);};
330 
332 
337  vtkSetMacro(ComputeVorticity, bool);
338  vtkGetMacro(ComputeVorticity, bool);
340 
342 
346  vtkSetMacro(RotationScale, double);
347  vtkGetMacro(RotationScale, double);
349 
354  void SetInterpolatorPrototype( vtkAbstractInterpolatedVelocityField * ivf );
355 
365  void SetInterpolatorType( int interpType );
366 
376  typedef bool (*CustomTerminationCallbackType)(void * clientdata,
377  vtkPoints* points,
378  vtkDataArray* velocity,
379  int integrationDirection);
388  void AddCustomTerminationCallback(
389  CustomTerminationCallbackType callback, void* clientdata, int reasonForTermination);
390 
391 protected:
392 
393  vtkStreamTracer();
394  ~vtkStreamTracer() override;
395 
396  // Create a default executive.
398 
399  // hide the superclass' AddInput() from the user and the compiler
401  { vtkErrorMacro( << "AddInput() must be called with a vtkDataSet not a vtkDataObject."); };
402 
404  int FillInputPortInformation(int, vtkInformation *) override;
405 
406  void CalculateVorticity( vtkGenericCell* cell, double pcoords[3],
407  vtkDoubleArray* cellVectors, double vorticity[3] );
408  void Integrate(vtkPointData *inputData,
409  vtkPolyData* output,
410  vtkDataArray* seedSource,
411  vtkIdList* seedIds,
412  vtkIntArray* integrationDirections,
413  double lastPoint[3],
415  int maxCellSize,
416  int vecType,
417  const char *vecFieldName,
418  double& propagation,
419  vtkIdType& numSteps,
420  double& integrationTime);
421  double SimpleIntegrate(double seed[3],
422  double lastPoint[3],
423  double stepSize,
425  int CheckInputs(vtkAbstractInterpolatedVelocityField*& func,
426  int* maxCellSize);
427  void GenerateNormals(vtkPolyData* output, double* firstNormal, const char *vecName);
428 
430 
431  // starting from global x-y-z position
432  double StartPosition[3];
433 
434  static const double EPSILON;
436 
438 
440  {
441  double Interval;
442  int Unit;
443  };
444 
449 
450  void ConvertIntervals( double& step, double& minStep, double& maxStep,
451  int direction, double cellLength );
452  static double ConvertToLength( double interval, int unit, double cellLength );
453  static double ConvertToLength( IntervalInformation& interval, double cellLength );
454 
455  int SetupOutput(vtkInformation* inInfo,
456  vtkInformation* outInfo);
457  void InitializeSeeds(vtkDataArray*& seeds,
458  vtkIdList*& seedIds,
459  vtkIntArray*& integrationDirections,
460  vtkDataSet *source);
461 
464 
465  // Prototype showing the integrator type to be set by the user.
467 
468  double MaximumError;
470 
473 
474  // Compute streamlines only on surface.
476 
478 
480  bool HasMatchingPointAttributes; //does the point data in the multiblocks have the same attributes?
481  std::vector<CustomTerminationCallbackType> CustomTerminationCallback;
482  std::vector<void*> CustomTerminationClientData;
483  std::vector<int> CustomReasonForTermination;
484 
485  friend class PStreamTracerUtils;
486 
487 private:
488  vtkStreamTracer(const vtkStreamTracer&) = delete;
489  void operator=(const vtkStreamTracer&) = delete;
490 };
491 
492 
493 #endif
494 // VTK-HeaderTest-Exclude: vtkStreamTracer.h
void SetIntegrationDirectionToBoth()
Specify whether the streamline is integrated in the upstream or downstream direction.
static const double EPSILON
represent and manipulate point attribute data
Definition: vtkPointData.h:37
virtual vtkExecutive * CreateDefaultExecutive()
Create a default executive.
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
An abstract class for obtaining the interpolated velocity values at a point.
void AddInput(vtkDataObject *)
bool GenerateNormalsInIntegrate
vtkCompositeDataSet * InputData
int vtkIdType
Definition: vtkType.h:345
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:49
double MinimumIntegrationStep
provides thread-safe access to cells
vtkIdType MaximumNumberOfSteps
Proxy object to connect input/output ports.
dynamic, self-adjusting array of double
static vtkPolyDataAlgorithm * New()
void SetIntegrationDirectionToForward()
Specify whether the streamline is integrated in the upstream or downstream direction.
std::vector< int > CustomReasonForTermination
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
int GetIntegrationStepUnit()
list of point or cell ids
Definition: vtkIdList.h:36
vtkInitialValueProblemSolver * Integrator
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
void SetIntegratorTypeToRungeKutta4()
Set/get the integrator type to be used for streamline generation.
std::vector< CustomTerminationCallbackType > CustomTerminationCallback
represent and manipulate attribute data in a dataset
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
double MaximumIntegrationStep
void SetIntegratorTypeToRungeKutta2()
Set/get the integrator type to be used for streamline generation.
boost::graph_traits< vtkGraph *>::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
void SetIntegratorTypeToRungeKutta45()
Set/get the integrator type to be used for streamline generation.
double InitialIntegrationStep
vtkAbstractInterpolatedVelocityField * InterpolatorPrototype
std::vector< void * > CustomTerminationClientData
Streamline generator.
void SetIntegrationDirectionToBackward()
Specify whether the streamline is integrated in the upstream or downstream direction.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
Store zero or more vtkInformation instances.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
bool HasMatchingPointAttributes
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.