VTK  9.0.20200712
vtkLagrangianParticleTracker.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkLagrangianParticleTracker.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 =========================================================================*/
88 #ifndef vtkLagrangianParticleTracker_h
89 #define vtkLagrangianParticleTracker_h
90 
91 #include "vtkBoundingBox.h" // For cached bounds
92 #include "vtkDataObjectAlgorithm.h"
93 #include "vtkFiltersFlowPathsModule.h" // For export macro
94 
95 #include <atomic> // for atomic
96 #include <mutex> // for mutexes
97 #include <queue> // for particle queue
98 
99 class vtkBoundingBox;
100 class vtkCellArray;
101 class vtkDataSet;
102 class vtkDoubleArray;
103 class vtkIdList;
104 class vtkInformation;
110 class vtkPointData;
111 class vtkPoints;
112 class vtkPolyData;
113 class vtkPolyLine;
114 struct IntegratingFunctor;
116 
117 class VTKFILTERSFLOWPATHS_EXPORT vtkLagrangianParticleTracker : public vtkDataObjectAlgorithm
118 {
119 public:
121  void PrintSelf(ostream& os, vtkIndent indent) override;
123 
125  {
126  STEP_CUR_CELL_LENGTH = 1,
127  STEP_CUR_CELL_VEL_DIR = 3,
128  STEP_CUR_CELL_DIV_THEO = 5
129  } CellLengthComputation;
130 
132 
136  void SetIntegrationModel(vtkLagrangianBasicIntegrationModel* integrationModel);
137  vtkGetObjectMacro(IntegrationModel, vtkLagrangianBasicIntegrationModel);
139 
141 
145  void SetIntegrator(vtkInitialValueProblemSolver* integrator);
146  vtkGetObjectMacro(Integrator, vtkInitialValueProblemSolver);
148 
150 
155  vtkSetMacro(GeneratePolyVertexInteractionOutput, bool);
156  vtkGetMacro(GeneratePolyVertexInteractionOutput, bool);
158 
160 
173  vtkSetMacro(CellLengthComputationMode, int);
174  vtkGetMacro(CellLengthComputationMode, int);
176 
178 
181  vtkSetMacro(StepFactor, double);
182  vtkGetMacro(StepFactor, double);
184 
186 
189  vtkSetMacro(StepFactorMin, double);
190  vtkGetMacro(StepFactorMin, double);
192 
194 
197  vtkSetMacro(StepFactorMax, double);
198  vtkGetMacro(StepFactorMax, double);
200 
202 
205  vtkSetMacro(MaximumNumberOfSteps, int);
206  vtkGetMacro(MaximumNumberOfSteps, int);
208 
210 
214  vtkSetMacro(MaximumIntegrationTime, double);
215  vtkGetMacro(MaximumIntegrationTime, double);
217 
219 
225  vtkSetMacro(AdaptiveStepReintegration, bool);
226  vtkGetMacro(AdaptiveStepReintegration, bool);
227  vtkBooleanMacro(AdaptiveStepReintegration, bool);
229 
231 
235  vtkSetMacro(GenerateParticlePathsOutput, bool);
236  vtkGetMacro(GenerateParticlePathsOutput, bool);
237  vtkBooleanMacro(GenerateParticlePathsOutput, bool);
239 
241 
247  void SetSourceData(vtkDataObject* source);
248  vtkDataObject* GetSource();
250 
254  void SetSourceConnection(vtkAlgorithmOutput* algOutput);
255 
257 
263  void SetSurfaceData(vtkDataObject* source);
264  vtkDataObject* GetSurface();
266 
270  void SetSurfaceConnection(vtkAlgorithmOutput* algOutput);
271 
275  int FillInputPortInformation(int port, vtkInformation* info) override;
276 
281 
286 
290  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
291  vtkInformationVector* outputVector) override;
292 
297  vtkMTimeType GetMTime() override;
298 
303  virtual vtkIdType GetNewParticleId();
304 
305 protected:
307  ~vtkLagrangianParticleTracker() override;
308 
309  virtual bool InitializeFlow(vtkDataObject* flow, vtkBoundingBox* bounds);
310  virtual bool InitializeParticles(const vtkBoundingBox* bounds, vtkDataSet* seeds,
311  std::queue<vtkLagrangianParticle*>& particles, vtkPointData* seedData);
312  virtual void GenerateParticles(const vtkBoundingBox* bounds, vtkDataSet* seeds,
313  vtkDataArray* initialVelocities, vtkDataArray* initialIntegrationTimes, vtkPointData* seedData,
314  int nVar, std::queue<vtkLagrangianParticle*>& particles);
315  virtual bool UpdateSurfaceCacheIfNeeded(vtkDataObject*& surfaces);
316  virtual void InitializeSurface(vtkDataObject*& surfaces);
317 
321  virtual bool InitializePathsOutput(
322  vtkPointData* seedData, vtkIdType numberOfSeeds, vtkPolyData*& particlePathsOutput);
323 
327  virtual bool InitializeInteractionOutput(
328  vtkPointData* seedData, vtkDataObject* surfaces, vtkDataObject*& interractionOutput);
329 
330  virtual bool FinalizeOutputs(vtkPolyData* particlePathsOutput, vtkDataObject* interactionOutput);
331 
332  static void InsertPolyVertexCell(vtkPolyData* polydata);
333  static void InsertVertexCells(vtkPolyData* polydata);
334 
335  virtual void GetParticleFeed(std::queue<vtkLagrangianParticle*>& particleQueue);
336 
340  virtual int Integrate(vtkInitialValueProblemSolver* integrator, vtkLagrangianParticle*,
341  std::queue<vtkLagrangianParticle*>&, vtkPolyData* particlePathsOutput,
342  vtkPolyLine* particlePath, vtkDataObject* interactionOutput);
343 
347  void InsertPathOutputPoint(vtkLagrangianParticle* particle, vtkPolyData* particlePathsOutput,
348  vtkIdList* particlePathPointId, bool prev = false);
349 
353  void InsertInteractionOutputPoint(vtkLagrangianParticle* particle,
354  unsigned int interactedSurfaceFlatIndex, vtkDataObject* interactionOutput);
355 
360  double ComputeCellLength(vtkLagrangianParticle* particle);
361 
365  bool ComputeNextStep(vtkInitialValueProblemSolver* integrator, double* xprev, double* xnext,
366  double t, double& delT, double& delTActual, double minStep, double maxStep, double cellLength,
367  int& integrationRes, vtkLagrangianParticle* particle);
368 
373  virtual void DeleteParticle(vtkLagrangianParticle* particle);
374 
377 
379  double StepFactor;
385  bool GenerateParticlePathsOutput = true;
387  std::atomic<vtkIdType> ParticleCounter;
388  std::atomic<vtkIdType> IntegratedParticleCounter;
391 
392  // internal parameters use for step computation
395 
396  // Cache related parameters
402 
403  std::mutex ProgressMutex;
404  friend struct IntegratingFunctor;
405 
407 
408 private:
410  void operator=(const vtkLagrangianParticleTracker&) = delete;
411 };
412 
413 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:33
vtkLagrangianParticleTracker::SerialThreadedData
vtkLagrangianThreadedData * SerialThreadedData
Definition: vtkLagrangianParticleTracker.h:406
vtkLagrangianParticleTracker
Filter to inject and track particles in a flow.
Definition: vtkLagrangianParticleTracker.h:117
vtkLagrangianBasicIntegrationModel
vtkFunctionSet abstract implementation to be used in the vtkLagrangianParticleTracker integrator.
Definition: vtkLagrangianBasicIntegrationModel.h:90
vtkLagrangianParticleTracker::MaximumIntegrationTime
double MaximumIntegrationTime
Definition: vtkLagrangianParticleTracker.h:383
vtkMultiPieceDataSet
composite dataset to encapsulates pieces of dataset.
Definition: vtkMultiPieceDataSet.h:40
vtkLagrangianParticleTracker::ParticleCounter
std::atomic< vtkIdType > ParticleCounter
Definition: vtkLagrangianParticleTracker.h:387
vtkDataObjectAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkLagrangianParticleTracker::IntegrationModel
vtkLagrangianBasicIntegrationModel * IntegrationModel
Definition: vtkLagrangianParticleTracker.h:375
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:32
vtkLagrangianParticleTracker::StepFactorMax
double StepFactorMax
Definition: vtkLagrangianParticleTracker.h:381
vtkIdType
int vtkIdType
Definition: vtkType.h:330
vtkLagrangianParticleTracker::SeedData
vtkPointData * SeedData
Definition: vtkLagrangianParticleTracker.h:390
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkLagrangianParticleTracker::GeneratePolyVertexInteractionOutput
bool GeneratePolyVertexInteractionOutput
Definition: vtkLagrangianParticleTracker.h:386
vtkDataObjectAlgorithm
Superclass for algorithms that produce only data object as output.
Definition: vtkDataObjectAlgorithm.h:43
vtkLagrangianParticleTracker::ProgressMutex
std::mutex ProgressMutex
Definition: vtkLagrangianParticleTracker.h:403
vtkLagrangianParticleTracker::MaximumNumberOfSteps
int MaximumNumberOfSteps
Definition: vtkLagrangianParticleTracker.h:382
vtkLagrangianParticleTracker::StepFactorMin
double StepFactorMin
Definition: vtkLagrangianParticleTracker.h:380
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
vtkDataObjectAlgorithm::FillOutputPortInformation
int FillOutputPortInformation(int port, vtkInformation *info) override
Fill the output port information objects for this algorithm.
vtkLagrangianParticleTracker::MinimumVelocityMagnitude
double MinimumVelocityMagnitude
Definition: vtkLagrangianParticleTracker.h:393
vtkLagrangianParticleTracker::FlowTime
vtkMTimeType FlowTime
Definition: vtkLagrangianParticleTracker.h:398
vtkLagrangianParticleTracker::StepFactor
double StepFactor
Definition: vtkLagrangianParticleTracker.h:379
vtkMultiBlockDataSet
Composite dataset that organizes datasets into blocks.
Definition: vtkMultiBlockDataSet.h:45
vtkLagrangianParticleTracker::IntegratedParticleCounterIncrement
vtkIdType IntegratedParticleCounterIncrement
Definition: vtkLagrangianParticleTracker.h:389
vtkLagrangianParticleTracker::CellLengthComputation
CellLengthComputation
Definition: vtkLagrangianParticleTracker.h:124
vtkBoundingBox
Fast, simple class for representing and operating on 3D bounds.
Definition: vtkBoundingBox.h:35
vtkX3D::port
Definition: vtkX3D.h:453
vtkPolyLine
cell represents a set of 1D lines
Definition: vtkPolyLine.h:36
vtkObject::GetMTime
virtual vtkMTimeType GetMTime()
Return this object's modified time.
vtkLagrangianParticleTracker::CellLengthComputationMode
int CellLengthComputationMode
Definition: vtkLagrangianParticleTracker.h:378
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:180
vtkLagrangianThreadedData
struct to hold a user data
Definition: vtkLagrangianThreadedData.h:35
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:30
vtkLagrangianParticleTracker::SurfacesCache
vtkDataObject * SurfacesCache
Definition: vtkLagrangianParticleTracker.h:400
vtkLagrangianParticleTracker::SurfacesTime
vtkMTimeType SurfacesTime
Definition: vtkLagrangianParticleTracker.h:401
vtkBoundingBox.h
vtkLagrangianParticle
Basis class for Lagrangian particles.
Definition: vtkLagrangianParticle.h:46
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
vtkLagrangianParticleTracker::AdaptiveStepReintegration
bool AdaptiveStepReintegration
Definition: vtkLagrangianParticleTracker.h:384
vtkX3D::info
Definition: vtkX3D.h:382
vtkLagrangianParticleTracker::FlowCache
vtkDataObject * FlowCache
Definition: vtkLagrangianParticleTracker.h:397
vtkAlgorithmOutput
Proxy object to connect input/output ports.
Definition: vtkAlgorithmOutput.h:36
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkDataObjectAlgorithm::New
static vtkDataObjectAlgorithm * New()
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:35
vtkDataObjectAlgorithm::RequestData
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Definition: vtkDataObjectAlgorithm.h:116
source
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:959
vtkDataObjectAlgorithm.h
vtkDataObjectAlgorithm::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkInitialValueProblemSolver
Integrate a set of ordinary differential equations (initial value problem) in time.
Definition: vtkInitialValueProblemSolver.h:40
vtkLagrangianParticleTracker::IntegratedParticleCounter
std::atomic< vtkIdType > IntegratedParticleCounter
Definition: vtkLagrangianParticleTracker.h:388
vtkDataObjectAlgorithm::RequestDataObject
virtual int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Definition: vtkDataObjectAlgorithm.h:102
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:59
vtkLagrangianParticleTracker::Integrator
vtkInitialValueProblemSolver * Integrator
Definition: vtkLagrangianParticleTracker.h:376
vtkLagrangianParticleTracker::FlowBoundsCache
vtkBoundingBox FlowBoundsCache
Definition: vtkLagrangianParticleTracker.h:399
vtkLagrangianParticleTracker::MinimumReductionFactor
double MinimumReductionFactor
Definition: vtkLagrangianParticleTracker.h:394
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:285