VTK  9.2.6
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=========================================================================*/
90
91#ifndef vtkStreamTracer_h
92#define vtkStreamTracer_h
93
94#include "vtkFiltersFlowPathsModule.h" // For export macro
96
97#include "vtkDataSetAttributesFieldList.h" // Needed to identify common data arrays
98#include "vtkInitialValueProblemSolver.h" // Needed for constants
99
102class vtkDataArray;
104class vtkDoubleArray;
105class vtkExecutive;
106class vtkGenericCell;
107class vtkIdList;
108class vtkIntArray;
109class vtkPoints;
110
111#include <vector> // for std::vector
112
113// Helper struct to convert between different length scales.
114struct VTKFILTERSFLOWPATHS_EXPORT vtkIntervalInformation
115{
116 double Interval;
117 int Unit;
118
119 static double ConvertToLength(double interval, int unit, double cellLength);
120 static double ConvertToLength(vtkIntervalInformation& interval, double cellLength);
121};
122
134 void* clientdata, vtkPoints* points, vtkDataArray* velocity, int integrationDirection);
135
136class VTKFILTERSFLOWPATHS_EXPORT vtkStreamTracer : public vtkPolyDataAlgorithm
137{
138public:
147
149
153 void PrintSelf(ostream& os, vtkIndent indent) override;
155
157
162 vtkSetVector3Macro(StartPosition, double);
163 vtkGetVector3Macro(StartPosition, double);
165
167
176
183
184 // The previously-supported TIME_UNIT is excluded in this current
185 // enumeration definition because the underlying step size is ALWAYS in
186 // arc length unit (LENGTH_UNIT) while the 'real' time interval (virtual
187 // for steady flows) that a particle actually takes to trave in a single
188 // step is obtained by dividing the arc length by the LOCAL speed. The
189 // overall elapsed time (i.e., the life span) of the particle is the sum
190 // of those individual step-wise time intervals. The arc-length-to-time
191 // conversion only occurs for vorticity computation and for generating a
192 // point data array named 'IntegrationTime'.
193 enum Units
194 {
197 };
198
207
218
220
232 void SetIntegratorType(int type);
238
249
257
259
262 vtkSetMacro(MaximumPropagation, double);
263 vtkGetMacro(MaximumPropagation, double);
265
274
276
283 vtkSetMacro(InitialIntegrationStep, double);
284 vtkGetMacro(InitialIntegrationStep, double);
286
288
294 vtkSetMacro(MinimumIntegrationStep, double);
295 vtkGetMacro(MinimumIntegrationStep, double);
297
299
305 vtkSetMacro(MaximumIntegrationStep, double);
306 vtkGetMacro(MaximumIntegrationStep, double);
308
310
313 vtkSetMacro(MaximumError, double);
314 vtkGetMacro(MaximumError, double);
316
318
329
331
335 vtkSetMacro(TerminalSpeed, double);
336 vtkGetMacro(TerminalSpeed, double);
338
340
343 vtkGetMacro(SurfaceStreamlines, bool);
344 vtkSetMacro(SurfaceStreamlines, bool);
345 vtkBooleanMacro(SurfaceStreamlines, bool);
347
348 enum
349 {
353 };
354
355 enum
356 {
359 };
360
362
369 vtkSetClampMacro(IntegrationDirection, int, FORWARD, BOTH);
370 vtkGetMacro(IntegrationDirection, int);
375
377
382 vtkSetMacro(ComputeVorticity, bool);
383 vtkGetMacro(ComputeVorticity, bool);
385
387
391 vtkSetMacro(RotationScale, double);
392 vtkGetMacro(RotationScale, double);
394
405
415 void SetInterpolatorType(int interpType);
416
418
422 vtkGetMacro(ForceSerialExecution, bool);
423 vtkSetMacro(ForceSerialExecution, bool);
424 vtkBooleanMacro(ForceSerialExecution, bool);
426
436 CustomTerminationCallbackType callback, void* clientdata, int reasonForTermination);
437
441
447 double& step, double& minStep, double& maxStep, int direction, double cellLength);
448
450
454 void GenerateNormals(vtkPolyData* output, double* firstNormal, const char* vecName);
456 vtkGenericCell* cell, double pcoords[3], vtkDoubleArray* cellVectors, double vorticity[3]);
458
460
470 vtkSetMacro(UseLocalSeedSource, bool);
471 vtkGetMacro(UseLocalSeedSource, bool);
472 vtkBooleanMacro(UseLocalSeedSource, bool);
474
475protected:
478
479 // Create a default executive.
481
482 // hide the superclass' AddInput() from the user and the compiler
484 {
485 vtkErrorMacro(<< "AddInput() must be called with a vtkDataSet not a vtkDataObject.");
486 }
487
490
491 void Integrate(vtkPointData* inputData, vtkPolyData* output, vtkDataArray* seedSource,
492 vtkIdList* seedIds, vtkIntArray* integrationDirections,
493 vtkAbstractInterpolatedVelocityField* func, int maxCellSize, int vecType,
494 const char* vecFieldName, double& propagation, vtkIdType& numSteps, double& integrationTime,
495 std::vector<CustomTerminationCallbackType>& customTerminationCallback,
496 std::vector<void*>& customTerminationClientData, std::vector<int>& customReasonForTermination);
497
498 double SimpleIntegrate(double seed[3], double lastPoint[3], double stepSize,
501
503
504 // starting from global x-y-z position
505 double StartPosition[3];
506
507 static const double EPSILON;
509
510 // Used by subclasses, leave alone
512
517
519 void InitializeSeeds(vtkDataArray*& seeds, vtkIdList*& seedIds,
520 vtkIntArray*& integrationDirections, vtkDataSet* source);
521
524
525 // Prototype showing the integrator type to be set by the user.
527
530
533
534 // Compute streamlines only on surface.
536
538
539 // These are used to manage complex input types such as
540 // multiblock / composite datasets. Basically the filter input is
541 // converted to a composite dataset, and the point data attributes
542 // are intersected to produce a common set of output data arrays.
543 vtkCompositeDataSet* InputData; // convert input data to composite dataset
544 vtkDataSetAttributesFieldList InputPD; // intersect attributes of all datasets
545 bool
546 HasMatchingPointAttributes; // does the point data in the multiblocks have the same attributes?
547
548 // Control execution as serial or threaded
550 bool SerialExecution; // internal use to combine information
551
552 std::vector<CustomTerminationCallbackType> CustomTerminationCallback;
553 std::vector<void*> CustomTerminationClientData;
555
556 // Only relevant for this derived parallel version of vtkStreamTracer,
557 // but needs to be defined in this class to have a uniform interface
558 // betwen this class and the parallel override vtkPStreamTracer
560
561 friend class PStreamTracerUtils;
562
563private:
564 vtkStreamTracer(const vtkStreamTracer&) = delete;
565 void operator=(const vtkStreamTracer&) = delete;
566};
567
568#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
general representation of visualization data
helps manage arrays from multiple vtkDataSetAttributes.
represent and manipulate attribute data in a dataset
abstract class to specify dataset behavior
Definition vtkDataSet.h:57
dynamic, self-adjusting array of double
Superclass for all pipeline executives in VTK.
provides thread-safe access to cells
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
represent and manipulate point attribute data
represent and manipulate 3D points
Definition vtkPoints.h:34
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:85
void SetIntegratorTypeToRungeKutta45()
Set/get the integrator type to be used for streamline generation.
double StartPosition[3]
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
int SetupOutput(vtkInformation *inInfo, vtkInformation *outInfo)
std::vector< void * > CustomTerminationClientData
friend class PStreamTracerUtils
vtkDataSetAttributesFieldList InputPD
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 one that uses a cell locator to perform spatial searching...
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods to obtain type information and print object state.
void CalculateVorticity(vtkGenericCell *cell, double pcoords[3], vtkDoubleArray *cellVectors, double vorticity[3])
Helper methods to generate normals on streamlines.
double MinimumIntegrationStep
void SetIntegratorTypeToRungeKutta4()
Set/get the integrator type to be used for streamline generation.
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
int CheckInputs(vtkAbstractInterpolatedVelocityField *&func, int *maxCellSize)
@ INTERPOLATOR_WITH_DATASET_POINT_LOCATOR
void ConvertIntervals(double &step, double &minStep, double &maxStep, int direction, double cellLength)
The following methods should not be called by the user.
void GenerateNormals(vtkPolyData *output, double *firstNormal, const char *vecName)
Helper methods to generate normals on streamlines.
virtual void SetIntegrationDirection(int)
Specify whether the streamline is integrated in the upstream or downstream direction,...
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 the object to start from position (0,0,0), with forward integration, terminal speed 1....
vtkCompositeDataSet * InputData
void SetInterpolatorType(int interpType)
Set the type of the velocity field interpolator to determine whether INTERPOLATOR_WITH_DATASET_POINT_...
double MaximumIntegrationStep
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkExecutive * CreateDefaultExecutive() override
Create a default executive.
void Integrate(vtkPointData *inputData, vtkPolyData *output, vtkDataArray *seedSource, vtkIdList *seedIds, vtkIntArray *integrationDirections, vtkAbstractInterpolatedVelocityField *func, int maxCellSize, int vecType, const char *vecFieldName, double &propagation, vtkIdType &numSteps, double &integrationTime, std::vector< CustomTerminationCallbackType > &customTerminationCallback, std::vector< void * > &customTerminationClientData, std::vector< int > &customReasonForTermination)
void SetIntegrationDirectionToBackward()
Specify whether the streamline is integrated in the upstream or downstream direction,...
void SetInterpolatorTypeToDataSetPointLocator()
Set the velocity field interpolator type to one that uses a point locator to perform local spatial se...
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.
static double ConvertToLength(double interval, int unit, double cellLength)
static double ConvertToLength(vtkIntervalInformation &interval, double cellLength)
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
#define vtkDataArray
bool(* CustomTerminationCallbackType)(void *clientdata, vtkPoints *points, vtkDataArray *velocity, int integrationDirection)
Used to specify custom conditions which are evaluated to determine whether a streamline should be ter...
int vtkIdType
Definition vtkType.h:332