VTK
vtkGenericStreamTracer.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGenericStreamTracer.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 =========================================================================*/
69 #ifndef vtkGenericStreamTracer_h
70 #define vtkGenericStreamTracer_h
71 
72 #include "vtkFiltersGenericModule.h" // For export macro
73 #include "vtkPolyDataAlgorithm.h"
74 
75 #include "vtkInitialValueProblemSolver.h" // Needed for constants
76 
77 class vtkDataArray;
79 class vtkIdList;
80 class vtkIntArray;
82 class vtkDataSet;
84 class vtkGenericDataSet;
85 
86 class VTKFILTERSGENERIC_EXPORT vtkGenericStreamTracer : public vtkPolyDataAlgorithm
87 {
88 public:
90  void PrintSelf(ostream& os, vtkIndent indent);
91 
99 
101 
106  vtkSetVector3Macro(StartPosition, double);
107  vtkGetVector3Macro(StartPosition, double);
109 
111 
117 
123 
125 
126  enum Units
127  {
130  CELL_LENGTH_UNIT
131  };
132 
133  enum Solvers
134  {
139  UNKNOWN
140  };
141 
143  {
147  OUT_OF_TIME = 4,
148  OUT_OF_STEPS = 5,
149  STAGNATION = 6
150  };
151 
153 
165  vtkGetObjectMacro ( Integrator, vtkInitialValueProblemSolver );
169  {this->SetIntegratorType(RUNGE_KUTTA2);};
171  {this->SetIntegratorType(RUNGE_KUTTA4);};
173  {this->SetIntegratorType(RUNGE_KUTTA45);};
175 
177 
184  void SetMaximumPropagation(int unit, double max);
190  {this->SetMaximumPropagationUnit(TIME_UNIT);};
192  {this->SetMaximumPropagationUnit(LENGTH_UNIT);};
194  {this->SetMaximumPropagationUnit(CELL_LENGTH_UNIT);};
196 
198 
206  void SetMinimumIntegrationStep(int unit, double step);
208  void SetMinimumIntegrationStep(double step);
212  {this->SetMinimumIntegrationStepUnit(TIME_UNIT);};
214  {this->SetMinimumIntegrationStepUnit(LENGTH_UNIT);};
216  {this->SetMinimumIntegrationStepUnit(CELL_LENGTH_UNIT);};
218 
220 
228  void SetMaximumIntegrationStep(int unit, double step);
230  void SetMaximumIntegrationStep(double step);
234  {this->SetMaximumIntegrationStepUnit(TIME_UNIT);};
236  {this->SetMaximumIntegrationStepUnit(LENGTH_UNIT);};
238  {this->SetMaximumIntegrationStepUnit(CELL_LENGTH_UNIT);};
240 
242 
251  void SetInitialIntegrationStep(int unit, double step);
253  void SetInitialIntegrationStep(double step);
257  {this->SetInitialIntegrationStepUnit(TIME_UNIT);};
259  {this->SetInitialIntegrationStepUnit(LENGTH_UNIT);};
261  {this->SetInitialIntegrationStepUnit(CELL_LENGTH_UNIT);};
263 
265 
270  vtkSetMacro(MaximumError, double);
271  vtkGetMacro(MaximumError, double);
273 
275 
278  vtkSetMacro(MaximumNumberOfSteps, vtkIdType);
279  vtkGetMacro(MaximumNumberOfSteps, vtkIdType);
281 
283 
287  vtkSetMacro(TerminalSpeed, double);
288  vtkGetMacro(TerminalSpeed, double);
290 
292 
295  void SetIntegrationStepUnit(int unit)
296  {
297  this->SetInitialIntegrationStepUnit(unit);
298  this->SetMinimumIntegrationStepUnit(unit);
299  this->SetMaximumIntegrationStepUnit(unit);
300  }
302 
303  enum
304  {
307  BOTH
308  };
309 
311 
315  vtkSetClampMacro(IntegrationDirection, int, FORWARD, BOTH);
316  vtkGetMacro(IntegrationDirection, int);
318  {this->SetIntegrationDirection(FORWARD);};
320  {this->SetIntegrationDirection(BACKWARD);};
322  {this->SetIntegrationDirection(BOTH);};
324 
326 
331  vtkSetMacro(ComputeVorticity, int);
332  vtkGetMacro(ComputeVorticity, int);
333  vtkBooleanMacro(ComputeVorticity, int);
335 
337 
341  vtkSetMacro(RotationScale, double);
342  vtkGetMacro(RotationScale, double);
344 
346 
351  vtkGetStringMacro(InputVectorsSelection);
352  void SelectInputVectors(const char *fieldName)
353  {this->SetInputVectorsSelection(fieldName);}
355 
360 
366 
367 protected:
370 
371  // hide the superclass' AddInput() from the user and the compiler
373  { vtkErrorMacro( << "AddInput() must be called with a vtkGenericDataSet not a vtkDataObject."); };
374 
376 
385  double pcoords[3],
386  vtkGenericAttribute *attribute,
387  double vorticity[3]);
388 
390  vtkPolyData* output,
391  vtkDataArray* seedSource,
392  vtkIdList* seedIds,
393  vtkIntArray* integrationDirections,
394  double lastPoint[3],
396  void SimpleIntegrate(double seed[3],
397  double lastPoint[3],
398  double delt,
401  vtkInformationVector **inputVector);
402  void GenerateNormals(vtkPolyData* output, double* firstNormal);
403 
405 
406  vtkSetStringMacro(InputVectorsSelection);
408 
409 
410  // starting from global x-y-z position
411  double StartPosition[3];
412 
413  static const double EPSILON;
415 
417 
419  {
420  double Interval;
421  int Unit;
422  };
423 
428 
429  void SetIntervalInformation(int unit, double interval,
430  IntervalInformation& currentValues);
431  void SetIntervalInformation(int unit,IntervalInformation& currentValues);
432  static double ConvertToTime(IntervalInformation& interval,
433  double cellLength, double speed);
434  static double ConvertToLength(IntervalInformation& interval,
435  double cellLength, double speed);
436  static double ConvertToCellLength(IntervalInformation& interval,
437  double cellLength, double speed);
438  static double ConvertToUnit(IntervalInformation& interval, int unit,
439  double cellLength, double speed);
440  void ConvertIntervals(double& step, double& minStep, double& maxStep,
441  int direction, double cellLength, double speed);
442 
444  vtkIdList*& seedIds,
445  vtkIntArray*& integrationDirections);
446 
448 
449  // Prototype showing the integrator type to be set by the user.
451 
452  double MaximumError;
454 
457 
459 
460 private:
461  vtkGenericStreamTracer(const vtkGenericStreamTracer&) VTK_DELETE_FUNCTION;
462  void operator=(const vtkGenericStreamTracer&) VTK_DELETE_FUNCTION;
463 };
464 
465 #endif
Proxy object to connect input/output ports.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
general representation of visualization data
Definition: vtkDataObject.h:65
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
defines cell interface
abstract class defined API for attribute data
defines dataset interface
Interface for obtaining interpolated velocity values.
Streamline generator.
static double ConvertToUnit(IntervalInformation &interval, int unit, double cellLength, double speed)
double GetMaximumPropagation()
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
double GetMaximumIntegrationStep()
void Integrate(vtkGenericDataSet *input0, vtkPolyData *output, vtkDataArray *seedSource, vtkIdList *seedIds, vtkIntArray *integrationDirections, double lastPoint[3], vtkGenericInterpolatedVelocityField *func)
void SetMaximumIntegrationStepUnit(int unit)
void SetSourceData(vtkDataSet *source)
Specify the source object used to generate starting points.
void SetInitialIntegrationStep(double step)
void SetMinimumIntegrationStep(int unit, double step)
Specify the minimum step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
void SetIntegrationStepUnit(int unit)
Simplified API to set an homogeneous unit across Min/Max/Init IntegrationStepUnit.
void SetMaximumIntegrationStep(int unit, double step)
Specify the maximum step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
void SetMaximumIntegrationStep(double step)
void SetIntegratorType(int type)
void SetInitialIntegrationStepUnit(int unit)
int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify the source object used to generate starting points (seeds).
void AddInput(vtkDataObject *)
IntervalInformation MinimumIntegrationStep
void SetMaximumPropagation(double max)
vtkGenericInterpolatedVelocityField * InterpolatorPrototype
IntervalInformation MaximumPropagation
double GetInitialIntegrationStep()
vtkInitialValueProblemSolver * Integrator
static double ConvertToLength(IntervalInformation &interval, double cellLength, double speed)
IntervalInformation MaximumIntegrationStep
void SetMinimumIntegrationStep(double step)
static double ConvertToTime(IntervalInformation &interval, double cellLength, double speed)
static double ConvertToCellLength(IntervalInformation &interval, double cellLength, double speed)
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
void AddInputData(vtkGenericDataSet *in)
Add a dataset to the list inputs.
void SetIntegrator(vtkInitialValueProblemSolver *)
Set/get the integrator type to be used in the stream line calculation.
void SelectInputVectors(const char *fieldName)
int CheckInputs(vtkGenericInterpolatedVelocityField *&func, vtkInformationVector **inputVector)
void SetMinimumIntegrationStepUnit(int unit)
void SetIntervalInformation(int unit, IntervalInformation &currentValues)
void GenerateNormals(vtkPolyData *output, double *firstNormal)
static vtkGenericStreamTracer * New()
Construct object to start from position (0,0,0), integrate forward, terminal speed 1....
void ConvertIntervals(double &step, double &minStep, double &maxStep, int direction, double cellLength, double speed)
void SetMaximumPropagationUnit(int unit)
IntervalInformation InitialIntegrationStep
vtkDataSet * GetSource()
void SetMaximumPropagation(int unit, double max)
Specify the maximum length of the streamlines expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT = 1 ...
double GetMinimumIntegrationStep()
void SimpleIntegrate(double seed[3], double lastPoint[3], double delt, vtkGenericInterpolatedVelocityField *func)
void InitializeSeeds(vtkDataArray *&seeds, vtkIdList *&seedIds, vtkIntArray *&integrationDirections)
void CalculateVorticity(vtkGenericAdaptorCell *cell, double pcoords[3], vtkGenericAttribute *attribute, double vorticity[3])
Compute the vorticity at point ‘pcoords’ in cell ‘cell’ for the vector attribute ‘attribute’.
void SetInitialIntegrationStep(int unit, double step)
Specify the initial step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
void SetInterpolatorPrototype(vtkGenericInterpolatedVelocityField *ivf)
The object used to interpolate the velocity field during integration is of the same class as this pro...
void SetIntervalInformation(int unit, double interval, IntervalInformation &currentValues)
list of point or cell ids
Definition: vtkIdList.h:37
a simple class to control print indentation
Definition: vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Integrate a set of ordinary differential equations (initial value problem) in time.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:46
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
@ info
Definition: vtkX3D.h:376
@ direction
Definition: vtkX3D.h:260
@ port
Definition: vtkX3D.h:447
@ speed
Definition: vtkX3D.h:483
@ type
Definition: vtkX3D.h:516
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
int vtkIdType
Definition: vtkType.h:287
#define max(a, b)