AutoPas  3.0.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
sphLib::SPHParticle Class Reference

Basic SPHParticle class. More...

#include <SPHParticle.h>

Inheritance diagram for sphLib::SPHParticle:
Inheritance graph
[legend]
Collaboration diagram for sphLib::SPHParticle:
Collaboration graph
[legend]

Public Types

enum  AttributeNames : int {
  ptr , mass , posX , posY ,
  posZ , smth , density , velX ,
  velY , velZ , soundSpeed , pressure ,
  vsigmax , accX , accY , accZ ,
  engDot , ownershipState
}
 Attribute names for the soa arrays.
 
using SoAArraysType = autopas::utils::SoAType< SPHParticle *, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, autopas::OwnershipState >::Type
 SoA arrays type, cf.
 
- Public Types inherited from autopas::ParticleBase< floatType, idType >
enum  AttributeNames : int {
  ptr , id , posX , posY ,
  posZ , forceX , forceY , forceZ ,
  ownershipState
}
 Enums used as ids for accessing and creating a dynamically sized SoA.
 
using ParticleSoAFloatPrecision = floatType
 Floating Point Type used for this particle.
 
using ParticleIdType = idType
 Id Type used for this particle.
 
using SoAArraysType = typename autopas::utils::SoAType< ParticleBase< floatType, idType > *, idType, floatType, floatType, floatType, floatType, floatType, floatType, OwnershipState >::Type
 The type for the soa storage.
 

Public Member Functions

 SPHParticle ()
 Default constructor of SPHParticle.
 
 SPHParticle (const std::array< double, 3 > &r, const std::array< double, 3 > &v, unsigned long id)
 Constructor of the SPHParticle class.
 
 SPHParticle (const std::array< double, 3 > &r, const std::array< double, 3 > &v, unsigned long id, double mass, double smth, double snds)
 Constructor of the SPHParticle class.
 
 ~SPHParticle () override=default
 Destructor of the SPHParticle.
 
double getDensity () const
 Getter for the Density.
 
void addDensity (double density)
 Adds the given density to the current density.
 
void setDensity (double density)
 Setter for Density.
 
double getPressure () const
 Getter for Pressure.
 
void calcPressure ()
 Calculates the pressure within the particle from the energy and density of the particle and updates the pressure and sound of speed.
 
void setPressure (double pressure)
 Setter for the pressure.
 
double getMass () const
 Getter for the mass of the particle.
 
void setMass (double mass)
 Setter for the mass of the particle.
 
double getSmoothingLength () const
 Getter for the smoothing length of the particle.
 
void setSmoothingLength (double smth)
 Setter for the smoothing length.
 
double getSoundSpeed () const
 Getter for the speed of sound of the particle.
 
void setSoundSpeed (double snds)
 Setter for the speed of sound of the particle.
 
double getVSigMax () const
 Getter for the current maximally allowed signal velocity of the particle.
 
void checkAndSetVSigMax (double v_sig)
 Checks if the given signal velocity is higher than the current (local) one and updates the local one if it is.
 
void setVSigMax (double v_sig_max)
 Setter for the maximally allowed signal velocity.
 
const std::array< double, 3 > & getAcceleration () const
 Getter for the acceleration of the particle.
 
void addAcceleration (const std::array< double, 3 > &acc)
 Adds the given acceleration on the local acceleration.
 
void subAcceleration (const std::array< double, 3 > &acc)
 Substracts the given acceleration from the local acceleration.
 
void setAcceleration (const std::array< double, 3 > &acc)
 Setter for the acceleration.
 
double getEngDot () const
 Getter for the time derivative of the energy of the particle.
 
void addEngDot (double eng_dot)
 Adds the given value to the current value of the time derivative of the energy.
 
void setEngDot (double eng_dot)
 Setter for the time derivative of the energy.
 
double getEnergy () const
 Getter for the energy of the particle.
 
void setEnergy (double energy)
 Setter for the energy of the particle.
 
void addEnergy (double energy)
 Adds the given energy to the energy of the particle.
 
double getDt () const
 Getter for the maximally allowed time step for this particle.
 
void setDt (double dt)
 Set the maximally allowed time step for this particle.
 
void calcDt ()
 Calculate the maximally allowed time step for the particle based on the smoothing length and the signal velocity of the particle.
 
const std::array< double, 3 > & getVel_half () const
 Getter for velocity at half-time step (leapfrog)
 
void setVel_half (const std::array< double, 3 > &vel_half)
 Setter for velocity at half-time step (leapfrog)
 
