VTK: Filters/FlowPaths/vtkLagrangianParticleTracker.h Source File

| VTK 9.3.1

vtkLagrangianParticleTracker.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
79 #ifndef vtkLagrangianParticleTracker_h
80 #define vtkLagrangianParticleTracker_h
81
82 #include "vtkBoundingBox.h" // For cached bounds
83 #include "vtkDataObjectAlgorithm.h"
84 #include "vtkFiltersFlowPathsModule.h" // For export macro
85 #include "vtkSmartPointer.h" // For smart pointer
86
87 #include <atomic> // for atomic
88 #include <mutex> // for mutexes
89 #include <queue> // for particle queue
90
91 VTK_ABI_NAMESPACE_BEGIN
92 class vtkBoundingBox;
93 class vtkCellArray;
94 class vtkDataSet;
95 class vtkDoubleArray;
96 class vtkIdList;
97 class vtkInformation;
98 class vtkInitialValueProblemSolver;
99 class vtkLagrangianBasicIntegrationModel;
100 class vtkLagrangianParticle;
101 class vtkMultiBlockDataSet;
102 class vtkMultiPieceDataSet;
103 class vtkPointData;
104 class vtkPoints;
105 class vtkPolyData;
106 class vtkPolyLine;
107 struct IntegratingFunctor;
108 struct vtkLagrangianThreadedData;
109
110 class VTKFILTERSFLOWPATHS_EXPORT vtkLagrangianParticleTracker : public vtkDataObjectAlgorithm
111 {
112 public:
113 vtkTypeMacro(vtkLagrangianParticleTracker, vtkDataObjectAlgorithm);
114 void PrintSelf(ostream& os, vtkIndent indent) override;
115 static vtkLagrangianParticleTracker* New();
116
117 typedef enum CellLengthComputation
118 {
119 STEP_CUR_CELL_LENGTH = 1,
120 STEP_CUR_CELL_VEL_DIR = 3,
121 STEP_CUR_CELL_DIV_THEO = 5
122 } CellLengthComputation;
123
125
129 void SetIntegrationModel(vtkLagrangianBasicIntegrationModel* integrationModel);
130 vtkLagrangianBasicIntegrationModel* GetIntegrationModel();
132
134
138 void SetIntegrator(vtkInitialValueProblemSolver* integrator);
139 vtkInitialValueProblemSolver* GetIntegrator();
141
143
148 vtkSetMacro(GeneratePolyVertexInteractionOutput, bool);
149 vtkGetMacro(GeneratePolyVertexInteractionOutput, bool);
151
153
166 vtkSetMacro(CellLengthComputationMode, int);
167 vtkGetMacro(CellLengthComputationMode, int);
169
171
174 vtkSetMacro(StepFactor, double);
175 vtkGetMacro(StepFactor, double);
177
179
182 vtkSetMacro(StepFactorMin, double);
183 vtkGetMacro(StepFactorMin, double);
185
187
190 vtkSetMacro(StepFactorMax, double);
191 vtkGetMacro(StepFactorMax, double);
193
195
198 vtkSetMacro(MaximumNumberOfSteps, int);
199 vtkGetMacro(MaximumNumberOfSteps, int);
201
203
207 vtkSetMacro(MaximumIntegrationTime, double);
208 vtkGetMacro(MaximumIntegrationTime, double);
210
212
218 vtkSetMacro(AdaptiveStepReintegration, bool);
219 vtkGetMacro(AdaptiveStepReintegration, bool);
220 vtkBooleanMacro(AdaptiveStepReintegration, bool);
222
224
228 vtkSetMacro(GenerateParticlePathsOutput, bool);
229 vtkGetMacro(GenerateParticlePathsOutput, bool);
230 vtkBooleanMacro(GenerateParticlePathsOutput, bool);
232
234
240 void SetSourceData(vtkDataObject* source);
241 vtkDataObject* GetSource();
243
247 void SetSourceConnection(vtkAlgorithmOutput* algOutput);
248
250
256 void SetSurfaceData(vtkDataObject* source);
257 vtkDataObject* GetSurface();
259
263 void SetSurfaceConnection(vtkAlgorithmOutput* algOutput);
264
268 int FillInputPortInformation(int port, vtkInformation* info) override;
269
273 int FillOutputPortInformation(int port, vtkInformation* info) override;
274
278 int RequestDataObject(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
279
283 int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
284 vtkInformationVector* outputVector) override;
285
290 vtkMTimeType GetMTime() override;
291
296 virtual vtkIdType GetNewParticleId();
297
298 protected:
299 vtkLagrangianParticleTracker();
300 ~vtkLagrangianParticleTracker() override;
301
302 virtual bool InitializeFlow(vtkDataObject* flow, vtkBoundingBox* bounds);
303 virtual bool InitializeParticles(const vtkBoundingBox* bounds, vtkDataSet* seeds,
304 std::queue<vtkLagrangianParticle*>& particles, vtkPointData* seedData);
305 virtual void GenerateParticles(const vtkBoundingBox* bounds, vtkDataSet* seeds,
306 vtkDataArray* initialVelocities, vtkDataArray* initialIntegrationTimes, vtkPointData* seedData,
307 int nVar, std::queue<vtkLagrangianParticle*>& particles);
308 virtual bool UpdateSurfaceCacheIfNeeded(vtkDataObject*& surfaces);
309 virtual void InitializeSurface(vtkDataObject*& surfaces);
310
314 virtual bool InitializePathsOutput(
315 vtkPointData* seedData, vtkIdType numberOfSeeds, vtkPolyData*& particlePathsOutput);
316
320 virtual bool InitializeInteractionOutput(
321 vtkPointData* seedData, vtkDataObject* surfaces, vtkDataObject*& interractionOutput);
322
323 virtual bool FinalizeOutputs(vtkPolyData* particlePathsOutput, vtkDataObject* interactionOutput);
324
325 static void InsertPolyVertexCell(vtkPolyData* polydata);
326 static void InsertVertexCells(vtkPolyData* polydata);
327
328 virtual void GetParticleFeed(std::queue<vtkLagrangianParticle*>& particleQueue);
329
333 virtual int Integrate(vtkInitialValueProblemSolver* integrator, vtkLagrangianParticle*,
334 std::queue<vtkLagrangianParticle*>&, vtkPolyData* particlePathsOutput,
335 vtkPolyLine* particlePath, vtkDataObject* interactionOutput);
336
340 void InsertPathOutputPoint(vtkLagrangianParticle* particle, vtkPolyData* particlePathsOutput,
341 vtkIdList* particlePathPointId, bool prev = false);
342
346 void InsertInteractionOutputPoint(vtkLagrangianParticle* particle,
347 unsigned int interactedSurfaceFlatIndex, vtkDataObject* interactionOutput);
348
353 double ComputeCellLength(vtkLagrangianParticle* particle);
354
358 bool ComputeNextStep(vtkInitialValueProblemSolver* integrator, double* xprev, double* xnext,
359 double t, double& delT, double& delTActual, double minStep, double maxStep, double cellLength,
360 int& integrationRes, vtkLagrangianParticle* particle);
361
366 virtual void DeleteParticle(vtkLagrangianParticle* particle);
367
368 vtkSmartPointer<vtkLagrangianBasicIntegrationModel> IntegrationModel;
369 vtkSmartPointer<vtkInitialValueProblemSolver> Integrator;
370
371 int CellLengthComputationMode;
372 double StepFactor;
373 double StepFactorMin;
374 double StepFactorMax;
375 int MaximumNumberOfSteps;
376 double MaximumIntegrationTime;
377 bool AdaptiveStepReintegration;
378 bool GenerateParticlePathsOutput = true;
379 bool GeneratePolyVertexInteractionOutput;
380 std::atomic<vtkIdType> ParticleCounter;
381 std::atomic<vtkIdType> IntegratedParticleCounter;
382 vtkIdType IntegratedParticleCounterIncrement;
383 vtkPointData* SeedData;
384
385 // internal parameters use for step computation
386 double MinimumVelocityMagnitude;
387 double MinimumReductionFactor;
388
389 // Cache related parameters
390 vtkDataObject* FlowCache;
391 vtkMTimeType FlowTime;
392 vtkBoundingBox FlowBoundsCache;
393 bool FlowCacheInvalid = true;
394 vtkDataObject* SurfacesCache;
395 vtkMTimeType SurfacesTime;
396 bool SurfaceCacheInvalid = true;
397
398 std::mutex ProgressMutex;
399 friend struct IntegratingFunctor;
400
401 vtkLagrangianThreadedData* SerialThreadedData;
402
403 private:
404 vtkLagrangianParticleTracker(const vtkLagrangianParticleTracker&) = delete;
405 void operator=(const vtkLagrangianParticleTracker&) = delete;
406 };
407
408 VTK_ABI_NAMESPACE_END
409 #endif
vtkAlgorithmOutput
Proxy object to connect input/output ports.
Definition: vtkAlgorithmOutput.h:41
vtkBoundingBox
Fast, simple class for representing and operating on 3D bounds.
Definition: vtkBoundingBox.h:38
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:185
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkDataObjectAlgorithm
Superclass for algorithms that produce only data object as output.
Definition: vtkDataObjectAlgorithm.h:33
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:64
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:40
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:32
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:40
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:72
vtkInitialValueProblemSolver
Integrate a set of ordinary differential equations (initial value problem) in time.
Definition: vtkInitialValueProblemSolver.h:30
vtkLagrangianBasicIntegrationModel
vtkFunctionSet abstract implementation to be used in the vtkLagrangianParticleTracker integrator.
Definition: vtkLagrangianBasicIntegrationModel.h:80
vtkLagrangianParticleTracker
Filter to inject and track particles in a flow.
Definition: vtkLagrangianParticleTracker.h:111
vtkLagrangianParticleTracker::StepFactor
double StepFactor
Definition: vtkLagrangianParticleTracker.h:372
vtkLagrangianParticleTracker::StepFactorMin
double StepFactorMin
Definition: vtkLagrangianParticleTracker.h:373
vtkLagrangianParticleTracker::GetSurface
vtkDataObject * GetSurface()
Specify the source object used to compute surface interaction with Note that this method does not con...
vtkLagrangianParticleTracker::IntegratedParticleCounterIncrement
vtkIdType IntegratedParticleCounterIncrement
Definition: vtkLagrangianParticleTracker.h:382
vtkLagrangianParticleTracker::MinimumVelocityMagnitude
double MinimumVelocityMagnitude
Definition: vtkLagrangianParticleTracker.h:386
vtkLagrangianParticleTracker::SetSourceConnection
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify the source object used to generate particle initial position (seeds).
vtkLagrangianParticleTracker::UpdateSurfaceCacheIfNeeded
virtual bool UpdateSurfaceCacheIfNeeded(vtkDataObject *&surfaces)
vtkLagrangianParticleTracker::SurfacesCache
vtkDataObject * SurfacesCache
Definition: vtkLagrangianParticleTracker.h:394
vtkLagrangianParticleTracker::SeedData
vtkPointData * SeedData
Definition: vtkLagrangianParticleTracker.h:383
vtkLagrangianParticleTracker::GetNewParticleId
virtual vtkIdType GetNewParticleId()
Get an unique id for a particle This method is thread safe.
vtkLagrangianParticleTracker::MaximumIntegrationTime
double MaximumIntegrationTime
Definition: vtkLagrangianParticleTracker.h:376
vtkLagrangianParticleTracker::InsertPathOutputPoint
void InsertPathOutputPoint(vtkLagrangianParticle *particle, vtkPolyData *particlePathsOutput, vtkIdList *particlePathPointId, bool prev=false)
This method is thread safe.
vtkLagrangianParticleTracker::ProgressMutex
std::mutex ProgressMutex
Definition: vtkLagrangianParticleTracker.h:398
vtkLagrangianParticleTracker::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Declare input port type.
vtkLagrangianParticleTracker::GetParticleFeed
virtual void GetParticleFeed(std::queue< vtkLagrangianParticle * > &particleQueue)
vtkLagrangianParticleTracker::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkLagrangianParticleTracker::GeneratePolyVertexInteractionOutput
bool GeneratePolyVertexInteractionOutput
Definition: vtkLagrangianParticleTracker.h:379
vtkLagrangianParticleTracker::RequestData
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Process inputs to integrate particle and generate output.
vtkLagrangianParticleTracker::FlowBoundsCache
vtkBoundingBox FlowBoundsCache
Definition: vtkLagrangianParticleTracker.h:392
vtkLagrangianParticleTracker::Integrator
vtkSmartPointer< vtkInitialValueProblemSolver > Integrator
Definition: vtkLagrangianParticleTracker.h:369
vtkLagrangianParticleTracker::SurfacesTime
vtkMTimeType SurfacesTime
Definition: vtkLagrangianParticleTracker.h:395
vtkLagrangianParticleTracker::ComputeNextStep
bool ComputeNextStep(vtkInitialValueProblemSolver *integrator, double *xprev, double *xnext, double t, double &delT, double &delTActual, double minStep, double maxStep, double cellLength, int &integrationRes, vtkLagrangianParticle *particle)
This method is thread safe.
vtkLagrangianParticleTracker::vtkLagrangianParticleTracker
vtkLagrangianParticleTracker()
vtkLagrangianParticleTracker::InitializeSurface
virtual void InitializeSurface(vtkDataObject *&surfaces)
vtkLagrangianParticleTracker::DeleteParticle
virtual void DeleteParticle(vtkLagrangianParticle *particle)
This method is thread safe Call the ParticleAboutToBeDeleted model method and delete the particle.
vtkLagrangianParticleTracker::GenerateParticles
virtual void GenerateParticles(const vtkBoundingBox *bounds, vtkDataSet *seeds, vtkDataArray *initialVelocities, vtkDataArray *initialIntegrationTimes, vtkPointData *seedData, int nVar, std::queue< vtkLagrangianParticle * > &particles)
vtkLagrangianParticleTracker::CellLengthComputation
CellLengthComputation
Definition: vtkLagrangianParticleTracker.h:118
vtkLagrangianParticleTracker::StepFactorMax
double StepFactorMax
Definition: vtkLagrangianParticleTracker.h:374
vtkLagrangianParticleTracker::New
static vtkLagrangianParticleTracker * New()
vtkLagrangianParticleTracker::InitializeParticles
virtual bool InitializeParticles(const vtkBoundingBox *bounds, vtkDataSet *seeds, std::queue< vtkLagrangianParticle * > &particles, vtkPointData *seedData)
vtkLagrangianParticleTracker::GetIntegrator
vtkInitialValueProblemSolver * GetIntegrator()
Set/Get the integrator.
vtkLagrangianParticleTracker::InsertPolyVertexCell
static void InsertPolyVertexCell(vtkPolyData *polydata)
vtkLagrangianParticleTracker::ComputeCellLength
double ComputeCellLength(vtkLagrangianParticle *particle)
Computes the cell length for the next step using the method set by CellLengthComputationMode.
vtkLagrangianParticleTracker::GetIntegrationModel
vtkLagrangianBasicIntegrationModel * GetIntegrationModel()
Set/Get the integration model.
vtkLagrangianParticleTracker::SetIntegrator
void SetIntegrator(vtkInitialValueProblemSolver *integrator)
Set/Get the integrator.
vtkLagrangianParticleTracker::SetSurfaceData
void SetSurfaceData(vtkDataObject *source)
Specify the source object used to compute surface interaction with Note that this method does not con...
vtkLagrangianParticleTracker::InsertVertexCells
static void InsertVertexCells(vtkPolyData *polydata)
vtkLagrangianParticleTracker::GetMTime
vtkMTimeType GetMTime() override
Get the tracker modified time taking into account the integration model and the integrator.
vtkLagrangianParticleTracker::IntegratedParticleCounter
std::atomic< vtkIdType > IntegratedParticleCounter
Definition: vtkLagrangianParticleTracker.h:381
vtkLagrangianParticleTracker::SetSurfaceConnection
void SetSurfaceConnection(vtkAlgorithmOutput *algOutput)
Specify the object used to compute surface interaction with.
vtkLagrangianParticleTracker::SerialThreadedData
vtkLagrangianThreadedData * SerialThreadedData
Definition: vtkLagrangianParticleTracker.h:401
vtkLagrangianParticleTracker::SetIntegrationModel
void SetIntegrationModel(vtkLagrangianBasicIntegrationModel *integrationModel)
Set/Get the integration model.
vtkLagrangianParticleTracker::Integrate
virtual int Integrate(vtkInitialValueProblemSolver *integrator, vtkLagrangianParticle *, std::queue< vtkLagrangianParticle * > &, vtkPolyData *particlePathsOutput, vtkPolyLine *particlePath, vtkDataObject *interactionOutput)
This method is thread safe.
vtkLagrangianParticleTracker::ParticleCounter
std::atomic< vtkIdType > ParticleCounter
Definition: vtkLagrangianParticleTracker.h:380
vtkLagrangianParticleTracker::InitializeFlow
virtual bool InitializeFlow(vtkDataObject *flow, vtkBoundingBox *bounds)
vtkLagrangianParticleTracker::MaximumNumberOfSteps
int MaximumNumberOfSteps
Definition: vtkLagrangianParticleTracker.h:375
vtkLagrangianParticleTracker::FlowTime
vtkMTimeType FlowTime
Definition: vtkLagrangianParticleTracker.h:391
vtkLagrangianParticleTracker::FlowCache
vtkDataObject * FlowCache
Definition: vtkLagrangianParticleTracker.h:390
vtkLagrangianParticleTracker::FillOutputPortInformation
int FillOutputPortInformation(int port, vtkInformation *info) override
Declare output port type.
vtkLagrangianParticleTracker::AdaptiveStepReintegration
bool AdaptiveStepReintegration
Definition: vtkLagrangianParticleTracker.h:377
vtkLagrangianParticleTracker::RequestDataObject
int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Create outputs objects.
vtkLagrangianParticleTracker::InitializePathsOutput
virtual bool InitializePathsOutput(vtkPointData *seedData, vtkIdType numberOfSeeds, vtkPolyData *&particlePathsOutput)
This method is thread safe.
vtkLagrangianParticleTracker::InitializeInteractionOutput
virtual bool InitializeInteractionOutput(vtkPointData *seedData, vtkDataObject *surfaces, vtkDataObject *&interractionOutput)
This method is thread safe.
vtkLagrangianParticleTracker::GetSource
vtkDataObject * GetSource()
Specify the source object used to generate particle initial position (seeds).
vtkLagrangianParticleTracker::MinimumReductionFactor
double MinimumReductionFactor
Definition: vtkLagrangianParticleTracker.h:387
vtkLagrangianParticleTracker::SetSourceData
void SetSourceData(vtkDataObject *source)
Specify the source object used to generate particle initial position (seeds).
vtkLagrangianParticleTracker::InsertInteractionOutputPoint
void InsertInteractionOutputPoint(vtkLagrangianParticle *particle, unsigned int interactedSurfaceFlatIndex, vtkDataObject *interactionOutput)
This method is thread safe.
vtkLagrangianParticleTracker::CellLengthComputationMode
int CellLengthComputationMode
Definition: vtkLagrangianParticleTracker.h:371
vtkLagrangianParticleTracker::FinalizeOutputs
virtual bool FinalizeOutputs(vtkPolyData *particlePathsOutput, vtkDataObject *interactionOutput)
vtkLagrangianParticleTracker::~vtkLagrangianParticleTracker
~vtkLagrangianParticleTracker() override
vtkLagrangianParticleTracker::IntegrationModel
vtkSmartPointer< vtkLagrangianBasicIntegrationModel > IntegrationModel
Definition: vtkLagrangianParticleTracker.h:368
vtkLagrangianParticle
Basis class for Lagrangian particles.
Definition: vtkLagrangianParticle.h:39
vtkMultiBlockDataSet
Composite dataset that organizes datasets into blocks.
Definition: vtkMultiBlockDataSet.h:50
vtkMultiPieceDataSet
composite dataset to encapsulates pieces of dataset.
Definition: vtkMultiPieceDataSet.h:33
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:39
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:38
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:89
vtkPolyLine
cell represents a set of 1D lines
Definition: vtkPolyLine.h:39
vtkSmartPointer< vtkLagrangianBasicIntegrationModel >
vtkX3D::info
@ info
Definition: vtkX3D.h:376
vtkX3D::port
@ port
Definition: vtkX3D.h:447
vtkLagrangianThreadedData
struct to hold a user data
Definition: vtkLagrangianThreadedData.h:25
source
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:964
vtkBoundingBox.h
vtkDataObjectAlgorithm.h
vtkSmartPointer.h
vtkIdType
int vtkIdType
Definition: vtkType.h:315
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270