VTK  9.2.5
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) override;
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);
168  void SetIntegratorTypeToRungeKutta2() { this->SetIntegratorType(RUNGE_KUTTA2); }
169  void SetIntegratorTypeToRungeKutta4() { this->SetIntegratorType(RUNGE_KUTTA4); }
170  void SetIntegratorTypeToRungeKutta45() { this->SetIntegratorType(RUNGE_KUTTA45); }
172 
174 
181  void SetMaximumPropagation(int unit, double max);
186  void SetMaximumPropagationUnitToTimeUnit() { this->SetMaximumPropagationUnit(TIME_UNIT); }
187  void SetMaximumPropagationUnitToLengthUnit() { this->SetMaximumPropagationUnit(LENGTH_UNIT); }
189  {
190  this->SetMaximumPropagationUnit(CELL_LENGTH_UNIT);
191  }
193 
195 
203  void SetMinimumIntegrationStep(int unit, double step);
205  void SetMinimumIntegrationStep(double step);
208  void SetMinimumIntegrationStepUnitToTimeUnit() { this->SetMinimumIntegrationStepUnit(TIME_UNIT); }
210  {
211  this->SetMinimumIntegrationStepUnit(LENGTH_UNIT);
212  }
214  {
215  this->SetMinimumIntegrationStepUnit(CELL_LENGTH_UNIT);
216  }
218 
220 
228  void SetMaximumIntegrationStep(int unit, double step);
230  void SetMaximumIntegrationStep(double step);
233  void SetMaximumIntegrationStepUnitToTimeUnit() { this->SetMaximumIntegrationStepUnit(TIME_UNIT); }
235  {
236  this->SetMaximumIntegrationStepUnit(LENGTH_UNIT);
237  }
239  {
240  this->SetMaximumIntegrationStepUnit(CELL_LENGTH_UNIT);
241  }
243 
245 
254  void SetInitialIntegrationStep(int unit, double step);
256  void SetInitialIntegrationStep(double step);
259  void SetInitialIntegrationStepUnitToTimeUnit() { this->SetInitialIntegrationStepUnit(TIME_UNIT); }
261  {
262  this->SetInitialIntegrationStepUnit(LENGTH_UNIT);
263  }
265  {
266  this->SetInitialIntegrationStepUnit(CELL_LENGTH_UNIT);
267  }
269 
271 
276  vtkSetMacro(MaximumError, double);
277  vtkGetMacro(MaximumError, double);
279 
281 
284  vtkSetMacro(MaximumNumberOfSteps, vtkIdType);
285  vtkGetMacro(MaximumNumberOfSteps, vtkIdType);
287 
289 
293  vtkSetMacro(TerminalSpeed, double);
294  vtkGetMacro(TerminalSpeed, double);
296 
298 
301  void SetIntegrationStepUnit(int unit)
302  {
303  this->SetInitialIntegrationStepUnit(unit);
304  this->SetMinimumIntegrationStepUnit(unit);
305  this->SetMaximumIntegrationStepUnit(unit);
306  }
308 
309  enum
310  {
313  BOTH
314  };
315 
317 
321  vtkSetClampMacro(IntegrationDirection, int, FORWARD, BOTH);
322  vtkGetMacro(IntegrationDirection, int);
323  void SetIntegrationDirectionToForward() { this->SetIntegrationDirection(FORWARD); }
324  void SetIntegrationDirectionToBackward() { this->SetIntegrationDirection(BACKWARD); }
325  void SetIntegrationDirectionToBoth() { this->SetIntegrationDirection(BOTH); }
327 
329 
334  vtkSetMacro(ComputeVorticity, vtkTypeBool);
335  vtkGetMacro(ComputeVorticity, vtkTypeBool);
336  vtkBooleanMacro(ComputeVorticity, vtkTypeBool);
338 
340 
344  vtkSetMacro(RotationScale, double);
345  vtkGetMacro(RotationScale, double);
347 
349 
354  vtkGetStringMacro(InputVectorsSelection);
355  void SelectInputVectors(const char* fieldName) { this->SetInputVectorsSelection(fieldName); }
357 
362 
368 
369 protected:
372 
373  // hide the superclass' AddInput() from the user and the compiler
375  {
376  vtkErrorMacro(<< "AddInput() must be called with a vtkGenericDataSet not a vtkDataObject.");
377  }
378 
380 
388  void CalculateVorticity(vtkGenericAdaptorCell* cell, double pcoords[3],
389  vtkGenericAttribute* attribute, double vorticity[3]);
390 
391  void Integrate(vtkGenericDataSet* input0, vtkPolyData* output, vtkDataArray* seedSource,
392  vtkIdList* seedIds, vtkIntArray* integrationDirections, double lastPoint[3],
395  double seed[3], double lastPoint[3], double delt, vtkGenericInterpolatedVelocityField* func);
397  void GenerateNormals(vtkPolyData* output, double* firstNormal);
398 
400 
401  vtkSetStringMacro(InputVectorsSelection);
403 
404  // starting from global x-y-z position
405  double StartPosition[3];
406 
407  static const double EPSILON;
409 
411 
413  {
414  double Interval;
415  int Unit;
416  };
417 
422 
423  void SetIntervalInformation(int unit, double interval, IntervalInformation& currentValues);
424  void SetIntervalInformation(int unit, IntervalInformation& currentValues);
425  static double ConvertToTime(IntervalInformation& interval, double cellLength, double speed);
426  static double ConvertToLength(IntervalInformation& interval, double cellLength, double speed);
427  static double ConvertToCellLength(IntervalInformation& interval, double cellLength, double speed);
428  static double ConvertToUnit(
429  IntervalInformation& interval, int unit, double cellLength, double speed);
431  double& step, double& minStep, double& maxStep, int direction, double cellLength, double speed);
432 
434  vtkDataArray*& seeds, vtkIdList*& seedIds, vtkIntArray*& integrationDirections);
435 
437 
438  // Prototype showing the integrator type to be set by the user.
440 
441  double MaximumError;
443 
446 
448 
449 private:
451  void operator=(const vtkGenericStreamTracer&) = delete;
452 };
453 
454 #endif
Proxy object to connect input/output ports.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:165
general representation of visualization data
abstract class to specify dataset behavior
Definition: vtkDataSet.h:172
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()
Specify the maximum length of the streamlines expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT = 1 ...
void SetIntegratorTypeToRungeKutta2()
Set/get the integrator type to be used in the stream line calculation.
void SetIntegrationDirectionToBackward()
Specify whether the streamtrace will be generated in the upstream or downstream direction.
void SetMinimumIntegrationStepUnitToCellLengthUnit()
Specify the minimum step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
int GetInitialIntegrationStepUnit()
Specify the initial step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
double GetMaximumIntegrationStep()
Specify the maximum step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
int GetMaximumIntegrationStepUnit()
Specify the maximum 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 Integrate(vtkGenericDataSet *input0, vtkPolyData *output, vtkDataArray *seedSource, vtkIdList *seedIds, vtkIntArray *integrationDirections, double lastPoint[3], vtkGenericInterpolatedVelocityField *func)
void SetMaximumIntegrationStepUnit(int unit)
Specify the maximum step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
void SetSourceData(vtkDataSet *source)
Specify the source object used to generate starting points.
void SetInitialIntegrationStep(double step)
Specify the initial step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
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 SetMinimumIntegrationStepUnitToLengthUnit()
Specify the minimum step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
int GetMaximumPropagationUnit()
Specify the maximum length of the streamlines expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT = 1 ...
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)
Specify the maximum step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
void SetIntegrationDirectionToBoth()
Specify whether the streamtrace will be generated in the upstream or downstream direction.
void SetIntegratorTypeToRungeKutta4()
Set/get the integrator type to be used in the stream line calculation.
void SetIntegratorType(int type)
Set/get the integrator type to be used in the stream line calculation.
void SetInitialIntegrationStepUnit(int unit)
Specify the initial step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetMaximumPropagationUnitToLengthUnit()
Specify the maximum length of the streamlines expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT = 1 ...
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
int GetIntegratorType()
Set/get the integrator type to be used in the stream line calculation.
void SetInitialIntegrationStepUnitToTimeUnit()
Specify the initial step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify the source object used to generate starting points (seeds).
void AddInput(vtkDataObject *)
IntervalInformation MinimumIntegrationStep
void SetMaximumPropagation(double max)
Specify the maximum length of the streamlines expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT = 1 ...
vtkGenericInterpolatedVelocityField * InterpolatorPrototype
IntervalInformation MaximumPropagation
double GetInitialIntegrationStep()
Specify the initial step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
vtkInitialValueProblemSolver * Integrator
void SetMaximumIntegrationStepUnitToCellLengthUnit()
Specify the maximum step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
static double ConvertToLength(IntervalInformation &interval, double cellLength, double speed)
int GetMinimumIntegrationStepUnit()
Specify the minimum step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
IntervalInformation MaximumIntegrationStep
void SetMinimumIntegrationStep(double step)
Specify the minimum step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
static double ConvertToTime(IntervalInformation &interval, double cellLength, double speed)
void SetIntegratorTypeToRungeKutta45()
Set/get the integrator type to be used in the stream line calculation.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
void SetMaximumPropagationUnitToTimeUnit()
Specify the maximum length of the streamlines expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT = 1 ...
static double ConvertToCellLength(IntervalInformation &interval, double cellLength, double speed)
void SetMaximumPropagationUnitToCellLengthUnit()
Specify the maximum length of the streamlines expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT = 1 ...
void AddInputData(vtkGenericDataSet *in)
Add a dataset to the list inputs.
void SetInitialIntegrationStepUnitToLengthUnit()
Specify the initial step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
void SetIntegrator(vtkInitialValueProblemSolver *)
Set/get the integrator type to be used in the stream line calculation.
void SelectInputVectors(const char *fieldName)
If you want to generate traces using an arbitrary vector array, then set its name here.
int CheckInputs(vtkGenericInterpolatedVelocityField *&func, vtkInformationVector **inputVector)
void SetMinimumIntegrationStepUnit(int unit)
Specify the minimum step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
void SetIntervalInformation(int unit, IntervalInformation &currentValues)
void GenerateNormals(vtkPolyData *output, double *firstNormal)
void SetIntegrationDirectionToForward()
Specify whether the streamtrace will be generated in the upstream or downstream direction.
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 SetMaximumIntegrationStepUnitToTimeUnit()
Specify the maximum step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
void SetMaximumPropagationUnit(int unit)
Specify the maximum length of the streamlines expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT = 1 ...
IntervalInformation InitialIntegrationStep
vtkDataSet * GetSource()
Specify the source object used to generate starting points.
void SetMaximumPropagation(int unit, double max)
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 =...
~vtkGenericStreamTracer() override
double GetMinimumIntegrationStep()
Specify the minimum step used in the integration expressed in one of the: TIME_UNIT = 0 LENGTH_UNIT =...
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 SetMinimumIntegrationStepUnitToTimeUnit()
Specify the minimum 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:143
a simple class to control print indentation
Definition: vtkIndent.h:119
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:155
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:200
@ 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:332
#define max(a, b)