VTK  9.3.20240328
vtkLagrangianParticle.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
20 #ifndef vtkLagrangianParticle_h
21 #define vtkLagrangianParticle_h
22 
23 #include "vtkFiltersFlowPathsModule.h" // For export macro
24 #include "vtkNew.h" // For vtkNew
25 #include "vtkSystemIncludes.h" // For PrintSelf signature and vtkType
26 
27 #include <vector>
28 
29 VTK_ABI_NAMESPACE_BEGIN
32 class vtkDataSet;
33 class vtkGenericCell;
34 class vtkIdList;
35 class vtkPointData;
37 
38 class VTKFILTERSFLOWPATHS_EXPORT vtkLagrangianParticle
39 {
40 public:
59  typedef enum ParticleTermination
60  {
61  PARTICLE_TERMINATION_NOT_TERMINATED = 0,
69  PARTICLE_TERMINATION_ABORTED
70  } ParticleTermination;
71 
83  typedef enum SurfaceInteraction
84  {
85  SURFACE_INTERACTION_NO_INTERACTION = 0,
90  SURFACE_INTERACTION_OTHER
91  } SurfaceInteraction;
92 
102  vtkLagrangianParticle(int numberOfVariables, vtkIdType seedId, vtkIdType particleId,
103  vtkIdType seedArrayTupleIndex, double integrationTime, vtkPointData* seedData,
104  int numberOfTrackedUserData);
105 
110  static vtkLagrangianParticle* NewInstance(int numberOfVariables, vtkIdType seedId,
111  vtkIdType particleId, vtkIdType seedArrayTupleIndex, double integrationTime,
112  vtkPointData* seedData, int numberOfTrackedUserData, vtkIdType numberOfSteps = 0,
113  double previousIntegrationTime = 0);
114 
122 
127 
132 
134 
138  inline double* GetPrevEquationVariables() { return this->PrevEquationVariables.data(); }
140 
142 
154  inline double* GetEquationVariables() { return this->EquationVariables.data(); }
156 
158 
163  inline double* GetNextEquationVariables() { return this->NextEquationVariables.data(); }
165 
167 
172  inline double* GetPrevPosition() { return this->PrevEquationVariables.data(); }
174 
176 
181  inline double* GetPosition() { return this->EquationVariables.data(); }
183 
185 
190  inline double* GetNextPosition() { return this->NextEquationVariables.data(); }
192 
194 
199  inline double* GetPrevVelocity() { return this->PrevVelocity; }
201 
203 
208  inline double* GetVelocity() { return this->Velocity; }
210 
212 
217  inline double* GetNextVelocity() { return this->NextVelocity; }
219 
221 
226  inline double* GetPrevUserVariables() { return this->PrevUserVariables; }
228 
230 
235  inline double* GetUserVariables() { return this->UserVariables; }
237 
239 
244  inline double* GetNextUserVariables() { return this->NextUserVariables; }
246 
248 
252  inline std::vector<double>& GetPrevTrackedUserData() { return this->PrevTrackedUserData; }
254 
256 
266  inline std::vector<double>& GetTrackedUserData() { return this->TrackedUserData; }
268 
270 
274  inline std::vector<double>& GetNextTrackedUserData() { return this->NextTrackedUserData; }
276 
278 
285  inline vtkLagrangianThreadedData* GetThreadedData() { return this->ThreadedData; }
286  inline void SetThreadedData(vtkLagrangianThreadedData* threadedData)
287  {
288  this->ThreadedData = threadedData;
289  }
291 
298  virtual void MoveToNextPosition();
299 
303  virtual vtkIdType GetId();
304 
306 
310  virtual void SetParentId(vtkIdType parentId);
313 
318  virtual vtkIdType GetSeedId();
319 
323  virtual int GetNumberOfVariables();
324 
329 
334 
340 
345 
350 
354  void SetLastSurfaceCell(vtkDataSet* dataset, vtkIdType cellId);
355 
360 
362 
367  virtual void SetTermination(int termination);
368  virtual int GetTermination();
370 
372 
377  virtual void SetInteraction(int interaction);
378  virtual int GetInteraction();
380 
382 
385  virtual void SetUserFlag(int flag);
386  virtual int GetUserFlag();
388 
390 
395  virtual void SetPInsertPreviousPosition(bool val);
398 
400 
405  virtual void SetPManualShift(bool val);
406  virtual bool GetPManualShift();
408 
412  virtual double& GetStepTimeRef();
413 
417  virtual double GetIntegrationTime();
418 
422  virtual double GetPrevIntegrationTime();
423 
432  virtual void SetIntegrationTime(double time);
433 
438 
442  virtual void PrintSelf(ostream& os, vtkIndent indent);
443 
444 protected:
447  void operator=(const vtkLagrangianParticle&) = delete;
448 
449  std::vector<double> PrevEquationVariables;
450  double* PrevVelocity;
452 
453  std::vector<double> EquationVariables;
454  double* Velocity;
455  double* UserVariables;
456 
457  std::vector<double> NextEquationVariables;
458  double* NextVelocity;
460 
461  std::vector<double> PrevTrackedUserData;
462  std::vector<double> TrackedUserData;
463  std::vector<double> NextTrackedUserData;
464 
465  vtkLagrangianThreadedData* ThreadedData = nullptr;
466 
473 
474  double StepTime;
479  int UserFlag;
483 
484  // Parallel related flags
487 };
488 
489 VTK_ABI_NAMESPACE_END
490 #endif
491 // 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:165
provides thread-safe access to cells
list of point or cell ids
Definition: vtkIdList.h:132
a simple class to control print indentation
Definition: vtkIndent.h:108
Basis class for Lagrangian particles.
double * GetNextUserVariables()
Get a pointer to the next user variables.
std::vector< double > TrackedUserData
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()
Set/Get user flag.
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)
Get/Set a pointer to a vtkLagrangianThreadedData that is considered to be local to the thread.
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()
Set/Get parallel specific flag, indication to insert or not the previous position after streaming.
virtual vtkIdType GetId()
Get particle id.
static vtkLagrangianParticle * NewInstance(int numberOfVariables, vtkIdType seedId, vtkIdType particleId, vtkIdType seedArrayTupleIndex, double integrationTime, vtkPointData *seedData, int numberOfTrackedUserData, vtkIdType numberOfSteps=0, double previousIntegrationTime=0)
Constructor wrapper to create a partially integrated particle in the domain.
std::vector< double > EquationVariables
virtual void SetUserFlag(int flag)
Set/Get user flag.
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()
Set/Get parent particle id.
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.
double * GetUserVariables()
Get a pointer to the user variables.
SurfaceInteraction
An enum to inform about a surface interaction SURFACE_INTERACTION_NO_INTERACTION = 0,...
vtkLagrangianParticle(int numberOfVariables, vtkIdType seedId, vtkIdType particleId, vtkIdType seedArrayTupleIndex, double integrationTime, vtkPointData *seedData, int numberOfTrackedUserData)
Constructor to create a particle from a seed.
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()
Set/Get parallel specific flag, indication that the particle may be manually shifted after streaming.
virtual int GetInteraction()
Set/Get particle interaction.
std::vector< double > NextEquationVariables
virtual vtkIdType GetNumberOfSteps()
Get particle current number of steps.
virtual void SetParentId(vtkIdType parentId)
Set/Get parent particle id.
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()
Set/Get particle termination.
represent and manipulate point attribute data
Definition: vtkPointData.h:139
@ time
Definition: vtkX3D.h:497
struct to hold a user data
int vtkIdType
Definition: vtkType.h:315