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 =========================================================================*/
66 #ifndef vtkGenericStreamTracer_h
67 #define vtkGenericStreamTracer_h
68 
69 #include "vtkFiltersGenericModule.h" // For export macro
70 #include "vtkPolyDataAlgorithm.h"
71 
72 #include "vtkInitialValueProblemSolver.h" // Needed for constants
73 
74 class vtkDataArray;
76 class vtkIdList;
77 class vtkIntArray;
79 class vtkDataSet;
81 class vtkGenericDataSet;
82 
83 class VTKFILTERSGENERIC_EXPORT vtkGenericStreamTracer : public vtkPolyDataAlgorithm
84 {
85 public:
87  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
88 
95  static vtkGenericStreamTracer *New();
96 
98 
103  vtkSetVector3Macro(StartPosition, double);
104  vtkGetVector3Macro(StartPosition, double);
106 
108 
111  void SetSourceData(vtkDataSet *source);
112  vtkDataSet *GetSource();
114 
119  void SetSourceConnection(vtkAlgorithmOutput* algOutput);
120 
121  int FillInputPortInformation(int port, vtkInformation* info) VTK_OVERRIDE;
122 
123  enum Units
124  {
127  CELL_LENGTH_UNIT
128  };
129 
130  enum Solvers
131  {
136  UNKNOWN
137  };
138 
140  {
144  OUT_OF_TIME = 4,
145  OUT_OF_STEPS = 5,
146  STAGNATION = 6
147  };
148 
150 
161  void SetIntegrator(vtkInitialValueProblemSolver *);
162  vtkGetObjectMacro ( Integrator, vtkInitialValueProblemSolver );
163  void SetIntegratorType(int type);
164  int GetIntegratorType();
166  {this->SetIntegratorType(RUNGE_KUTTA2);};
168  {this->SetIntegratorType(RUNGE_KUTTA4);};
170  {this->SetIntegratorType(RUNGE_KUTTA45);};
172 
174 
181  void SetMaximumPropagation(int unit, double max);
182  void SetMaximumPropagation(double max);
183  void SetMaximumPropagationUnit(int unit);
184  int GetMaximumPropagationUnit();
185  double GetMaximumPropagation();
187  {this->SetMaximumPropagationUnit(TIME_UNIT);};
189  {this->SetMaximumPropagationUnit(LENGTH_UNIT);};
191  {this->SetMaximumPropagationUnit(CELL_LENGTH_UNIT);};
193 
195 
203  void SetMinimumIntegrationStep(int unit, double step);
204  void SetMinimumIntegrationStepUnit(int unit);
205  void SetMinimumIntegrationStep(double step);
206  int GetMinimumIntegrationStepUnit();
207  double GetMinimumIntegrationStep();
209  {this->SetMinimumIntegrationStepUnit(TIME_UNIT);};
211  {this->SetMinimumIntegrationStepUnit(LENGTH_UNIT);};
213  {this->SetMinimumIntegrationStepUnit(CELL_LENGTH_UNIT);};
215 
217 
225  void SetMaximumIntegrationStep(int unit, double step);
226  void SetMaximumIntegrationStepUnit(int unit);
227  void SetMaximumIntegrationStep(double step);
228  int GetMaximumIntegrationStepUnit();
229  double GetMaximumIntegrationStep();
231  {this->SetMaximumIntegrationStepUnit(TIME_UNIT);};
233  {this->SetMaximumIntegrationStepUnit(LENGTH_UNIT);};
235  {this->SetMaximumIntegrationStepUnit(CELL_LENGTH_UNIT);};
237 
239 
248  void SetInitialIntegrationStep(int unit, double step);
249  void SetInitialIntegrationStepUnit(int unit);
250  void SetInitialIntegrationStep(double step);
251  int GetInitialIntegrationStepUnit();
252  double GetInitialIntegrationStep();
254  {this->SetInitialIntegrationStepUnit(TIME_UNIT);};
256  {this->SetInitialIntegrationStepUnit(LENGTH_UNIT);};
258  {this->SetInitialIntegrationStepUnit(CELL_LENGTH_UNIT);};
260 
262 
267  vtkSetMacro(MaximumError, double);
268  vtkGetMacro(MaximumError, double);
270 
272 
275  vtkSetMacro(MaximumNumberOfSteps, vtkIdType);
276  vtkGetMacro(MaximumNumberOfSteps, vtkIdType);
278 
280 
284  vtkSetMacro(TerminalSpeed, double);
285  vtkGetMacro(TerminalSpeed, double);
287 
289 
292  void SetIntegrationStepUnit(int unit)
293  {
294  this->SetInitialIntegrationStepUnit(unit);
295  this->SetMinimumIntegrationStepUnit(unit);
296  this->SetMaximumIntegrationStepUnit(unit);
297  }
299 
300  enum
301  {
304  BOTH
305  };
306 
308 
312  vtkSetClampMacro(IntegrationDirection, int, FORWARD, BOTH);
313  vtkGetMacro(IntegrationDirection, int);
315  {this->SetIntegrationDirection(FORWARD);};
317  {this->SetIntegrationDirection(BACKWARD);};
319  {this->SetIntegrationDirection(BOTH);};
321 
323 
328  vtkSetMacro(ComputeVorticity, int);
329  vtkGetMacro(ComputeVorticity, int);
330  vtkBooleanMacro(ComputeVorticity, int);
332 
334 
338  vtkSetMacro(RotationScale, double);
339  vtkGetMacro(RotationScale, double);
341 
343 
348  vtkGetStringMacro(InputVectorsSelection);
349  void SelectInputVectors(const char *fieldName)
350  {this->SetInputVectorsSelection(fieldName);}
352 
357 
362  void SetInterpolatorPrototype(vtkGenericInterpolatedVelocityField* ivf);
363 
364 protected:
366  ~vtkGenericStreamTracer() VTK_OVERRIDE;
367 
368  // hide the superclass' AddInput() from the user and the compiler
370  { vtkErrorMacro( << "AddInput() must be called with a vtkGenericDataSet not a vtkDataObject."); };
371 
373 
381  void CalculateVorticity(vtkGenericAdaptorCell* cell,
382  double pcoords[3],
383  vtkGenericAttribute *attribute,
384  double vorticity[3]);
385 
386  void Integrate(vtkGenericDataSet *input0,
387  vtkPolyData* output,
388  vtkDataArray* seedSource,
389  vtkIdList* seedIds,
390  vtkIntArray* integrationDirections,
391  double lastPoint[3],
393  void SimpleIntegrate(double seed[3],
394  double lastPoint[3],
395  double delt,
397  int CheckInputs(vtkGenericInterpolatedVelocityField*& func,
398  vtkInformationVector **inputVector);
399  void GenerateNormals(vtkPolyData* output, double* firstNormal);
400 
402 
403  vtkSetStringMacro(InputVectorsSelection);
404  char *InputVectorsSelection;
405 
406 
407  // starting from global x-y-z position
408  double StartPosition[3];
409 
410  static const double EPSILON;
412 
414 
416  {
417  double Interval;
418  int Unit;
419  };
420 
425 
426  void SetIntervalInformation(int unit, double interval,
427  IntervalInformation& currentValues);
428  void SetIntervalInformation(int unit,IntervalInformation& currentValues);
429  static double ConvertToTime(IntervalInformation& interval,
430  double cellLength, double speed);
431  static double ConvertToLength(IntervalInformation& interval,
432  double cellLength, double speed);
433  static double ConvertToCellLength(IntervalInformation& interval,
434  double cellLength, double speed);
435  static double ConvertToUnit(IntervalInformation& interval, int unit,
436  double cellLength, double speed);
437  void ConvertIntervals(double& step, double& minStep, double& maxStep,
438  int direction, double cellLength, double speed);
439 
440  void InitializeSeeds(vtkDataArray*& seeds,
441  vtkIdList*& seedIds,
442  vtkIntArray*& integrationDirections);
443 
445 
446  // Prototype showing the integrator type to be set by the user.
448 
449  double MaximumError;
451 
454 
456 
457 private:
458  vtkGenericStreamTracer(const vtkGenericStreamTracer&) VTK_DELETE_FUNCTION;
459  void operator=(const vtkGenericStreamTracer&) VTK_DELETE_FUNCTION;
460 };
461 
462 #endif
void SetMinimumIntegrationStepUnitToLengthUnit()
Specify the minimum step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
void SetMaximumPropagationUnitToTimeUnit()
Specify the maximum length of the streamlines expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT = 1 ...
void SetIntegrationDirectionToBackward()
Specify whether the streamtrace will be generated in the upstream or downstream direction.
void SelectInputVectors(const char *fieldName)
If you want to generate traces using an arbitrary vector array, then set its name here...
vtkGenericInterpolatedVelocityField * InterpolatorPrototype
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
void SetInitialIntegrationStepUnitToTimeUnit()
Specify the initial step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
void SetInitialIntegrationStepUnitToCellLengthUnit()
Specify the initial step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
void SetMinimumIntegrationStepUnitToTimeUnit()
Specify the minimum step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
void AddInputData(vtkDataObject *)
Assign a data object as input.
void SetIntegrationDirectionToBoth()
Specify whether the streamtrace will be generated in the upstream or downstream direction.
vtkInitialValueProblemSolver * Integrator
int vtkIdType
Definition: vtkType.h:345
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
abstract class defined API for attribute data
void AddInput(vtkDataObject *)
IntervalInformation MinimumIntegrationStep
Proxy object to connect input/output ports.
static vtkPolyDataAlgorithm * New()
defines cell interface
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:39
Superclass for algorithms that produce only polydata as output.
void SetInitialIntegrationStepUnitToLengthUnit()
Specify the initial step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
a simple class to control print indentation
Definition: vtkIndent.h:33
list of point or cell ids
Definition: vtkIdList.h:30
IntervalInformation MaximumIntegrationStep
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
void SetMaximumIntegrationStepUnitToCellLengthUnit()
Specify the maximum step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
void SetIntegrationDirectionToForward()
Specify whether the streamtrace will be generated in the upstream or downstream direction.
void SetIntegratorTypeToRungeKutta2()
Set/get the integrator type to be used in the stream line calculation.
boost::graph_traits< vtkGraph *>::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
void SetIntegratorTypeToRungeKutta4()
Set/get the integrator type to be used in the stream line calculation.
void SetMaximumPropagationUnitToLengthUnit()
Specify the maximum length of the streamlines expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT = 1 ...
Streamline generator.
IntervalInformation MaximumPropagation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
void SetIntegratorTypeToRungeKutta45()
Set/get the integrator type to be used in the stream line calculation.
Store zero or more vtkInformation instances.
defines dataset interface
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
IntervalInformation InitialIntegrationStep
general representation of visualization data
Definition: vtkDataObject.h:58
void SetMaximumPropagationUnitToCellLengthUnit()
Specify the maximum length of the streamlines expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT = 1 ...
void SetMaximumIntegrationStepUnitToLengthUnit()
Specify the maximum step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
#define max(a, b)
Interface for obtaining interpolated velocity values.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetMaximumIntegrationStepUnitToTimeUnit()
Specify the maximum step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
void SetMinimumIntegrationStepUnitToCellLengthUnit()
Specify the minimum step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
Integrate a set of ordinary differential equations (initial value problem) in time.
void SetIntegrationStepUnit(int unit)
Simplified API to set an homogeneous unit across Min/Max/Init IntegrationStepUnit.