double getEng_half () const
 Getter for energy at half-time step (leapfrog)
 
void setEng_half (double eng_half)
 Setter for energy at half-time step (leapfrog)
 
std::vector< double > serialize () const
 function to serialize an SPHParticle
 
template<AttributeNames attribute, std::enable_if_t< attribute==AttributeNames::ptr, bool > = true>
constexpr std::tuple_element< attribute, SoAArraysType >::type::value_type get ()
 Non-const getter for the pointer of this object.
 
template<AttributeNames attribute, std::enable_if_t< attribute !=AttributeNames::ptr, bool > = true>
constexpr std::tuple_element< attribute, SoAArraysType >::type::value_type get () const
 Getter, which allows access to an attribute using the corresponding attribute name (defined in AttributeNames).
 
template<AttributeNames attribute>
constexpr void set (typename std::tuple_element< attribute, SoAArraysType >::type::value_type value)
 Setter, which allows set an attribute using the corresponding attribute name (defined in AttributeNames).
 
- Public Member Functions inherited from autopas::ParticleBase< floatType, idType >
 ParticleBase (const std::array< double, 3 > &r, const std::array< double, 3 > &v, idType id, OwnershipState ownershipState=OwnershipState::owned)
 Constructor of the Particle class.
 
virtual ~ParticleBase ()=default
 Destructor of ParticleBase class.
 
bool operator== (const ParticleBase &rhs) const
 Equality operator for ParticleBase class.
 
bool operator!= (const ParticleBase &rhs) const
 Not-Equals operator for ParticleBase class.
 
const std::array< double, 3 > & getF () const
 get the force acting on the particle
 
void setF (const std::array< double, 3 > &f)
 Set the force acting on the particle.
 
void addF (const std::array< double, 3 > &f)
 Add a partial force to the force acting on the particle.
 
void subF (const std::array< double, 3 > &f)
 Substract a partial force from the force acting on the particle.
 
idType getID () const
 Get the id of the particle.
 
void setID (idType id)
 Set the id of the particle.
 
const std::array< double, 3 > & getR () const
 Get the position of the particle.
 
void setR (const std::array< double, 3 > &r)
 Set the position of the particle.
 
bool setRDistanceCheck (const std::array< double, 3 > &r, double maxDistSquared)
 Add a distance vector to the position of the particle and check if the distance between the old and new position is less than a given max distance.
 
void addR (const std::array< double, 3 > &r)
 Add a distance vector to the position of the particle.
 
bool addRDistanceCheck (const std::array< double, 3 > &r, double maxDistSquared)
 Add a distance vector to the position of the particle and check if the distance between the old and new position is less than a given max distance.
 
const std::array< double, 3 > & getV () const
 Get the velocity of the particle.
 
void setV (const std::array< double, 3 > &v)
 Set the velocity of the particle.
 
void addV (const std::array< double, 3 > &v)
 Add a vector to the current velocity of the particle.
 
virtual std::string toString () const
 Creates a string containing all data of the particle.
 
bool isOwned () const
 Defines whether the particle is owned by the current AutoPas object (aka (MPI-)process)
 
bool isHalo () const
 Defines whether the particle is a halo particle, i.e., not owned by the current AutoPas object (aka (MPI-)process)
 
bool isDummy () const
 Returns whether the particle is a dummy particle.
 
OwnershipState getOwnershipState () const
 Returns the particle's ownership state.
 
void setOwnershipState (OwnershipState ownershipState)
 Set the OwnershipState to the given value.
 
template<AttributeNames attribute, std::enable_if_t< attribute==AttributeNames::ptr, bool > = true>
constexpr std::tuple_element< attribute, SoAArraysType >::type::value_type get ()
 Non-const getter for the pointer of this object.
 
template<AttributeNames attribute, std::enable_if_t< attribute !=AttributeNames::ptr, bool > = true>
constexpr std::tuple_element< attribute, SoAArraysType >::type::value_type get () const
 Getter, which allows access to an attribute using the corresponding attribute name (defined in AttributeNames).
 
template<AttributeNames attribute>
constexpr void set (typename std::tuple_element< attribute, SoAArraysType >::type::value_type value)
 Setter, which allows set an attribute using the corresponding attribute name (defined in AttributeNames).
 

Static Public Member Functions

static SPHParticle deserialize (const double *stream, size_t &index)
 funtion to deserialize an SPHParticle
 

Additional Inherited Members

