VTK  9.1.0
vtkStreamTracer.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkStreamTracer.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=========================================================================*/
95#ifndef vtkStreamTracer_h
96#define vtkStreamTracer_h
97
98#include "vtkFiltersFlowPathsModule.h" // For export macro
100
101#include "vtkInitialValueProblemSolver.h" // Needed for constants
102
105class vtkDataArray;
107class vtkDoubleArray;
108class vtkExecutive;
109class vtkGenericCell;
110class vtkIdList;
111class vtkIntArray;
112class vtkPoints;
113
114#include <vector> // for std::vector
115
116class VTKFILTERSFLOWPATHS_EXPORT vtkStreamTracer : public vtkPolyDataAlgorithm
117{
118public:
120 void PrintSelf(ostream& os, vtkIndent indent) override;
121
130
132
137 vtkSetVector3Macro(StartPosition, double);
138 vtkGetVector3Macro(StartPosition, double);
140
142
151
157
158 // The previously-supported TIME_UNIT is excluded in this current
159 // enumeration definition because the underlying step size is ALWAYS in
160 // arc length unit (LENGTH_UNIT) while the 'real' time interval (virtual
161 // for steady flows) that a particle actually takes to trave in a single
162 // step is obtained by dividing the arc length by the LOCAL speed. The
163 // overall elapsed time (i.e., the life span) of the particle is the sum
164 // of those individual step-wise time intervals. The arc-length-to-time
165 // conversion only occurs for vorticity computation and for generating a
166 // point data array named 'IntegrationTime'.
167 enum Units
168 {
169 LENGTH_UNIT = 1,
170 CELL_LENGTH_UNIT = 2
171 };
172
174 {
179 UNKNOWN
180 };
181
183 {
187 OUT_OF_LENGTH = 4,
188 OUT_OF_STEPS = 5,
189 STAGNATION = 6,
190 FIXED_REASONS_FOR_TERMINATION_COUNT
191 };
192
194
205 vtkGetObjectMacro(Integrator, vtkInitialValueProblemSolver);
208 void SetIntegratorTypeToRungeKutta2() { this->SetIntegratorType(RUNGE_KUTTA2); }
209 void SetIntegratorTypeToRungeKutta4() { this->SetIntegratorType(RUNGE_KUTTA4); }
210 void SetIntegratorTypeToRungeKutta45() { this->SetIntegratorType(RUNGE_KUTTA45); }
212
218
224
226
229 vtkSetMacro(MaximumPropagation, double);
230 vtkGetMacro(MaximumPropagation, double);
232
240 int GetIntegrationStepUnit() { return this->IntegrationStepUnit; }
241
243
250 vtkSetMacro(InitialIntegrationStep, double);
251 vtkGetMacro(InitialIntegrationStep, double);
253
255
261 vtkSetMacro(MinimumIntegrationStep, double);
262 vtkGetMacro(MinimumIntegrationStep, double);
264
266
272 vtkSetMacro(MaximumIntegrationStep, double);
273 vtkGetMacro(MaximumIntegrationStep, double);
275
277
280 vtkSetMacro(MaximumError, double);
281 vtkGetMacro(MaximumError, double);
283
285
288 vtkSetMacro(MaximumNumberOfSteps, vtkIdType);
289 vtkGetMacro(MaximumNumberOfSteps, vtkIdType);
291
293
296 vtkSetMacro(TerminalSpeed, double);
297 vtkGetMacro(TerminalSpeed, double);
299
301
304 vtkGetMacro(SurfaceStreamlines, bool);
305 vtkSetMacro(SurfaceStreamlines, bool);
306 vtkBooleanMacro(SurfaceStreamlines, bool);
308
309 enum
310 {
313 BOTH
314 };
315
316 enum
317 {
319 INTERPOLATOR_WITH_CELL_LOCATOR
320 };
321
323
327 vtkSetClampMacro(IntegrationDirection, int, FORWARD, BOTH);
328 vtkGetMacro(IntegrationDirection, int);
329 void SetIntegrationDirectionToForward() { this->SetIntegrationDirection(FORWARD); }
330 void SetIntegrationDirectionToBackward() { this->SetIntegrationDirection(BACKWARD); }
331 void SetIntegrationDirectionToBoth() { this->SetIntegrationDirection(BOTH); }
333
335
340 vtkSetMacro(ComputeVorticity, bool);
341 vtkGetMacro(ComputeVorticity, bool);
343
345
349 vtkSetMacro(RotationScale, double);
350 vtkGetMacro(RotationScale, double);
352
354
362 vtkSetMacro(UseLocalSeedSource, bool);
363 vtkGetMacro(UseLocalSeedSource, bool);
364 vtkBooleanMacro(UseLocalSeedSource, bool);
366
372
382 void SetInterpolatorType(int interpType);
383
393 typedef bool (*CustomTerminationCallbackType)(
394 void* clientdata, vtkPoints* points, vtkDataArray* velocity, int integrationDirection);
404 CustomTerminationCallbackType callback, void* clientdata, int reasonForTermination);
405
406protected:
409
410 // Create a default executive.
412
413 // hide the superclass' AddInput() from the user and the compiler
415 {
416 vtkErrorMacro(<< "AddInput() must be called with a vtkDataSet not a vtkDataObject.");
417 }
418
421
423 vtkGenericCell* cell, double pcoords[3], vtkDoubleArray* cellVectors, double vorticity[3]);
424 void Integrate(vtkPointData* inputData, vtkPolyData* output, vtkDataArray* seedSource,
425 vtkIdList* seedIds, vtkIntArray* integrationDirections, double lastPoint[3],
426 vtkAbstractInterpolatedVelocityField* func, int maxCellSize, int vecType,
427 const char* vecFieldName, double& propagation, vtkIdType& numSteps, double& integrationTime);
428 double SimpleIntegrate(double seed[3], double lastPoint[3], double stepSize,
431 void GenerateNormals(vtkPolyData* output, double* firstNormal, const char* vecName);
432
434
435 // starting from global x-y-z position
436 double StartPosition[3];
437
438 static const double EPSILON;
440
442
444 {
445 double Interval;
446 int Unit;
447 };
448
453
455 double& step, double& minStep, double& maxStep, int direction, double cellLength);
456 static double ConvertToLength(double interval, int unit, double cellLength);
457 static double ConvertToLength(IntervalInformation& interval, double cellLength);
458
460 void InitializeSeeds(vtkDataArray*& seeds, vtkIdList*& seedIds,
461 vtkIntArray*& integrationDirections, vtkDataSet* source);
462
465
466 // Prototype showing the integrator type to be set by the user.
468
471
474
475 // Compute streamlines only on surface.
477
478 // Only relevant for the parallel version of this filter (see vtkPStreamTracer)
479 bool UseLocalSeedSource = true;
480
482
484 bool
485 HasMatchingPointAttributes; // does the point data in the multiblocks have the same attributes?
486 std::vector<CustomTerminationCallbackType> CustomTerminationCallback;
487 std::vector<void*> CustomTerminationClientData;
489
490 friend class PStreamTracerUtils;
491
492private:
493 vtkStreamTracer(const vtkStreamTracer&) = delete;
494 void operator=(const vtkStreamTracer&) = delete;
495};
496
497#endif
An abstract class for obtaining the interpolated velocity values at a point.
Proxy object to connect input/output ports.
abstract superclass for composite (multi-block or AMR) datasets
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:59
general representation of visualization data
Definition: vtkDataObject.h:69
represent and manipulate attribute data in a dataset
abstract class to specify dataset behavior
Definition: vtkDataSet.h:66
dynamic, self-adjusting array of double
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:56
provides thread-safe access to cells
list of point or cell ids
Definition: vtkIdList.h:40
a simple class to control print indentation
Definition: vtkIndent.h:43
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:49
represent and manipulate point attribute data
Definition: vtkPointData.h:42
represent and manipulate 3D points
Definition: vtkPoints.h:43
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:95
Streamline generator.
void SetIntegratorTypeToRungeKutta45()
Set/get the integrator type to be used for streamline generation.
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
int SetupOutput(vtkInformation *inInfo, vtkInformation *outInfo)
std::vector< void * > CustomTerminationClientData
void Integrate(vtkPointData *inputData, vtkPolyData *output, vtkDataArray *seedSource, vtkIdList *seedIds, vtkIntArray *integrationDirections, double lastPoint[3], vtkAbstractInterpolatedVelocityField *func, int maxCellSize, int vecType, const char *vecFieldName, double &propagation, vtkIdType &numSteps, double &integrationTime)
@ INTERPOLATOR_WITH_DATASET_POINT_LOCATOR
void SetSourceData(vtkDataSet *source)
Specify the source object used to generate starting points (seeds).
vtkDataSet * GetSource()
Specify the source object used to generate starting points (seeds).
double InitialIntegrationStep
vtkAbstractInterpolatedVelocityField * InterpolatorPrototype
void SetInterpolatorTypeToCellLocator()
Set the velocity field interpolator type to the one involving a cell locator.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void CalculateVorticity(vtkGenericCell *cell, double pcoords[3], vtkDoubleArray *cellVectors, double vorticity[3])
double MinimumIntegrationStep
void SetIntegratorTypeToRungeKutta4()
Set/get the integrator type to be used for streamline generation.
static double ConvertToLength(double interval, int unit, double cellLength)
void SetIntegrator(vtkInitialValueProblemSolver *)
Set/get the integrator type to be used for streamline generation.
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify the source object used to generate starting points (seeds).
std::vector< int > CustomReasonForTermination
static double ConvertToLength(IntervalInformation &interval, double cellLength)
int CheckInputs(vtkAbstractInterpolatedVelocityField *&func, int *maxCellSize)
void ConvertIntervals(double &step, double &minStep, double &maxStep, int direction, double cellLength)
void GenerateNormals(vtkPolyData *output, double *firstNormal, const char *vecName)
static const double EPSILON
vtkIdType MaximumNumberOfSteps
void SetIntegrationDirectionToForward()
Specify whether the streamline is integrated in the upstream or downstream direction.
std::vector< CustomTerminationCallbackType > CustomTerminationCallback
static vtkStreamTracer * New()
Construct object to start from position (0,0,0), with forward integration, terminal speed 1....
bool HasMatchingPointAttributes
vtkCompositeDataSet * InputData
void SetInterpolatorType(int interpType)
Set the type of the velocity field interpolator to determine whether vtkInterpolatedVelocityField (IN...
double MaximumIntegrationStep
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
bool GenerateNormalsInIntegrate
vtkExecutive * CreateDefaultExecutive() override
Create a default executive.
void SetIntegrationDirectionToBackward()
Specify whether the streamline is integrated in the upstream or downstream direction.
void SetInterpolatorTypeToDataSetPointLocator()
Set the velocity field interpolator type to the one involving a dataset point locator.
int GetIntegratorType()
Set/get the integrator type to be used for streamline generation.
void AddCustomTerminationCallback(CustomTerminationCallbackType callback, void *clientdata, int reasonForTermination)
Adds a custom termination callback.
void InitializeSeeds(vtkDataArray *&seeds, vtkIdList *&seedIds, vtkIntArray *&integrationDirections, vtkDataSet *source)
void SetIntegratorTypeToRungeKutta2()
Set/get the integrator type to be used for streamline generation.
void SetIntegrationDirectionToBoth()
Specify whether the streamline is integrated in the upstream or downstream direction.
double SimpleIntegrate(double seed[3], double lastPoint[3], double stepSize, vtkAbstractInterpolatedVelocityField *func)
~vtkStreamTracer() override
void AddInput(vtkDataObject *)
vtkInitialValueProblemSolver * Integrator
void SetInterpolatorPrototype(vtkAbstractInterpolatedVelocityField *ivf)
The object used to interpolate the velocity field during integration is of the same class as this pro...
void SetIntegrationStepUnit(int unit)
Specify a uniform integration step unit for MinimumIntegrationStep, InitialIntegrationStep,...
void SetIntegratorType(int type)
Set/get the integrator type to be used for streamline generation.
int GetIntegrationStepUnit()
@ points
Definition: vtkX3D.h:452
@ direction
Definition: vtkX3D.h:266
@ type
Definition: vtkX3D.h:522
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
int vtkIdType
Definition: vtkType.h:332