VTK  9.3.20240420
vtkGenericStreamTracer.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
57#ifndef vtkGenericStreamTracer_h
58#define vtkGenericStreamTracer_h
59
60#include "vtkFiltersGenericModule.h" // For export macro
62
63#include "vtkInitialValueProblemSolver.h" // Needed for constants
64
65VTK_ABI_NAMESPACE_BEGIN
66class vtkDataArray;
68class vtkIdList;
69class vtkIntArray;
71class vtkDataSet;
74
75class VTKFILTERSGENERIC_EXPORT vtkGenericStreamTracer : public vtkPolyDataAlgorithm
76{
77public:
79 void PrintSelf(ostream& os, vtkIndent indent) override;
80
88
90
95 vtkSetVector3Macro(StartPosition, double);
96 vtkGetVector3Macro(StartPosition, double);
98
100
106
112
113 int FillInputPortInformation(int port, vtkInformation* info) override;
114
115 enum Units
116 {
119 CELL_LENGTH_UNIT
120 };
121
123 {
128 UNKNOWN
129 };
130
132 {
136 OUT_OF_TIME = 4,
137 OUT_OF_STEPS = 5,
138 STAGNATION = 6
139 };
140
142
154 vtkGetObjectMacro(Integrator, vtkInitialValueProblemSolver);
155 void SetIntegratorType(int type);
157 void SetIntegratorTypeToRungeKutta2() { this->SetIntegratorType(RUNGE_KUTTA2); }
158 void SetIntegratorTypeToRungeKutta4() { this->SetIntegratorType(RUNGE_KUTTA4); }
159 void SetIntegratorTypeToRungeKutta45() { this->SetIntegratorType(RUNGE_KUTTA45); }
161
163
170 void SetMaximumPropagation(int unit, double max);
175 void SetMaximumPropagationUnitToTimeUnit() { this->SetMaximumPropagationUnit(TIME_UNIT); }
176 void SetMaximumPropagationUnitToLengthUnit() { this->SetMaximumPropagationUnit(LENGTH_UNIT); }
178 {
179 this->SetMaximumPropagationUnit(CELL_LENGTH_UNIT);
180 }
182
184
192 void SetMinimumIntegrationStep(int unit, double step);
194 void SetMinimumIntegrationStep(double step);
197 void SetMinimumIntegrationStepUnitToTimeUnit() { this->SetMinimumIntegrationStepUnit(TIME_UNIT); }
199 {
200 this->SetMinimumIntegrationStepUnit(LENGTH_UNIT);
201 }
203 {
204 this->SetMinimumIntegrationStepUnit(CELL_LENGTH_UNIT);
205 }
207
209
217 void SetMaximumIntegrationStep(int unit, double step);
219 void SetMaximumIntegrationStep(double step);
222 void SetMaximumIntegrationStepUnitToTimeUnit() { this->SetMaximumIntegrationStepUnit(TIME_UNIT); }
224 {
225 this->SetMaximumIntegrationStepUnit(LENGTH_UNIT);
226 }
228 {
229 this->SetMaximumIntegrationStepUnit(CELL_LENGTH_UNIT);
230 }
232
234
243 void SetInitialIntegrationStep(int unit, double step);
245 void SetInitialIntegrationStep(double step);
248 void SetInitialIntegrationStepUnitToTimeUnit() { this->SetInitialIntegrationStepUnit(TIME_UNIT); }
250 {
251 this->SetInitialIntegrationStepUnit(LENGTH_UNIT);
252 }
254 {
255 this->SetInitialIntegrationStepUnit(CELL_LENGTH_UNIT);
256 }
258
260
265 vtkSetMacro(MaximumError, double);
266 vtkGetMacro(MaximumError, double);
268
270
273 vtkSetMacro(MaximumNumberOfSteps, vtkIdType);
274 vtkGetMacro(MaximumNumberOfSteps, vtkIdType);
276
278
282 vtkSetMacro(TerminalSpeed, double);
283 vtkGetMacro(TerminalSpeed, double);
285
287
291 {
292 this->SetInitialIntegrationStepUnit(unit);
293 this->SetMinimumIntegrationStepUnit(unit);
294 this->SetMaximumIntegrationStepUnit(unit);
295 }
297
298 enum
299 {
302 BOTH
303 };
304
306
310 vtkSetClampMacro(IntegrationDirection, int, FORWARD, BOTH);
311 vtkGetMacro(IntegrationDirection, int);
312 void SetIntegrationDirectionToForward() { this->SetIntegrationDirection(FORWARD); }
313 void SetIntegrationDirectionToBackward() { this->SetIntegrationDirection(BACKWARD); }
314 void SetIntegrationDirectionToBoth() { this->SetIntegrationDirection(BOTH); }
316
318
323 vtkSetMacro(ComputeVorticity, vtkTypeBool);
324 vtkGetMacro(ComputeVorticity, vtkTypeBool);
325 vtkBooleanMacro(ComputeVorticity, vtkTypeBool);
327
329
333 vtkSetMacro(RotationScale, double);
334 vtkGetMacro(RotationScale, double);
336
338
343 vtkGetStringMacro(InputVectorsSelection);
344 void SelectInputVectors(const char* fieldName) { this->SetInputVectorsSelection(fieldName); }
346
351
357
358protected:
361
362 // hide the superclass' AddInput() from the user and the compiler
364 {
365 vtkErrorMacro(<< "AddInput() must be called with a vtkGenericDataSet not a vtkDataObject.");
366 }
367
369
377 void CalculateVorticity(vtkGenericAdaptorCell* cell, double pcoords[3],
378 vtkGenericAttribute* attribute, double vorticity[3]);
379
380 void Integrate(vtkGenericDataSet* input0, vtkPolyData* output, vtkDataArray* seedSource,
381 vtkIdList* seedIds, vtkIntArray* integrationDirections, double lastPoint[3],
384 double seed[3], double lastPoint[3], double delt, vtkGenericInterpolatedVelocityField* func);
386 void GenerateNormals(vtkPolyData* output, double* firstNormal);
387
389
390 vtkSetStringMacro(InputVectorsSelection);
392
393 // starting from global x-y-z position
394 double StartPosition[3];
395
396 static const double EPSILON;
398
400
402 {
403 double Interval;
404 int Unit;
405 };
406
411
412 void SetIntervalInformation(int unit, double interval, IntervalInformation& currentValues);
413 void SetIntervalInformation(int unit, IntervalInformation& currentValues);
414 static double ConvertToTime(IntervalInformation& interval, double cellLength, double speed);
415 static double ConvertToLength(IntervalInformation& interval, double cellLength, double speed);
416 static double ConvertToCellLength(IntervalInformation& interval, double cellLength, double speed);
417 static double ConvertToUnit(
418 IntervalInformation& interval, int unit, double cellLength, double speed);
420 double& step, double& minStep, double& maxStep, int direction, double cellLength, double speed);
421
423 vtkDataArray*& seeds, vtkIdList*& seedIds, vtkIntArray*& integrationDirections);
424
426
427 // Prototype showing the integrator type to be set by the user.
429
432
435
437
438private:
440 void operator=(const vtkGenericStreamTracer&) = delete;
441};
442
443VTK_ABI_NAMESPACE_END
444#endif
Proxy object to connect input/output ports.
abstract superclass for arrays of numeric data
general representation of visualization data
abstract class to specify dataset behavior
Definition vtkDataSet.h:166
defines cell interface
abstract class defined API for attribute data
defines dataset interface
Interface for obtaining interpolated velocity values.
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.
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
static vtkGenericStreamTracer * New()
Construct object to start from position (0,0,0), integrate forward, terminal speed 1....
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...
vtkDataSet * GetSource()
Specify the source object used to generate starting points.
void SetIntervalInformation(int unit, double interval, IntervalInformation &currentValues)
list of point or cell ids
Definition vtkIdList.h:133
a simple class to control print indentation
Definition vtkIndent.h:108
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
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
int vtkTypeBool
Definition vtkABI.h:64
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
int vtkIdType
Definition vtkType.h:315
#define max(a, b)