- Protected Attributes inherited from autopas::ParticleBase< floatType, idType >
std::array< floatType, 3 > _r
 Particle position as 3D coordinates.
 
std::array< floatType, 3 > _v
 Particle velocity as 3D vector.
 
std::array< floatType, 3 > _f
 Force the particle experiences as 3D vector.
 
idType _id
 Particle id.
 
OwnershipState _ownershipState
 Defines the state of the ownership of the particle.
 

Detailed Description

Basic SPHParticle class.

Member Typedef Documentation

◆ SoAArraysType

using sphLib::SPHParticle::SoAArraysType = autopas::utils::SoAType<SPHParticle *, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, autopas::OwnershipState>::Type

SoA arrays type, cf.

AttributeNames

Constructor & Destructor Documentation

◆ SPHParticle() [1/3]

sphLib::SPHParticle::SPHParticle ( )
inline

Default constructor of SPHParticle.

Will initialize all values to some basic defaults.

◆ SPHParticle() [2/3]

sphLib::SPHParticle::SPHParticle ( const std::array< double, 3 > &  r,
const std::array< double, 3 > &  v,
unsigned long  id 
)
inline

Constructor of the SPHParticle class.

Parameters
rposition of the particle
vvelocity of the particle
idid of the particle. This id should be unique

◆ SPHParticle() [3/3]

sphLib::SPHParticle::SPHParticle ( const std::array< double, 3 > &  r,
const std::array< double, 3 > &  v,
unsigned long  id,
double  mass,
double  smth,
double  snds 
)
inline

Constructor of the SPHParticle class.

Parameters
rposition of the particle
vvelocity of the particle
idid of the particle. This id should be unique
massmass of the particle
smthsmoothing length of the particle
sndsspeed of sound (SouND Speed)

Member Function Documentation

◆ addAcceleration()

void SPHParticle::addAcceleration ( const std::array< double, 3 > &  acc)

Adds the given acceleration on the local acceleration.

Used to sum up different acceleration values.

Parameters
accAcceleration to be added

◆ addDensity()

void sphLib::SPHParticle::addDensity ( double  density)
inline

Adds the given density to the current density.

Parameters
densitydensity to be added

◆ addEnergy()

void sphLib::SPHParticle::addEnergy ( double  energy)
inline

Adds the given energy to the energy of the particle.

Parameters
energythe energy to be added

◆ addEngDot()

void sphLib::SPHParticle::addEngDot ( double  eng_dot)
inline

Adds the given value to the current value of the time derivative of the energy.

Parameters
eng_dot

◆ checkAndSetVSigMax()

void sphLib::SPHParticle::checkAndSetVSigMax ( double  v_sig)
inline

Checks if the given signal velocity is higher than the current (local) one and updates the local one if it is.

Parameters
v_siggiven signal velocity

◆ deserialize()

static SPHParticle sphLib::SPHParticle::deserialize ( const double *  stream,
size_t &  index 
)
inlinestatic

funtion to deserialize an SPHParticle

Parameters
stream
indexstart index within the stream, will be increased while deserializing to mark already processed data.
Returns

◆ get() [1/2]

template<AttributeNames attribute, std::enable_if_t< attribute==AttributeNames::ptr, bool > = true>
constexpr std::tuple_element< attribute, SoAArraysType >::type::value_type sphLib::SPHParticle::get ( )
inlineconstexpr

Non-const getter for the pointer of this object.

Template Parameters
attributeAttribute name.
Returns
this.

◆ get() [2/2]

template<AttributeNames attribute, std::enable_if_t< attribute !=AttributeNames::ptr, bool > = true>
constexpr std::tuple_element< attribute, SoAArraysType >::type::value_type sphLib::SPHParticle::get ( ) const
inlineconstexpr

Getter, which allows access to an attribute using the corresponding attribute name (defined in AttributeNames).

Template Parameters
attributeAttribute name.
Returns
Value of the requested attribute.

◆ getAcceleration()

const std::array< double, 3 > & sphLib::SPHParticle::getAcceleration ( ) const
inline

Getter for the acceleration of the particle.

Returns
the acceleration of the particle

◆ getDensity()

double sphLib::SPHParticle::getDensity ( ) const
inline

Getter for the Density.

Returns
the current density of the particle

◆ getDt()

double sphLib::SPHParticle::getDt ( ) const
inline

Getter for the maximally allowed time step for this particle.

Returns
the maximally allowed time step for this particle

◆ getEnergy()

double sphLib::SPHParticle::getEnergy ( ) const
inline

