SPH
Classes | Public Member Functions | Friends | List of all members
Particle Class Reference

Object holding information about single particle. More...

#include <Particle.h>

Classes

struct  ParamData
 Stored info about a material parameter. More...
 
class  ParamIterator
 
class  ParamSequence
 Helper for enumerating all stored parameters. More...
 
struct  QuantityData
 Stored info about a quantity. More...
 
class  QuantityIterator
 Iterator used to enumerate all stored quantities. More...
 
class  QuantitySequence
 Helper for enumerating all stored quantities. More...
 

Public Member Functions

 Particle ()=default
 Default constructor, defined only for convenient usage in containers, etc. More...
 
 Particle (const Size idx)
 Constructs object given its index in parent storage, containing no particle data. More...
 
 Particle (const Storage &storage, const Size idx)
 Constructs the object from storage, storing values of all quantities for given particle. More...
 
 Particle (const QuantityId id, const Dynamic &value, const Size idx)
 Constructs a particle with information about a single quantity value. More...
 
 Particle (const Particle &other)
 
 Particle (Particle &&other)
 
Particleoperator= (const Particle &other)
 
Particleoperator= (Particle &&other)
 
ParticleaddValue (const QuantityId id, const Dynamic &value)
 Adds another quantity value or updates the value of quantity previously stored. More...
 
ParticleaddDt (const QuantityId id, const Dynamic &value)
 Adds another quantity derivative or updates the derivative of quantity previously stored. More...
 
ParticleaddD2t (const QuantityId id, const Dynamic &value)
 Adds another quantity 2nd derivative or updates the 2nd derivative of quantity previously stored. More...
 
ParticleaddParameter (const BodySettingsId id, const Dynamic &value)
 Adds another material parameter or updates the one stored previously. More...
 
INLINE Size getIndex () const
 Returns the index of particle in the parent storage. More...
 
Dynamic getValue (const QuantityId id) const
 Retrieves a quantity value of the particle. More...
 
Dynamic getDt (const QuantityId id) const
 Retrieves a quantity derivative of the particle. More...
 
Dynamic getD2t (const QuantityId id) const
 Retrieves a quantity 2nd derivative of the particle. More...
 
Dynamic getParameter (const BodySettingsId id) const
 Retrieves a material parameter of the particle. More...
 
QuantitySequence getQuantities () const
 Returns a range for enumerating all stored quantities. More...
 
ParamSequence getParameters () const
 Returns a range for enumerating all stored parameters. More...
 

Friends

struct ParticleVisitor
 

Detailed Description

Object holding information about single particle.

Particle can store all or some quantities of given particle. Unlike in Storage, the Particle does not hold information about orders of the stored quantities, and it is possible to store derivatives of quantities without having quantity values stored as well.

Definition at line 17 of file Particle.h.

Constructor & Destructor Documentation

◆ Particle() [1/6]

Particle::Particle ( )
default

Default constructor, defined only for convenient usage in containers, etc.

Particle has to be initialized using copy/move operator.

◆ Particle() [2/6]

Particle::Particle ( const Size  idx)
inlineexplicit

Constructs object given its index in parent storage, containing no particle data.

Quantity data can be added using functions addValue, addDt and addD2t.

Definition at line 42 of file Particle.h.

◆ Particle() [3/6]

Particle::Particle ( const Storage storage,
const Size  idx 
)

Constructs the object from storage, storing values of all quantities for given particle.

Parameters
storageStorage containing the particle
idxIndex of the particle

Definition at line 30 of file Particle.cpp.

◆ Particle() [4/6]

Particle::Particle ( const QuantityId  id,
const Dynamic value,
const Size  idx 
)

Constructs a particle with information about a single quantity value.

Other quantity data can be added using functions addValue, addDt and addD2t.

Parameters
idQuantity ID of the quantity value
valueQuantity value. Cannot be used to add derivatives.
idxIndex of particle; although this constructor is not necessarily bound to a particle storage, this represents index to storage associated with the particle.

Definition at line 40 of file Particle.cpp.

◆ Particle() [5/6]

Particle::Particle ( const Particle other)

Definition at line 46 of file Particle.cpp.

◆ Particle() [6/6]

Particle::Particle ( Particle &&  other)

Definition at line 50 of file Particle.cpp.

Member Function Documentation

◆ addD2t()

Particle & Particle::addD2t ( const QuantityId  id,
const Dynamic value 
)

Adds another quantity 2nd derivative or updates the 2nd derivative of quantity previously stored.

Parameters
idQuantity ID of the quantity value
valueNew 2nd derivative of given quantity
Returns
Reference to itself, allowing to queue functions

Definition at line 84 of file Particle.cpp.

◆ addDt()

Particle & Particle::addDt ( const QuantityId  id,
const Dynamic value 
)

Adds another quantity derivative or updates the derivative of quantity previously stored.

Parameters
idQuantity ID of the quantity value
valueNew derivative of given quantity
Returns
Reference to itself, allowing to queue functions

Definition at line 76 of file Particle.cpp.

◆ addParameter()

Particle & Particle::addParameter ( const BodySettingsId  id,
const Dynamic value 
)

Adds another material parameter or updates the one stored previously.

Parameters
idID of the material parameter
valueValue of the material parameter

Definition at line 92 of file Particle.cpp.

◆ addValue()

Particle & Particle::addValue ( const QuantityId  id,
const Dynamic value 
)

Adds another quantity value or updates the value of quantity previously stored.

Parameters
idQuantity ID of the quantity value
valueNew value of given quantity
Returns
Reference to itself, allowing to queue functions

Definition at line 68 of file Particle.cpp.

◆ getD2t()

Dynamic Particle::getD2t ( const QuantityId  id) const

Retrieves a quantity 2nd derivative of the particle.

If the particle doesn't hold 2nd derivative of quantity with given ID, returns unitialized (empty) value.

Definition at line 113 of file Particle.cpp.

◆ getDt()

Dynamic Particle::getDt ( const QuantityId  id) const

Retrieves a quantity derivative of the particle.

If the particle doesn't hold derivative of quantity with given ID, returns unitialized (empty) value.

Definition at line 107 of file Particle.cpp.

◆ getIndex()

INLINE Size Particle::getIndex ( ) const
inline

Returns the index of particle in the parent storage.

Definition at line 97 of file Particle.h.

◆ getParameter()

Dynamic Particle::getParameter ( const BodySettingsId  id) const

Retrieves a material parameter of the particle.

If the particle doesn't hold the parameter with given ID, returns unitialized (empty) value.

Definition at line 119 of file Particle.cpp.

◆ getParameters()

Particle::ParamSequence Particle::getParameters ( ) const

Returns a range for enumerating all stored parameters.

Definition at line 201 of file Particle.cpp.

◆ getQuantities()

Particle::QuantitySequence Particle::getQuantities ( ) const

Returns a range for enumerating all stored quantities.

Definition at line 167 of file Particle.cpp.

◆ getValue()

Dynamic Particle::getValue ( const QuantityId  id) const

Retrieves a quantity value of the particle.

If the particle doesn't hold value of quantity with given ID, returns unitialized (empty) value.

Definition at line 101 of file Particle.cpp.

◆ operator=() [1/2]

Particle & Particle::operator= ( const Particle other)

Definition at line 54 of file Particle.cpp.

◆ operator=() [2/2]

Particle & Particle::operator= ( Particle &&  other)

Definition at line 61 of file Particle.cpp.

Friends And Related Function Documentation

◆ ParticleVisitor

friend struct ParticleVisitor
friend

Definition at line 18 of file Particle.h.


The documentation for this class was generated from the following files: