VTK  9.0.3
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) override;
88 
96 
98 
103  vtkSetVector3Macro(StartPosition, double);
104  vtkGetVector3Macro(StartPosition, double);
106 
108 
114 
120 
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 
162  vtkGetObjectMacro(Integrator, vtkInitialValueProblemSolver);
165  void SetIntegratorTypeToRungeKutta2() { this->SetIntegratorType(RUNGE_KUTTA2); }
166  void SetIntegratorTypeToRungeKutta4() { this->SetIntegratorType(RUNGE_KUTTA4); }
167  void SetIntegratorTypeToRungeKutta45() { this->SetIntegratorType(RUNGE_KUTTA45); }
169 
171 
178  void SetMaximumPropagation(int unit, double max);
183  void SetMaximumPropagationUnitToTimeUnit() { this->SetMaximumPropagationUnit(TIME_UNIT); }
184  void SetMaximumPropagationUnitToLengthUnit() { this->SetMaximumPropagationUnit(LENGTH_UNIT); }
186  {
187  this->SetMaximumPropagationUnit(CELL_LENGTH_UNIT);
188  }
190 
192 
200  void SetMinimumIntegrationStep(int unit, double step);
202  void SetMinimumIntegrationStep(double step);
205  void SetMinimumIntegrationStepUnitToTimeUnit() { this->SetMinimumIntegrationStepUnit(TIME_UNIT); }
207  {
208  this->SetMinimumIntegrationStepUnit(LENGTH_UNIT);
209  }
211  {
212  this->SetMinimumIntegrationStepUnit(CELL_LENGTH_UNIT);
213  }
215 
217 
225  void SetMaximumIntegrationStep(int unit, double step);
227  void SetMaximumIntegrationStep(double step);
230  void SetMaximumIntegrationStepUnitToTimeUnit() { this->SetMaximumIntegrationStepUnit(TIME_UNIT); }
232  {
233  this->SetMaximumIntegrationStepUnit(LENGTH_UNIT);
234  }
236  {
237  this->SetMaximumIntegrationStepUnit(CELL_LENGTH_UNIT);
238  }
240 
242 
251  void SetInitialIntegrationStep(int unit, double step);
253  void SetInitialIntegrationStep(double step);
256  void SetInitialIntegrationStepUnitToTimeUnit() { this->SetInitialIntegrationStepUnit(TIME_UNIT); }
258  {
259  this->SetInitialIntegrationStepUnit(LENGTH_UNIT);
260  }
262  {
263  this->SetInitialIntegrationStepUnit(CELL_LENGTH_UNIT);
264  }
266 
268 
273  vtkSetMacro(MaximumError, double);
274  vtkGetMacro(MaximumError, double);
276 
278 
281  vtkSetMacro(MaximumNumberOfSteps, vtkIdType);
282  vtkGetMacro(MaximumNumberOfSteps, vtkIdType);
284 
286 
290  vtkSetMacro(TerminalSpeed, double);
291  vtkGetMacro(TerminalSpeed, double);
293 
295 
298  void SetIntegrationStepUnit(int unit)
299  {
300  this->SetInitialIntegrationStepUnit(unit);
301  this->SetMinimumIntegrationStepUnit(unit);
302  this->SetMaximumIntegrationStepUnit(unit);
303  }
305 
306  enum
307  {
310  BOTH
311  };
312 
314 
318  vtkSetClampMacro(IntegrationDirection, int, FORWARD, BOTH);
319  vtkGetMacro(IntegrationDirection, int);
320  void SetIntegrationDirectionToForward() { this->SetIntegrationDirection(FORWARD); }
321  void SetIntegrationDirectionToBackward() { this->SetIntegrationDirection(BACKWARD); }
322  void SetIntegrationDirectionToBoth() { this->SetIntegrationDirection(BOTH); }
324 
326 
331  vtkSetMacro(ComputeVorticity, vtkTypeBool);
332  vtkGetMacro(ComputeVorticity, vtkTypeBool);
333  vtkBooleanMacro(ComputeVorticity, vtkTypeBool);
335 
337 
341  vtkSetMacro(RotationScale, double);
342  vtkGetMacro(RotationScale, double);
344 
346 
351  vtkGetStringMacro(InputVectorsSelection);
352  void SelectInputVectors(const char* fieldName) { this->SetInputVectorsSelection(fieldName); }
354 
359 
365 
366 protected:
369 
370  // hide the superclass' AddInput() from the user and the compiler
372  {
373  vtkErrorMacro(<< "AddInput() must be called with a vtkGenericDataSet not a vtkDataObject.");
374  }
375 
377 
385  void CalculateVorticity(vtkGenericAdaptorCell* cell, double pcoords[3],
386  vtkGenericAttribute* attribute, double vorticity[3]);
387 
388  void Integrate(vtkGenericDataSet* input0, vtkPolyData* output, vtkDataArray* seedSource,
389  vtkIdList* seedIds, vtkIntArray* integrationDirections, double lastPoint[3],
392  double seed[3], double lastPoint[3], double delt, vtkGenericInterpolatedVelocityField* func);
394  void GenerateNormals(vtkPolyData* output, double* firstNormal);
395 
397 
398  vtkSetStringMacro(InputVectorsSelection);
400 
401  // starting from global x-y-z position
402  double StartPosition[3];
403 
404  static const double EPSILON;
406 
408 
410  {
411  double Interval;
412  int Unit;
413  };
414 
419 
420  void SetIntervalInformation(int unit, double interval, IntervalInformation& currentValues);
421  void SetIntervalInformation(int unit, IntervalInformation& currentValues);
422  static double ConvertToTime(IntervalInformation& interval, double cellLength, double speed);
423  static double ConvertToLength(IntervalInformation& interval, double cellLength, double speed);
424  static double ConvertToCellLength(IntervalInformation& interval, double cellLength, double speed);
425  static double ConvertToUnit(
426  IntervalInformation& interval, int unit, double cellLength, double speed);
428  double& step, double& minStep, double& maxStep, int direction, double cellLength, double speed);
429 
431  vtkDataArray*& seeds, vtkIdList*& seedIds, vtkIntArray*& integrationDirections);
432 
434 
435  // Prototype showing the integrator type to be set by the user.
437 
438  double MaximumError;
440 
443 
445 
446 private:
448  void operator=(const vtkGenericStreamTracer&) = delete;
449 };
450 
451 #endif
Proxy object to connect input/output ports.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:50
general representation of visualization data
Definition: vtkDataObject.h:60
abstract class to specify dataset behavior
Definition: vtkDataSet.h:57
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()
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)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
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)
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
static double ConvertToCellLength(IntervalInformation &interval, double cellLength, double speed)
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 ...
~vtkGenericStreamTracer() override
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:31
a simple class to control print indentation
Definition: vtkIndent.h:34
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:40
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
@ info
Definition: vtkX3D.h:382
@ direction
Definition: vtkX3D.h:266
@ port
Definition: vtkX3D.h:453
@ speed
Definition: vtkX3D.h:489
@ type
Definition: vtkX3D.h:522
int vtkTypeBool
Definition: vtkABI.h:69
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
int vtkIdType
Definition: vtkType.h:338
#define max(a, b)