Getter for the energy of the particle.

Returns
the energy of the particle

◆ getEng_half()

double sphLib::SPHParticle::getEng_half ( ) const
inline

Getter for energy at half-time step (leapfrog)

Returns

◆ getEngDot()

double sphLib::SPHParticle::getEngDot ( ) const
inline

Getter for the time derivative of the energy of the particle.

Returns
the time derivative of the energy of the particle

◆ getMass()

double sphLib::SPHParticle::getMass ( ) const
inline

Getter for the mass of the particle.

Returns
mass of particle

◆ getPressure()

double sphLib::SPHParticle::getPressure ( ) const
inline

Getter for Pressure.

Returns
current pressure of the particle

◆ getSmoothingLength()

double sphLib::SPHParticle::getSmoothingLength ( ) const
inline

Getter for the smoothing length of the particle.

Returns
the smoothing length of the particle

◆ getSoundSpeed()

double sphLib::SPHParticle::getSoundSpeed ( ) const
inline

Getter for the speed of sound of the particle.

Returns
speed of sound of the particle

◆ getVel_half()

const std::array< double, 3 > & sphLib::SPHParticle::getVel_half ( ) const
inline

Getter for velocity at half-time step (leapfrog)

Returns

◆ getVSigMax()

double sphLib::SPHParticle::getVSigMax ( ) const
inline

Getter for the current maximally allowed signal velocity of the particle.

Returns
the maximally allowed signal velocity of the particle

◆ serialize()

std::vector< double > sphLib::SPHParticle::serialize ( ) const
inline

function to serialize an SPHParticle

Returns
serialized vector of bytes (char)

◆ set()

template<AttributeNames attribute>
constexpr void sphLib::SPHParticle::set ( typename std::tuple_element< attribute, SoAArraysType >::type::value_type  value)
inlineconstexpr

Setter, which allows set an attribute using the corresponding attribute name (defined in AttributeNames).

Template Parameters
attributeAttribute name.
Parameters
valueNew value of the requested attribute.

◆ setAcceleration()

void sphLib::SPHParticle::setAcceleration ( const std::array< double, 3 > &  acc)
inline

Setter for the acceleration.

Parameters
accAcceleration to be set

◆ setDensity()

void sphLib::SPHParticle::setDensity ( double  density)
inline

Setter for Density.

Parameters
densityThe value of the density to be set as the particle's density

◆ setDt()

void sphLib::SPHParticle::setDt ( double  dt)
inline

Set the maximally allowed time step for this particle.

Parameters
dtthe maximally allowed time step for this particle

◆ setEnergy()

void sphLib::SPHParticle::setEnergy ( double  energy)
inline

Setter for the energy of the particle.

Parameters
energythe energy of the particle

◆ setEng_half()

void sphLib::SPHParticle::setEng_half ( double  eng_half)
inline

Setter for energy at half-time step (leapfrog)

Parameters
eng_half

◆ setEngDot()

void sphLib::SPHParticle::setEngDot ( double  eng_dot)
inline

Setter for the time derivative of the energy.

Parameters
eng_dot

◆ setMass()

void sphLib::SPHParticle::setMass ( double  mass)
inline

Setter for the mass of the particle.

Parameters
massmass to be set

◆ setPressure()

void sphLib::SPHParticle::setPressure ( double  pressure)
inline

Setter for the pressure.

Parameters
pressurepressure value to be set

◆ setSmoothingLength()

void sphLib::SPHParticle::setSmoothingLength ( double  smth)
inline

Setter for the smoothing length.

Parameters
smthsmoothing lenth to be set

◆ setSoundSpeed()

void sphLib::SPHParticle::setSoundSpeed ( double  snds)
inline

Setter for the speed of sound of the particle.

Parameters
sndsspeed of sound of the particle

◆ setVel_half()

void sphLib::SPHParticle::setVel_half ( const std::array< double, 3 > &  vel_half)
inline

Setter for velocity at half-time step (leapfrog)

Parameters
vel_half

◆ setVSigMax()

void sphLib::SPHParticle::setVSigMax ( double  v_sig_max)
inline

Setter for the maximally allowed signal velocity.

Parameters
v_sig_maxthe maximally allowed signal velocity

◆ subAcceleration()

void SPHParticle::subAcceleration ( const std::array< double, 3 > &  acc)

Substracts the given acceleration from the local acceleration.

Used to sum up different negative acceleration values.

Parameters
accAcceleration to be substracted

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