VTK  9.2.6
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 =========================================================================*/
91 #ifndef vtkLagrangianParticleTracker_h
92 #define vtkLagrangianParticleTracker_h
93 
94 #include "vtkBoundingBox.h" // For cached bounds
95 #include "vtkDataObjectAlgorithm.h"
96 #include "vtkFiltersFlowPathsModule.h" // For export macro
97 
98 #include <atomic> // for atomic
99 #include <mutex> // for mutexes
100 #include <queue> // for particle queue
101 
102 class vtkBoundingBox;
103 class vtkCellArray;
104 class vtkDataSet;
105 class vtkDoubleArray;
106 class vtkIdList;
107 class vtkInformation;
113 class vtkPointData;
114 class vtkPoints;
115 class vtkPolyData;
116 class vtkPolyLine;
117 struct IntegratingFunctor;
119 
120 class VTKFILTERSFLOWPATHS_EXPORT vtkLagrangianParticleTracker : public vtkDataObjectAlgorithm
121 {
122 public:
124  void PrintSelf(ostream& os, vtkIndent indent) override;
126 
128  {
129  STEP_CUR_CELL_LENGTH = 1,
130  STEP_CUR_CELL_VEL_DIR = 3,
131  STEP_CUR_CELL_DIV_THEO = 5
132  } CellLengthComputation;
133 
135 
139  void SetIntegrationModel(vtkLagrangianBasicIntegrationModel* integrationModel);
140  vtkGetObjectMacro(IntegrationModel, vtkLagrangianBasicIntegrationModel);
142 
144 
148  void SetIntegrator(vtkInitialValueProblemSolver* integrator);
149  vtkGetObjectMacro(Integrator, vtkInitialValueProblemSolver);
151 
153 
158  vtkSetMacro(GeneratePolyVertexInteractionOutput, bool);
159  vtkGetMacro(GeneratePolyVertexInteractionOutput, bool);
161 
163 
176  vtkSetMacro(CellLengthComputationMode, int);
177  vtkGetMacro(CellLengthComputationMode, int);
179 
181 
184  vtkSetMacro(StepFactor, double);
185  vtkGetMacro(StepFactor, double);
187 
189 
192  vtkSetMacro(StepFactorMin, double);
193  vtkGetMacro(StepFactorMin, double);
195 
197 
200  vtkSetMacro(StepFactorMax, double);
201  vtkGetMacro(StepFactorMax, double);
203 
205 
208  vtkSetMacro(MaximumNumberOfSteps, int);
209  vtkGetMacro(MaximumNumberOfSteps, int);
211 
213 
217  vtkSetMacro(MaximumIntegrationTime, double);
218  vtkGetMacro(MaximumIntegrationTime, double);
220 
222 
228  vtkSetMacro(AdaptiveStepReintegration, bool);
229  vtkGetMacro(AdaptiveStepReintegration, bool);
230  vtkBooleanMacro(AdaptiveStepReintegration, bool);
232 
234 
238  vtkSetMacro(GenerateParticlePathsOutput, bool);
239  vtkGetMacro(GenerateParticlePathsOutput, bool);
240  vtkBooleanMacro(GenerateParticlePathsOutput, bool);
242 
244 
250  void SetSourceData(vtkDataObject* source);
251  vtkDataObject* GetSource();
253 
257  void SetSourceConnection(vtkAlgorithmOutput* algOutput);
258 
260 
266  void SetSurfaceData(vtkDataObject* source);
267  vtkDataObject* GetSurface();
269 
273  void SetSurfaceConnection(vtkAlgorithmOutput* algOutput);
274 
278  int FillInputPortInformation(int port, vtkInformation* info) override;
279 
284 
289 
293  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
294  vtkInformationVector* outputVector) override;
295 
300  vtkMTimeType GetMTime() override;
301 
306  virtual vtkIdType GetNewParticleId();
307 
308 protected:
310  ~vtkLagrangianParticleTracker() override;
311 
312  virtual bool InitializeFlow(vtkDataObject* flow, vtkBoundingBox* bounds);
313  virtual bool InitializeParticles(const vtkBoundingBox* bounds, vtkDataSet* seeds,
314  std::queue<vtkLagrangianParticle*>& particles, vtkPointData* seedData);
315  virtual void GenerateParticles(const vtkBoundingBox* bounds, vtkDataSet* seeds,
316  vtkDataArray* initialVelocities, vtkDataArray* initialIntegrationTimes, vtkPointData* seedData,
317  int nVar, std::queue<vtkLagrangianParticle*>& particles);
318  virtual bool UpdateSurfaceCacheIfNeeded(vtkDataObject*& surfaces);
319  virtual void InitializeSurface(vtkDataObject*& surfaces);
320 
324  virtual bool InitializePathsOutput(
325  vtkPointData* seedData, vtkIdType numberOfSeeds, vtkPolyData*& particlePathsOutput);
326 
330  virtual bool InitializeInteractionOutput(
331  vtkPointData* seedData, vtkDataObject* surfaces, vtkDataObject*& interractionOutput);
332 
333  virtual bool FinalizeOutputs(vtkPolyData* particlePathsOutput, vtkDataObject* interactionOutput);
334 
335  static void InsertPolyVertexCell(vtkPolyData* polydata);
336  static void InsertVertexCells(vtkPolyData* polydata);
337 
338  virtual void GetParticleFeed(std::queue<vtkLagrangianParticle*>& particleQueue);
339 
343  virtual int Integrate(vtkInitialValueProblemSolver* integrator, vtkLagrangianParticle*,
344  std::queue<vtkLagrangianParticle*>&, vtkPolyData* particlePathsOutput,
345  vtkPolyLine* particlePath, vtkDataObject* interactionOutput);
346 
350  void InsertPathOutputPoint(vtkLagrangianParticle* particle, vtkPolyData* particlePathsOutput,
351  vtkIdList* particlePathPointId, bool prev = false);
352 
356  void InsertInteractionOutputPoint(vtkLagrangianParticle* particle,
357  unsigned int interactedSurfaceFlatIndex, vtkDataObject* interactionOutput);
358 
363  double ComputeCellLength(vtkLagrangianParticle* particle);
364 
368  bool ComputeNextStep(vtkInitialValueProblemSolver* integrator, double* xprev, double* xnext,
369  double t, double& delT, double& delTActual, double minStep, double maxStep, double cellLength,
370  int& integrationRes, vtkLagrangianParticle* particle);
371 
376  virtual void DeleteParticle(vtkLagrangianParticle* particle);
377 
380 
382  double StepFactor;
388  bool GenerateParticlePathsOutput = true;
390  std::atomic<vtkIdType> ParticleCounter;
391  std::atomic<vtkIdType> IntegratedParticleCounter;
394 
395  // internal parameters use for step computation
398 
399  // Cache related parameters
403  bool FlowCacheInvalid = true;
406  bool SurfaceCacheInvalid = true;
407 
408  std::mutex ProgressMutex;
409  friend struct IntegratingFunctor;
410 
412 
413 private:
415  void operator=(const vtkLagrangianParticleTracker&) = delete;
416 };
417 
418 #endif
virtual int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
represent and manipulate point attribute data
Definition: vtkPointData.h:41
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
static vtkDataObjectAlgorithm * New()
vtkInitialValueProblemSolver * Integrator
struct to hold a user data
int vtkIdType
Definition: vtkType.h:332
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:90
vtkLagrangianThreadedData * SerialThreadedData
Proxy object to connect input/output ports.
dynamic, self-adjusting array of double
int FillOutputPortInformation(int port, vtkInformation *info) override
Fill the output port information objects for this algorithm.
std::atomic< vtkIdType > IntegratedParticleCounter
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkFunctionSet abstract implementation to be used in the vtkLagrangianParticleTracker integrator...
list of point or cell ids
Definition: vtkIdList.h:33
composite dataset to encapsulates pieces of dataset.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
virtual vtkMTimeType GetMTime()
Return this object's modified time.
Basis class for Lagrangian particles.
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Superclass for algorithms that produce only data object as output.
object to represent cell connectivity
Definition: vtkCellArray.h:186
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
vtkLagrangianBasicIntegrationModel * IntegrationModel
Composite dataset that organizes datasets into blocks.
Store zero or more vtkInformation instances.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
general representation of visualization data
Definition: vtkDataObject.h:65
Filter to inject and track particles in a flow.
represent and manipulate 3D points
Definition: vtkPoints.h:39
cell represents a set of 1D lines
Definition: vtkPolyLine.h:39
Fast, simple class for representing and operating on 3D bounds.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Integrate a set of ordinary differential equations (initial value problem) in time.