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 
95 class vtkDataArray;
96 class vtkDoubleArray;
97 class vtkExecutive;
98 class vtkGenericCell;
99 class vtkIdList;
100 class vtkIntArray;
102 
103 class VTKFILTERSFLOWPATHS_EXPORT vtkStreamTracer : public vtkPolyDataAlgorithm
104 {
105 public:
107  void PrintSelf(ostream& os, vtkIndent indent);
108 
116  static vtkStreamTracer *New();
117 
119 
124  vtkSetVector3Macro(StartPosition, double);
125  vtkGetVector3Macro(StartPosition, double);
127 
129 
135  void SetSourceData(vtkDataSet *source);
136  vtkDataSet *GetSource();
138 
143  void SetSourceConnection(vtkAlgorithmOutput* algOutput);
144 
145  // The previously-supported TIME_UNIT is excluded in this current
146  // enumeration definition because the underlying step size is ALWAYS in
147  // arc length unit (LENGTH_UNIT) while the 'real' time interval (virtual
148  // for steady flows) that a particle actually takes to trave in a single
149  // step is obtained by dividing the arc length by the LOCAL speed. The
150  // overall elapsed time (i.e., the life span) of the particle is the sum
151  // of those individual step-wise time intervals. The arc-length-to-time
152  // conversion only occurs for vorticity computation and for generating a
153  // point data array named 'IntegrationTime'.
154  enum Units
155  {
156  LENGTH_UNIT = 1,
157  CELL_LENGTH_UNIT = 2
158  };
159 
160  enum Solvers
161  {
166  UNKNOWN
167  };
168 
170  {
174  OUT_OF_LENGTH = 4,
175  OUT_OF_STEPS = 5,
176  STAGNATION = 6
177  };
178 
180 
190  void SetIntegrator(vtkInitialValueProblemSolver *);
191  vtkGetObjectMacro ( Integrator, vtkInitialValueProblemSolver );
192  void SetIntegratorType(int type);
193  int GetIntegratorType();
195  {this->SetIntegratorType(RUNGE_KUTTA2);};
197  {this->SetIntegratorType(RUNGE_KUTTA4);};
199  {this->SetIntegratorType(RUNGE_KUTTA45);};
201 
206  void SetInterpolatorTypeToDataSetPointLocator();
207 
212  void SetInterpolatorTypeToCellLocator();
213 
215 
218  vtkSetMacro(MaximumPropagation, double);
219  vtkGetMacro(MaximumPropagation, double);
221 
228  void SetIntegrationStepUnit( int unit );
229  int GetIntegrationStepUnit() { return this->IntegrationStepUnit; }
230 
232 
239  vtkSetMacro(InitialIntegrationStep, double);
240  vtkGetMacro(InitialIntegrationStep, double);
242 
244 
250  vtkSetMacro(MinimumIntegrationStep, double);
251  vtkGetMacro(MinimumIntegrationStep, double);
253 
255 
261  vtkSetMacro(MaximumIntegrationStep, double);
262  vtkGetMacro(MaximumIntegrationStep, double);
264 
266 
269  vtkSetMacro(MaximumError, double);
270  vtkGetMacro(MaximumError, double);
272 
274 
277  vtkSetMacro(MaximumNumberOfSteps, vtkIdType);
278  vtkGetMacro(MaximumNumberOfSteps, vtkIdType);
280 
282 
285  vtkSetMacro(TerminalSpeed, double);
286  vtkGetMacro(TerminalSpeed, double);
288 
290 
293  vtkGetMacro(SurfaceStreamlines, bool);
294  vtkSetMacro(SurfaceStreamlines, bool);
295  vtkBooleanMacro(SurfaceStreamlines, bool);
297 
298  enum
299  {
302  BOTH
303  };
304 
305  enum
306  {
308  INTERPOLATOR_WITH_CELL_LOCATOR
309  };
310 
312 
316  vtkSetClampMacro(IntegrationDirection, int, FORWARD, BOTH);
317  vtkGetMacro(IntegrationDirection, int);
319  {this->SetIntegrationDirection(FORWARD);};
321  {this->SetIntegrationDirection(BACKWARD);};
323  {this->SetIntegrationDirection(BOTH);};
325 
327 
332  vtkSetMacro(ComputeVorticity, bool);
333  vtkGetMacro(ComputeVorticity, bool);
335 
337 
341  vtkSetMacro(RotationScale, double);
342  vtkGetMacro(RotationScale, double);
344 
349  void SetInterpolatorPrototype( vtkAbstractInterpolatedVelocityField * ivf );
350 
360  void SetInterpolatorType( int interpType );
361 
362 protected:
363 
364  vtkStreamTracer();
365  ~vtkStreamTracer();
366 
367  // Create a default executive.
369 
370  // hide the superclass' AddInput() from the user and the compiler
372  { vtkErrorMacro( << "AddInput() must be called with a vtkDataSet not a vtkDataObject."); };
373 
375  virtual int FillInputPortInformation(int, vtkInformation *);
376 
377  void CalculateVorticity( vtkGenericCell* cell, double pcoords[3],
378  vtkDoubleArray* cellVectors, double vorticity[3] );
379  void Integrate(vtkPointData *inputData,
380  vtkPolyData* output,
381  vtkDataArray* seedSource,
382  vtkIdList* seedIds,
383  vtkIntArray* integrationDirections,
384  double lastPoint[3],
386  int maxCellSize,
387  int vecType,
388  const char *vecFieldName,
389  double& propagation,
390  vtkIdType& numSteps,
391  double& integrationTime);
392  double SimpleIntegrate(double seed[3],
393  double lastPoint[3],
394  double stepSize,
396  int CheckInputs(vtkAbstractInterpolatedVelocityField*& func,
397  int* maxCellSize);
398  void GenerateNormals(vtkPolyData* output, double* firstNormal, const char *vecName);
399 
401 
402  // starting from global x-y-z position
403  double StartPosition[3];
404 
405  static const double EPSILON;
407 
409 
411  {
412  double Interval;
413  int Unit;
414  };
415 
420 
421  void ConvertIntervals( double& step, double& minStep, double& maxStep,
422  int direction, double cellLength );
423  static double ConvertToLength( double interval, int unit, double cellLength );
424  static double ConvertToLength( IntervalInformation& interval, double cellLength );
425 
426  int SetupOutput(vtkInformation* inInfo,
427  vtkInformation* outInfo);
428  void InitializeSeeds(vtkDataArray*& seeds,
429  vtkIdList*& seedIds,
430  vtkIntArray*& integrationDirections,
431  vtkDataSet *source);
432 
435 
436  // Prototype showing the integrator type to be set by the user.
438 
439  double MaximumError;
441 
444 
445  // Compute streamlines only on surface.
447 
449 
451  bool HasMatchingPointAttributes; //does the point data in the multiblocks have the same attributes?
452 
453  friend class PStreamTracerUtils;
454 
455 private:
456  vtkStreamTracer(const vtkStreamTracer&) VTK_DELETE_FUNCTION;
457  void operator=(const vtkStreamTracer&) VTK_DELETE_FUNCTION;
458 };
459 
460 
461 #endif
vtkAlgorithm::CreateDefaultExecutive
virtual vtkExecutive * CreateDefaultExecutive()
Create a default executive.
vtkStreamTracer::InputData
vtkCompositeDataSet * InputData
Definition: vtkStreamTracer.h:450
vtkStreamTracer::SetIntegratorTypeToRungeKutta2
void SetIntegratorTypeToRungeKutta2()
Definition: vtkStreamTracer.h:194
vtkStreamTracer::TerminalSpeed
double TerminalSpeed
Definition: vtkStreamTracer.h:406
vtkStreamTracer::HasMatchingPointAttributes
bool HasMatchingPointAttributes
Definition: vtkStreamTracer.h:451
vtkStreamTracer::GenerateNormalsInIntegrate
bool GenerateNormalsInIntegrate
Definition: vtkStreamTracer.h:400
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:37
vtkStreamTracer::GetIntegrationStepUnit
int GetIntegrationStepUnit()
Definition: vtkStreamTracer.h:229
vtkX3D::type
Definition: vtkX3D.h:516
vtkIdType
int vtkIdType
Definition: vtkType.h:287
vtkX3D::direction
Definition: vtkX3D.h:260
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkStreamTracer::Integrator
vtkInitialValueProblemSolver * Integrator
Definition: vtkStreamTracer.h:437
vtkStreamTracer::BACKWARD
Definition: vtkStreamTracer.h:301
vtkStreamTracer::MaximumPropagation
double MaximumPropagation
Definition: vtkStreamTracer.h:416
vtkStreamTracer::IntervalInformation::Interval
double Interval
Definition: vtkStreamTracer.h:412
vtkStreamTracer::SetIntegrationDirectionToForward
void SetIntegrationDirectionToForward()
Definition: vtkStreamTracer.h:318
vtkStreamTracer::MaximumError
double MaximumError
Definition: vtkStreamTracer.h:439
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
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:51
vtkStreamTracer::ComputeVorticity
bool ComputeVorticity
Definition: vtkStreamTracer.h:442
vtkPolyDataAlgorithm.h
source
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:822
vtkExecutive
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:49
vtkStreamTracer::MaximumNumberOfSteps
vtkIdType MaximumNumberOfSteps
Definition: vtkStreamTracer.h:440
vtkStreamTracer::SetIntegrationDirectionToBoth
void SetIntegrationDirectionToBoth()
Definition: vtkStreamTracer.h:322
vtkStreamTracer::LastUsedStepSize
double LastUsedStepSize
Definition: vtkStreamTracer.h:408
vtkPolyDataAlgorithm::RequestData
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
vtkStreamTracer::NONE
Definition: vtkStreamTracer.h:165
vtkStreamTracer::SetIntegratorTypeToRungeKutta45
void SetIntegratorTypeToRungeKutta45()
Definition: vtkStreamTracer.h:198
vtkStreamTracer::MinimumIntegrationStep
double MinimumIntegrationStep
Definition: vtkStreamTracer.h:417
vtkStreamTracer::IntervalInformation
Definition: vtkStreamTracer.h:410
vtkStreamTracer::EPSILON
static const double EPSILON
Definition: vtkStreamTracer.h:405
vtkStreamTracer::RUNGE_KUTTA4
Definition: vtkStreamTracer.h:163
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkInitialValueProblemSolver.h
vtkIntArray
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:45
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:36
vtkStreamTracer::AddInput
void AddInput(vtkDataObject *)
Definition: vtkStreamTracer.h:371
vtkStreamTracer
Streamline generator.
Definition: vtkStreamTracer.h:103
vtkStreamTracer::FORWARD
Definition: vtkStreamTracer.h:300
vtkPolyDataAlgorithm::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkInitialValueProblemSolver::UNEXPECTED_VALUE
Definition: vtkInitialValueProblemSolver.h:120
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkAbstractInterpolatedVelocityField
An abstract class for obtaining the interpolated velocity values at a point.
Definition: vtkAbstractInterpolatedVelocityField.h:84
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkStreamTracer::Units
Units
Definition: vtkStreamTracer.h:154
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkStreamTracer::RUNGE_KUTTA45
Definition: vtkStreamTracer.h:164
vtkStreamTracer::IntegrationStepUnit
int IntegrationStepUnit
Definition: vtkStreamTracer.h:433
vtkStreamTracer::InterpolatorPrototype
vtkAbstractInterpolatedVelocityField * InterpolatorPrototype
Definition: vtkStreamTracer.h:448
vtkStreamTracer::IntervalInformation::Unit
int Unit
Definition: vtkStreamTracer.h:413
vtkStreamTracer::IntegrationDirection
int IntegrationDirection
Definition: vtkStreamTracer.h:434
vtkAlgorithmOutput
Proxy object to connect input/output ports.
Definition: vtkAlgorithmOutput.h:39
vtkStreamTracer::SurfaceStreamlines
bool SurfaceStreamlines
Definition: vtkStreamTracer.h:446
vtkStreamTracer::InitialIntegrationStep
double InitialIntegrationStep
Definition: vtkStreamTracer.h:419
vtkStreamTracer::RUNGE_KUTTA2
Definition: vtkStreamTracer.h:162
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkGenericCell
provides thread-safe access to cells
Definition: vtkGenericCell.h:39
vtkStreamTracer::INTERPOLATOR_WITH_DATASET_POINT_LOCATOR
Definition: vtkStreamTracer.h:307
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:41
vtkStreamTracer::SetIntegrationDirectionToBackward
void SetIntegrationDirectionToBackward()
Definition: vtkStreamTracer.h:320
vtkStreamTracer::MaximumIntegrationStep
double MaximumIntegrationStep
Definition: vtkStreamTracer.h:418
vtkInitialValueProblemSolver
Integrate a set of ordinary differential equations (initial value problem) in time.
Definition: vtkInitialValueProblemSolver.h:40
vtkInitialValueProblemSolver::OUT_OF_DOMAIN
Definition: vtkInitialValueProblemSolver.h:118
vtkStreamTracer::Solvers
Solvers
Definition: vtkStreamTracer.h:160
vtkStreamTracer::ReasonForTermination
ReasonForTermination
Definition: vtkStreamTracer.h:169
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:64
vtkStreamTracer::RotationScale
double RotationScale
Definition: vtkStreamTracer.h:443
vtkStreamTracer::SetIntegratorTypeToRungeKutta4
void SetIntegratorTypeToRungeKutta4()
Definition: vtkStreamTracer.h:196
vtkPolyDataAlgorithm::New
static vtkPolyDataAlgorithm * New()
vtkInitialValueProblemSolver::NOT_INITIALIZED
Definition: vtkInitialValueProblemSolver.h:119
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:44