VTK  9.0.1
vtkLagrangianParticle.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkLagrangianParticle.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 =========================================================================*/
29 #ifndef vtkLagrangianParticle_h
30 #define vtkLagrangianParticle_h
31 
32 #include "vtkFiltersFlowPathsModule.h" // For export macro
33 #include "vtkNew.h" // For vtkNew
34 #include "vtkSystemIncludes.h" // For PrintSelf signature and vtkType
35 
36 #include <vector>
37 
40 class vtkDataSet;
41 class vtkGenericCell;
42 class vtkIdList;
43 class vtkPointData;
45 
46 class VTKFILTERSFLOWPATHS_EXPORT vtkLagrangianParticle
47 {
48 public:
65  typedef enum ParticleTermination
66  {
67  PARTICLE_TERMINATION_NOT_TERMINATED = 0,
73  PARTICLE_TERMINATION_OUT_OF_TIME
74  } ParticleTermination;
75 
87  typedef enum SurfaceInteraction
88  {
89  SURFACE_INTERACTION_NO_INTERACTION = 0,
94  SURFACE_INTERACTION_OTHER
95  } SurfaceInteraction;
96 
106  vtkLagrangianParticle(int numberOfVariables, vtkIdType seedId, vtkIdType particleId,
107  vtkIdType seedArrayTupleIndex, double integrationTime, vtkPointData* seedData, int weightsSize,
108  int numberOfTrackedUserData);
109 
114  static vtkLagrangianParticle* NewInstance(int numberOfVariables, vtkIdType seedId,
115  vtkIdType particleId, vtkIdType seedArrayTupleIndex, double integrationTime,
116  vtkPointData* seedData, int weightsSize, int numberOfTrackedUserData,
117  vtkIdType numberOfSteps = 0, double previousIntegrationTime = 0);
118 
126 
131 
136 
138 
142  inline double* GetPrevEquationVariables() { return this->PrevEquationVariables.data(); }
144 
146 
158  inline double* GetEquationVariables() { return this->EquationVariables.data(); }
160 
162 
167  inline double* GetNextEquationVariables() { return this->NextEquationVariables.data(); }
169 
171 
176  inline double* GetPrevPosition() { return this->PrevEquationVariables.data(); }
178 
180 
185  inline double* GetPosition() { return this->EquationVariables.data(); }
187 
189 
194  inline double* GetNextPosition() { return this->NextEquationVariables.data(); }
196 
198 
203  inline double* GetPrevVelocity() { return this->PrevVelocity; }
205 
207 
212  inline double* GetVelocity() { return this->Velocity; }
214 
216 
221  inline double* GetNextVelocity() { return this->NextVelocity; }
223 
225 
230  inline double* GetPrevUserVariables() { return this->PrevUserVariables; }
232 
234 
239  inline double* GetUserVariables() { return this->UserVariables; }
241 
243 
248  inline double* GetNextUserVariables() { return this->NextUserVariables; }
250 
252 
256  inline std::vector<double>& GetPrevTrackedUserData() { return this->PrevTrackedUserData; }
258 
260 
270  inline std::vector<double>& GetTrackedUserData() { return this->TrackedUserData; }
272 
274 
278  inline std::vector<double>& GetNextTrackedUserData() { return this->NextTrackedUserData; }
280 
282 
289  inline vtkLagrangianThreadedData* GetThreadedData() { return this->ThreadedData; }
290  inline void SetThreadedData(vtkLagrangianThreadedData* threadedData)
291  {
292  this->ThreadedData = threadedData;
293  }
295 
302  virtual void MoveToNextPosition();
303 
307  virtual vtkIdType GetId();
308 
310 
314  virtual void SetParentId(vtkIdType parentId);
317 
322  virtual vtkIdType GetSeedId();
323 
327  virtual int GetNumberOfVariables();
328 
333 
338 
344 
349  double* GetLastWeights();
350 
355 
360 
365 
370 
375 
380 
384  void SetLastCell(vtkAbstractCellLocator* locator, vtkDataSet* dataset, vtkIdType cellId,
385  double lastCellPosition[3]);
386 
390  void SetLastSurfaceCell(vtkDataSet* dataset, vtkIdType cellId);
391 
396 
398 
403  virtual void SetTermination(int termination);
404  virtual int GetTermination();
406 
408 
413  virtual void SetInteraction(int interaction);
414  virtual int GetInteraction();
416 
418 
421  virtual void SetUserFlag(int flag);
422  virtual int GetUserFlag();
424 
426 
431  virtual void SetPInsertPreviousPosition(bool val);
434 
436 
441  virtual void SetPManualShift(bool val);
442  virtual bool GetPManualShift();
444 
448  virtual double& GetStepTimeRef();
449 
453  virtual double GetIntegrationTime();
454 
458  virtual double GetPrevIntegrationTime();
459 
468  virtual void SetIntegrationTime(double time);
469 
474 
478  virtual void PrintSelf(ostream& os, vtkIndent indent);
479 
480 protected:
483  void operator=(const vtkLagrangianParticle&) = delete;
484 
485  std::vector<double> PrevEquationVariables;
486  double* PrevVelocity;
488 
489  std::vector<double> EquationVariables;
490  double* Velocity;
491  double* UserVariables;
492 
493  std::vector<double> NextEquationVariables;
494  double* NextVelocity;
496 
497  std::vector<double> PrevTrackedUserData;
498  std::vector<double> TrackedUserData;
499  std::vector<double> NextTrackedUserData;
500 
501  vtkLagrangianThreadedData* ThreadedData = nullptr;
502 
509 
513  double LastCellPosition[3];
515  std::vector<double> LastWeights;
516 
517  double StepTime;
522  int UserFlag;
526 
527  // Parallel related flags
530 };
531 
532 #endif
533 // VTK-HeaderTest-Exclude: vtkLagrangianParticle.h
an abstract base class for locators which find cells
Class to perform non planar quad intersection.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:57
provides thread-safe access to cells
list of point or cell ids
Definition: vtkIdList.h:31
a simple class to control print indentation
Definition: vtkIndent.h:34
Basis class for Lagrangian particles.
double * GetNextUserVariables()
Get a pointer to the next user variables.
std::vector< double > TrackedUserData
static vtkLagrangianParticle * NewInstance(int numberOfVariables, vtkIdType seedId, vtkIdType particleId, vtkIdType seedArrayTupleIndex, double integrationTime, vtkPointData *seedData, int weightsSize, int numberOfTrackedUserData, vtkIdType numberOfSteps=0, double previousIntegrationTime=0)
Constructor wrapper to create a partially integrated particle in the domain.
std::vector< double > & GetPrevTrackedUserData()
Get a reference to PrevTrackedUserData See GetTrackedUserData for an explanation on how to use it.
std::vector< double > PrevTrackedUserData
virtual double GetPrevIntegrationTime()
Get the integration time at previous position.
virtual void MoveToNextPosition()
Move the particle to its next position by putting next equation variable to equation variable and cle...
virtual int GetUserFlag()
vtkIdType GetLastCellId()
Get the last traversed cell id.
virtual int GetNumberOfVariables()
Get the number of variables used to initialize EquationVariables.
vtkIdType GetLastSurfaceCellId()
Get the last intersected surface cell id.
void SetThreadedData(vtkLagrangianThreadedData *threadedData)
virtual vtkIdType GetSeedArrayTupleIndex() const
Get the index of the tuple for this particle in the point data returned by GetSeedData method.
double * GetEquationVariables()
Get a pointer to the particle variables array.
virtual void SetInteraction(int interaction)
Set/Get particle interaction.
vtkLagrangianParticle()=delete
double GetPositionVectorMagnitude()
Compute and return the position vector magnitude.
virtual void SetPInsertPreviousPosition(bool val)
Set/Get parallel specific flag, indication to insert or not the previous position after streaming.
virtual ~vtkLagrangianParticle()
Destructor.
virtual void SetPManualShift(bool val)
Set/Get parallel specific flag, indication that the particle may be manually shifted after streaming.
virtual void SetIntegrationTime(double time)
Convenience setter for integration time, do not use unless manual particle shifting One using this me...
double * GetNextVelocity()
Get a pointer to the next particle velocity.
ParticleTermination
An enum to inform about a reason for termination PARTICLE_TERMINATION_NOT_TERMINATED = 0,...
double * GetPrevVelocity()
Get a pointer to the previous particle velocity.
vtkLagrangianParticle * NewParticle(vtkIdType particleId)
method to create a particle from a parent particle.
vtkLagrangianParticle(const vtkLagrangianParticle &)=delete
double * GetPrevPosition()
Get a pointer to the previous particle position.
vtkDataSet * GetLastSurfaceDataSet()
Get the dataset containing the last intersected surface cell.
void operator=(const vtkLagrangianParticle &)=delete
virtual bool GetPInsertPreviousPosition()
virtual vtkIdType GetId()
Get particle id.
void SetLastCell(vtkAbstractCellLocator *locator, vtkDataSet *dataset, vtkIdType cellId, double lastCellPosition[3])
Set the last dataset and last cell id.
vtkDataSet * GetLastDataSet()
Get the dataset containing the last traversed cell.
std::vector< double > EquationVariables
virtual void SetUserFlag(int flag)
Set/Get user flag.
double * GetLastWeights()
Get the last weights computed when locating the particle in the last traversed cell.
double * GetVelocity()
Get a pointer to the particle velocity.
virtual vtkPointData * GetSeedData()
Get the particle seed data, for reading only.
double * GetNextEquationVariables()
Get a pointer to the particle variables array at its next position.
virtual vtkIdType GetParentId()
std::vector< double > & GetTrackedUserData()
Get a reference to TrackedUserData.
double * GetPrevUserVariables()
Get a pointer to the previous user variables.
virtual double & GetStepTimeRef()
Get reference to step time of this particle.
vtkLagrangianParticle(int numberOfVariables, vtkIdType seedId, vtkIdType particleId, vtkIdType seedArrayTupleIndex, double integrationTime, vtkPointData *seedData, int weightsSize, int numberOfTrackedUserData)
Constructor to create a particle from a seed.
double * GetUserVariables()
Get a pointer to the user variables.
SurfaceInteraction
An enum to inform about a surface interaction SURFACE_INTERACTION_NO_INTERACTION = 0,...
void SetLastSurfaceCell(vtkDataSet *dataset, vtkIdType cellId)
Set the last surface dataset and last surface cell id.
std::vector< double > PrevEquationVariables
double * GetNextPosition()
Get a pointer to the next particle position.
double * GetPosition()
Get a pointer to the particle position.
virtual int GetNumberOfUserVariables()
Get the number of variables specific to the user.
std::vector< double > NextTrackedUserData
virtual void SetTermination(int termination)
Set/Get particle termination.
vtkLagrangianParticle * CloneParticle()
method to create an exact clone of a particle.
virtual double GetIntegrationTime()
Get the integration time.
virtual bool GetPManualShift()
double * GetLastCellPosition()
Get the last position evaluated.
virtual int GetInteraction()
vtkAbstractCellLocator * GetLastLocator()
Get the locator used to find the last traversed cell.
std::vector< double > NextEquationVariables
virtual vtkIdType GetNumberOfSteps()
Get particle current number of steps.
virtual void SetParentId(vtkIdType parentId)
Set/Get parent particle id.
vtkAbstractCellLocator * LastLocator
virtual vtkIdType GetSeedId()
Get the particle original seed index in the seed dataset.
double * GetPrevEquationVariables()
Get a pointer to Particle variables at its previous position See GetEquationVariables for content des...
vtkLagrangianThreadedData * GetThreadedData()
Get/Set a pointer to a vtkLagrangianThreadedData that is considered to be local to the thread.
std::vector< double > & GetNextTrackedUserData()
Get a reference to NextTrackedUserData See GetTrackedUserData for an explanation on how to use it.
virtual void PrintSelf(ostream &os, vtkIndent indent)
Print information about the particle.
virtual int GetTermination()
std::vector< double > LastWeights
represent and manipulate point attribute data
Definition: vtkPointData.h:32
@ time
Definition: vtkX3D.h:503
struct to hold a user data
int vtkIdType
Definition: vtkType.h:338