VTK  9.6.20260605
vtkStreamTracer.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
190
191#ifndef vtkStreamTracer_h
192#define vtkStreamTracer_h
193
194#include "vtkDeprecation.h" // VTK_DEPRECATED_IN_9_7_0
195#include "vtkFiltersFlowPathsModule.h" // For export macro
196#include "vtkPolyDataAlgorithm.h"
197
198#include "vtkDataSetAttributesFieldList.h" // Needed to identify common data arrays
199#include "vtkInitialValueProblemSolver.h" // Needed for constants
200
201VTK_ABI_NAMESPACE_BEGIN
205class vtkDataArray;
207class vtkDoubleArray;
208class vtkExecutive;
209class vtkGenericCell;
210class vtkIdList;
211class vtkIntArray;
212class vtkPoints;
213
214VTK_ABI_NAMESPACE_END
215#include <vector> // for std::vector
216
217// Helper struct to convert between different length scales.
218VTK_ABI_NAMESPACE_BEGIN
219struct VTKFILTERSFLOWPATHS_EXPORT vtkIntervalInformation
220{
221 double Interval;
222 int Unit;
223
224 static double ConvertToLength(double interval, int unit, double cellLength);
225 static double ConvertToLength(vtkIntervalInformation& interval, double cellLength);
226};
227
239 void* clientdata, vtkPoints* points, vtkDataArray* velocity, int integrationDirection);
240
241class VTKFILTERSFLOWPATHS_EXPORT vtkStreamTracer : public vtkPolyDataAlgorithm
242{
243public:
252
254
258 void PrintSelf(ostream& os, vtkIndent indent) override;
260
262
267 vtkSetVector3Macro(StartPosition, double);
268 vtkGetVector3Macro(StartPosition, double);
270
272
281
288
289 // The previously-supported TIME_UNIT is excluded in this current
290 // enumeration definition because the underlying step size is ALWAYS in
291 // arc length unit (LENGTH_UNIT) while the 'real' time interval (virtual
292 // for steady flows) that a particle actually takes to trave in a single
293 // step is obtained by dividing the arc length by the LOCAL speed. The
294 // overall elapsed time (i.e., the life span) of the particle is the sum
295 // of those individual step-wise time intervals. The arc-length-to-time
296 // conversion only occurs for vorticity computation and for generating a
297 // point data array named 'IntegrationTime'.
298 enum Units
299 {
302 };
303
312
323
325
337 void SetIntegratorType(int type);
343
353 VTK_DEPRECATED_IN_9_7_0("Use SetCellLocatorToJumpAndWalkCellLocator() instead")
355
362 VTK_DEPRECATED_IN_9_7_0("Use SetCellLocatorToStaticCellLocator() instead")
364
366
369 vtkSetMacro(MaximumPropagation, double);
370 vtkGetMacro(MaximumPropagation, double);
372
381
383
390 vtkSetMacro(InitialIntegrationStep, double);
391 vtkGetMacro(InitialIntegrationStep, double);
393
395
401 vtkSetMacro(MinimumIntegrationStep, double);
402 vtkGetMacro(MinimumIntegrationStep, double);
404
406
412 vtkSetMacro(MaximumIntegrationStep, double);
413 vtkGetMacro(MaximumIntegrationStep, double);
415
417
420 vtkSetMacro(MaximumError, double);
421 vtkGetMacro(MaximumError, double);
423
425
436
438
442 vtkSetMacro(TerminalSpeed, double);
443 vtkGetMacro(TerminalSpeed, double);
445
447
451 vtkGetMacro(SurfaceStreamlines, bool);
452 vtkSetMacro(SurfaceStreamlines, bool);
453 vtkBooleanMacro(SurfaceStreamlines, bool);
455
456 enum
457 {
461 };
462
463 enum
464 {
466 "Use SetCellLocatorToJumpAndWalkCellLocator() instead"),
468 "Use SetCellLocatorToStaticCellLocator() instead")
469 };
470
472
479 vtkSetClampMacro(IntegrationDirection, int, FORWARD, BOTH);
480 vtkGetMacro(IntegrationDirection, int);
485
487
492 vtkSetMacro(ComputeVorticity, bool);
493 vtkGetMacro(ComputeVorticity, bool);
495
497
501 vtkSetMacro(RotationScale, double);
502 vtkGetMacro(RotationScale, double);
504
514 VTK_DEPRECATED_IN_9_7_0("Use SetCellLocator(vtkAbstractCellLocator*) instead")
516
526 VTK_DEPRECATED_IN_9_7_0("Use SetCellLocator(vtkAbstractCellLocator*) instead")
527 void SetInterpolatorType(int interpType);
528
530
540
542
546 vtkGetMacro(ForceSerialExecution, bool);
547 vtkSetMacro(ForceSerialExecution, bool);
548 vtkBooleanMacro(ForceSerialExecution, bool);
550
560 CustomTerminationCallbackType callback, void* clientdata, int reasonForTermination);
561
565
571 double& step, double& minStep, double& maxStep, int direction, double cellLength);
572
574
578 void GenerateNormals(vtkPolyData* output, double* firstNormal, const char* vecName);
580 vtkGenericCell* cell, double pcoords[3], vtkDoubleArray* cellVectors, double vorticity[3]);
582
584
594 vtkSetMacro(UseLocalSeedSource, bool);
595 vtkGetMacro(UseLocalSeedSource, bool);
596 vtkBooleanMacro(UseLocalSeedSource, bool);
598
599protected:
601 ~vtkStreamTracer() override;
602
603 // Create a default executive.
605
606 // hide the superclass' AddInput() from the user and the compiler
608 {
609 vtkErrorMacro(<< "AddInput() must be called with a vtkDataSet not a vtkDataObject.");
610 }
611
614
615 void Integrate(vtkPointData* inputData, vtkPolyData* output, vtkDataArray* seedSource,
616 vtkIdList* seedIds, vtkIntArray* integrationDirections,
617 vtkAbstractInterpolatedVelocityField* func, int maxCellSize, int vecType,
618 const char* vecFieldName, double& propagation, vtkIdType& numSteps, double& integrationTime,
619 std::vector<CustomTerminationCallbackType>& customTerminationCallback,
620 std::vector<void*>& customTerminationClientData, std::vector<int>& customReasonForTermination);
621
622 double SimpleIntegrate(double seed[3], double lastPoint[3], double stepSize,
625
627
628 // starting from global x-y-z position
629 double StartPosition[3];
630
631 static const double EPSILON;
633
634 // Used by subclasses, leave alone
636
641
643 void InitializeSeeds(vtkDataArray*& seeds, vtkIdList*& seedIds,
644 vtkIntArray*& integrationDirections, vtkDataSet* source);
645
648
649 // Prototype showing the integrator type to be set by the user.
651
654
657
658 // Compute streamlines only on surface.
660
662
663 // These are used to manage complex input types such as
664 // multiblock / composite datasets. Basically the filter input is
665 // converted to a composite dataset, and the point data attributes
666 // are intersected to produce a common set of output data arrays.
667 vtkCompositeDataSet* InputData; // convert input data to composite dataset
668 vtkDataSetAttributesFieldList InputPD; // intersect attributes of all datasets
669 bool
670 HasMatchingPointAttributes; // does the point data in the multiblocks have the same attributes?
671
672 // Control execution as serial or threaded
674 bool SerialExecution; // internal use to combine information
675
676 std::vector<CustomTerminationCallbackType> CustomTerminationCallback;
677 std::vector<void*> CustomTerminationClientData;
679
680 // Only relevant for this derived parallel version of vtkStreamTracer,
681 // but needs to be defined in this class to have a uniform interface
682 // between this class and the parallel override vtkPStreamTracer
684
685 friend class PStreamTracerUtils;
686
687private:
688 vtkStreamTracer(const vtkStreamTracer&) = delete;
689 void operator=(const vtkStreamTracer&) = delete;
690};
691
692VTK_ABI_NAMESPACE_END
693#endif
an abstract base class for locators which find cells
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:166
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:135
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
represent and manipulate point attribute data
represent and manipulate 3D points
Definition vtkPoints.h:140
concrete dataset represents vertices, lines, polygons, and triangle strips
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
virtual void SetCellLocator(vtkAbstractCellLocator *)
Set / get the cell locator used to perform the FindCell() operation for vtkPointSet.
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
virtual void SetCellLocatorToStaticCellLocator()
Set / get the cell locator used to perform the FindCell() operation for vtkPointSet.
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
virtual void SetCellLocatorToJumpAndWalkCellLocator()
Set / get the cell locator used to perform the FindCell() operation for vtkPointSet.
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.
vtkAbstractCellLocator * CellLocator
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)
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
#define VTK_DEPRECATED_IN_9_7_0(reason)
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:363