VTK
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 =========================================================================*/
87 #ifndef vtkLagrangianParticleTracker_h
88 #define vtkLagrangianParticleTracker_h
89 
90 #include "vtkFiltersFlowPathsModule.h" // For export macro
91 #include "vtkDataObjectAlgorithm.h"
92 #include "vtkBoundingBox.h" // For cached bounds
93 
94 #include <queue> // for particle queue
95 
96 class vtkBoundingBox;
97 class vtkCellArray;
98 class vtkDataSet;
99 class vtkDoubleArray;
100 class vtkIdList;
101 class vtkInformation;
105 class vtkPointData;
106 class vtkPoints;
107 class vtkPolyData;
108 
109 class VTKFILTERSFLOWPATHS_EXPORT vtkLagrangianParticleTracker :
111 {
112 public:
113 
115  void PrintSelf(ostream& os, vtkIndent indent) override;
117 
118  typedef enum CellLengthComputation{
119  STEP_LAST_CELL_LENGTH = 0,
120  STEP_CUR_CELL_LENGTH = 1,
121  STEP_LAST_CELL_VEL_DIR = 2,
122  STEP_CUR_CELL_VEL_DIR = 3,
123  STEP_LAST_CELL_DIV_THEO = 4,
124  STEP_CUR_CELL_DIV_THEO = 5
125  } CellLengthComputation;
126 
128 
132  void SetIntegrationModel(vtkLagrangianBasicIntegrationModel* integrationModel);
133  vtkGetObjectMacro(IntegrationModel, vtkLagrangianBasicIntegrationModel);
135 
137 
141  void SetIntegrator(vtkInitialValueProblemSolver* integrator);
142  vtkGetObjectMacro(Integrator, vtkInitialValueProblemSolver);
144 
146 
151  vtkSetMacro(GeneratePolyVertexInteractionOutput, bool);
152  vtkGetMacro(GeneratePolyVertexInteractionOutput, bool);
154 
156 
181  vtkSetMacro(CellLengthComputationMode, int);
182  vtkGetMacro(CellLengthComputationMode, int);
184 
186 
189  vtkSetMacro(StepFactor, double);
190  vtkGetMacro(StepFactor, double);
192 
194 
197  vtkSetMacro(StepFactorMin, double);
198  vtkGetMacro(StepFactorMin, double);
200 
202 
205  vtkSetMacro(StepFactorMax, double);
206  vtkGetMacro(StepFactorMax, double);
208 
210 
213  vtkSetMacro(MaximumNumberOfSteps, int);
214  vtkGetMacro(MaximumNumberOfSteps, int);
216 
218 
222  vtkSetMacro(MaximumIntegrationTime, double);
223  vtkGetMacro(MaximumIntegrationTime, double);
225 
227 
233  vtkSetMacro(AdaptiveStepReintegration, bool);
234  vtkGetMacro(AdaptiveStepReintegration, bool);
235  vtkBooleanMacro(AdaptiveStepReintegration, bool);
237 
239 
245  vtkSetMacro(UseParticlePathsRenderingThreshold, bool);
246  vtkGetMacro(UseParticlePathsRenderingThreshold, bool);
247  vtkBooleanMacro(UseParticlePathsRenderingThreshold, bool);
249 
251 
257  vtkSetMacro(ParticlePathsRenderingPointsThreshold, int);
258  vtkGetMacro(ParticlePathsRenderingPointsThreshold, int);
260 
262 
268  void SetSourceData(vtkDataObject* source);
269  vtkDataObject* GetSource();
271 
275  void SetSourceConnection(vtkAlgorithmOutput* algOutput);
276 
278 
284  void SetSurfaceData(vtkDataObject *source);
285  vtkDataObject *GetSurface();
287 
291  void SetSurfaceConnection(vtkAlgorithmOutput* algOutput);
292 
296  int FillInputPortInformation(int port, vtkInformation* info) override;
297 
302 
308  vtkInformationVector*) override;
309 
313  int RequestData(vtkInformation *request,
314  vtkInformationVector **inputVector,
315  vtkInformationVector *outputVector) override;
316 
321  vtkMTimeType GetMTime() override;
322 
326  virtual vtkIdType GetNewParticleId();
327 
328 protected:
330  ~vtkLagrangianParticleTracker() override;
331 
332  virtual bool InitializeInputs(vtkInformationVector **inputVector,
333  vtkDataObject*& flow, vtkDataObject*& seeds, vtkDataObject*& surfaces,
334  std::queue<vtkLagrangianParticle*>& particleQueue, vtkPointData* seedData);
335  virtual bool InitializeFlow(vtkDataObject* flow, vtkBoundingBox* bounds);
336  virtual bool InitializeParticles(const vtkBoundingBox* bounds, vtkDataObject* seeds,
337  std::queue<vtkLagrangianParticle*>& particles, vtkPointData* seedData);
338  virtual void GenerateParticles(const vtkBoundingBox* bounds, vtkDataSet* seeds,
339  vtkDataArray* initialVelocities, vtkDataArray* initialIntegrationTimes,
340  vtkPointData* seedData, int nVar, std::queue<vtkLagrangianParticle*>& particles);
341  virtual bool UpdateSurfaceCacheIfNeeded(vtkDataObject*& surfaces);
342  virtual void InitializeSurface(vtkDataObject*& surfaces);
343  virtual bool InitializeOutputs(vtkInformationVector *outputVector, vtkPointData* seedData,
344  vtkIdType numberOfSeeds, vtkDataObject* surfaces,
345  vtkPolyData*& particlePathsOutput, vtkDataObject*& interactionOutput);
346 
347  virtual bool InitializePathsOutput(vtkInformationVector *outputVector,
348  vtkPointData* seedData, vtkIdType numberOfSeeds,
349  vtkPolyData*& particlePathsOutput);
350 
351  virtual bool InitializeInteractionOutput(vtkInformationVector *outputVector,
352  vtkPointData* seedData, vtkDataObject* surfaces, vtkDataObject*& interractionOutput);
353 
354  virtual void InitializeParticleData(vtkFieldData* particleData, int maxTuples = 0);
355  virtual void InitializePathData(vtkFieldData* data);
356  virtual void InitializeInteractionData(vtkFieldData* data);
357 
358  virtual bool FinalizeOutputs(vtkPolyData* particlePathsOutput,
359  vtkDataObject* interractionOutput);
360 
361  static void InsertPolyVertexCell(vtkPolyData* polydata);
362  static void InsertVertexCells(vtkPolyData* polydata);
363 
364  virtual void GetParticleFeed(std::queue<vtkLagrangianParticle*>& particleQueue);
365 
366  virtual int Integrate(vtkLagrangianParticle*, std::queue<vtkLagrangianParticle*>&,
367  vtkPolyData* particlePathsOutput, vtkIdList* particlePathPointId,
368  vtkDataObject* interactionOutput);
369 
370  void InsertPathOutputPoint(vtkLagrangianParticle* particle,
371  vtkPolyData* particlePathsOutput, vtkIdList* particlePathPointId,
372  bool prev = false);
373 
374  void InsertInteractionOutputPoint(vtkLagrangianParticle* particle,
375  unsigned int interactedSurfaceFlatIndex, vtkDataObject* interactionOutput);
376 
377  void InsertSeedData(vtkLagrangianParticle* particle, vtkFieldData* data);
378  void InsertPathData(vtkLagrangianParticle* particle, vtkFieldData* data);
379  void InsertInteractionData(vtkLagrangianParticle* particle, vtkFieldData* data);
380  void InsertParticleData(vtkLagrangianParticle* particle, vtkFieldData* data, int stepEnum);
381 
382  double ComputeCellLength(vtkLagrangianParticle* particle);
383 
384  bool ComputeNextStep(
385  double* xprev, double* xnext,
386  double t, double& delT, double& delTActual,
387  double minStep, double maxStep,
388  int& integrationRes);
389 
390  virtual bool CheckParticlePathsRenderingThreshold(vtkPolyData* particlePathsOutput);
391 
394 
396  double StepFactor;
406 
407  // internal parameters use for step computation
410 
411  // Cache related parameters
417 
418 private:
420  void operator=(const vtkLagrangianParticleTracker&) = delete;
421 };
422 
423 #endif
virtual int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
represent and manipulate point attribute data
Definition: vtkPointData.h:31
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
static vtkDataObjectAlgorithm * New()
vtkInitialValueProblemSolver * Integrator
int vtkIdType
Definition: vtkType.h:347
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
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.
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkFunctionSet abstract implementation to be used in the vtkLagrangianParticleTracker integrator.
list of point or cell ids
Definition: vtkIdList.h:30
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
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:44
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
vtkLagrangianBasicIntegrationModel * IntegrationModel
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:58
Filter to inject and track particles in a flow.
represent and manipulate 3D points
Definition: vtkPoints.h:33
Fast Simple Class for dealing with 3D bounds.
represent and manipulate fields of data
Definition: vtkFieldData.h:53
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.