OpenLB 1.7
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
olb::particles::Particle< T, PARTICLETYPE > Class Template Reference

#include <particle.h>

+ Collaboration diagram for olb::particles::Particle< T, PARTICLETYPE >:

Public Types

using Communicatable = typename GroupedDataCommunicatableHelper<DATA,PARTICLETYPE>::type
 Define Communicatable.
 

Public Member Functions

 Particle (DATA &dynamicFieldGroupsD, std::vector< std::shared_ptr< dynamics::ParticleDynamics< T, PARTICLETYPE > > > &dynamicsVector, std::size_t iParticle)
 
void init ()
 Initialize.
 
template<bool multiOutput = PARTICLETYPE::template providesNested<descriptors::PARALLELIZATION>()>
void print (std::size_t iParticle)
 Print.
 
template<bool multiOutput = PARTICLETYPE::template providesNested<descriptors::PARALLELIZATION>()>
void print ()
 
std::size_t getId () const
 Return memory ID of the currently represented particle.
 
void setId (std::size_t iParticle)
 Jump to arbitrary particle memory ID.
 
void advanceId ()
 Jump to next particle in linearization sequence.
 
void addDynamics (std::shared_ptr< dynamics::ParticleDynamics< T, PARTICLETYPE > > &dynamicsSPtr)
 Add dynamics.
 
template<typename DYNAMICS , typename ... Args>
void defineDynamics (Args &&...args)
 Define dynamics (factory method)
 
template<bool boundsCheck = false>
dynamics::ParticleDynamics< T, PARTICLETYPE > * getDynamics (unsigned iDyn=0)
 Get a pointer to specific dynamics.
 
void process (T timeStepSize, unsigned short iDyn=0)
 Apply processing to the particle according to dynamics at iDyn.
 
template<typename GROUP , typename FIELD >
std::enable_if_t<(PARTICLETYPE::template size< typename PARTICLETYPE::template derivedField< GROUP >::template derivedField< FIELD > >() > 1), FieldD< T, PARTICLETYPE, typename PARTICLETYPE::template derivedField< GROUP >::template derivedField< FIELD > > getField ()
 Return copy of descriptor-declared FIELD as a vector.
 
template<typename GROUP , typename FIELD >
std::enable_if_t<(PARTICLETYPE::templatesize< typenamePARTICLETYPE::templatederivedField< GROUP >::templatederivedField< FIELD > >()==1), typenamePARTICLETYPE::templatederivedField< GROUP >::template derivedField< FIELD >::template value_type< T > getField ()
 Return copy of descriptor-declared FIELD as a scalar (more specifically as value type of FIELD)
 
template<typename GROUP , typename FIELD >
std::enable_if_t<(PARTICLETYPE::template size< typename PARTICLETYPE::template derivedField< GROUP >::template derivedField< FIELD > >() > 1), void > setField (const FieldD< T, PARTICLETYPE, typename PARTICLETYPE::template derivedField< GROUP > ::template derivedField< FIELD > > &v)
 Set descriptor-declared FIELD.
 
template<typename GROUP , typename FIELD >
std::enable_if_t<(PARTICLETYPE::template size< typename PARTICLETYPE::template derivedField< GROUP >::template derivedField< FIELD > >()==1), void > setField (typename PARTICLETYPE::template derivedField< GROUP > ::template derivedField< FIELD > ::template value_type< T > value)
 Set descriptor-declared FIELD.
 
Communicatable getCommunicatable ()
 Get communicatable necessary for serialization.
 
std::size_t getSerialSize () const
 Get serialized size.
 
std::size_t serialize (std::uint8_t *buffer) const
 Serialize data.
 
std::size_t deserialize (const std::uint8_t *buffer)
 Deserialize data.
 

Detailed Description

template<typename T, typename PARTICLETYPE>
class olb::particles::Particle< T, PARTICLETYPE >

Definition at line 42 of file particle.h.

Member Typedef Documentation

◆ Communicatable

template<typename T , typename PARTICLETYPE >
using olb::particles::Particle< T, PARTICLETYPE >::Communicatable = typename GroupedDataCommunicatableHelper<DATA,PARTICLETYPE>::type

Define Communicatable.

Definition at line 130 of file particle.h.

Constructor & Destructor Documentation

◆ Particle()

template<typename T , typename PARTICLETYPE >
olb::particles::Particle< T, PARTICLETYPE >::Particle ( DATA & dynamicFieldGroupsD,
std::vector< std::shared_ptr< dynamics::ParticleDynamics< T, PARTICLETYPE > > > & dynamicsVector,
std::size_t iParticle )

Definition at line 37 of file particle.hh.

41 : _dynamicFieldGroupsD( dynamicFieldGroupsD ),
42 _dynamicsVector( dynamicsVector ),
43 _iParticle( iParticle)
44{}

Member Function Documentation

◆ addDynamics()

template<typename T , typename PARTICLETYPE >
void olb::particles::Particle< T, PARTICLETYPE >::addDynamics ( std::shared_ptr< dynamics::ParticleDynamics< T, PARTICLETYPE > > & dynamicsSPtr)

Add dynamics.

Definition at line 85 of file particle.hh.

87{
88 _dynamicsVector.push_back( dynamicsSPtr );
89}

◆ advanceId()

template<typename T , typename PARTICLETYPE >
void olb::particles::Particle< T, PARTICLETYPE >::advanceId ( )

Jump to next particle in linearization sequence.

Definition at line 79 of file particle.hh.

80{
81 ++_iParticle;
82}

◆ defineDynamics()

template<typename T , typename PARTICLETYPE >
template<typename DYNAMICS , typename ... Args>
void olb::particles::Particle< T, PARTICLETYPE >::defineDynamics ( Args &&... args)

Define dynamics (factory method)

Definition at line 93 of file particle.hh.

93 {
94 _dynamicsVector.push_back( std::make_shared<DYNAMICS>(std::forward<Args>(args)...) );
95}

◆ deserialize()

template<typename T , typename PARTICLETYPE >
std::size_t olb::particles::Particle< T, PARTICLETYPE >::deserialize ( const std::uint8_t * buffer)
inline

Deserialize data.

Definition at line 146 of file particle.h.

146 {
147 const std::vector<unsigned int> indices{static_cast<unsigned int>(_iParticle)};
148 return Communicatable(_dynamicFieldGroupsD).deserialize(indices, buffer);
149 }
typename GroupedDataCommunicatableHelper< DATA, PARTICLETYPE >::type Communicatable
Define Communicatable.
Definition particle.h:130
+ Here is the caller graph for this function:

◆ getCommunicatable()

template<typename T , typename PARTICLETYPE >
Communicatable olb::particles::Particle< T, PARTICLETYPE >::getCommunicatable ( )
inline

Get communicatable necessary for serialization.

Definition at line 132 of file particle.h.

132 {
133 return Communicatable(_dynamicFieldGroupsD);
134 }

◆ getDynamics()

template<typename T , typename PARTICLETYPE >
template<bool boundsCheck>
dynamics::ParticleDynamics< T, PARTICLETYPE > * olb::particles::Particle< T, PARTICLETYPE >::getDynamics ( unsigned iDyn = 0)

Get a pointer to specific dynamics.

Definition at line 99 of file particle.hh.

101{
102 if constexpr(boundsCheck){
103 return _dynamicsVector.at(iDyn).get();
104 } else {
105 return _dynamicsVector[iDyn].get();
106 }
107}

◆ getField() [1/2]

template<typename T , typename PARTICLETYPE >
template<typename GROUP , typename FIELD >
std::enable_if_t<( PARTICLETYPE::template size< typename PARTICLETYPE::template derivedField< GROUP >::template derivedField< FIELD > >() > 1), FieldD< T, PARTICLETYPE, typename PARTICLETYPE::template derivedField< GROUP >::template derivedField< FIELD > > olb::particles::Particle< T, PARTICLETYPE >::getField ( )

Return copy of descriptor-declared FIELD as a vector.

◆ getField() [2/2]

template<typename T , typename PARTICLETYPE >
template<typename GROUP , typename FIELD >
std::enable_if_t<(PARTICLETYPE::templatesize< typenamePARTICLETYPE::templatederivedField< GROUP >::templatederivedField< FIELD > >()==1), typenamePARTICLETYPE::templatederivedField< GROUP >::template derivedField< FIELD >::template value_type< T > olb::particles::Particle< T, PARTICLETYPE >::getField ( )

Return copy of descriptor-declared FIELD as a scalar (more specifically as value type of FIELD)

◆ getId()

template<typename T , typename PARTICLETYPE >
std::size_t olb::particles::Particle< T, PARTICLETYPE >::getId ( ) const

Return memory ID of the currently represented particle.

Definition at line 67 of file particle.hh.

68{
69 return _iParticle;
70}
+ Here is the caller graph for this function:

◆ getSerialSize()

template<typename T , typename PARTICLETYPE >
std::size_t olb::particles::Particle< T, PARTICLETYPE >::getSerialSize ( ) const
inline

Get serialized size.

Definition at line 136 of file particle.h.

136 {
137 const std::vector<unsigned int> indices{static_cast<unsigned int>(_iParticle)};
138 return Communicatable(_dynamicFieldGroupsD).size(indices);
139 }

◆ init()

template<typename T , typename PARTICLETYPE >
void olb::particles::Particle< T, PARTICLETYPE >::init ( )

Initialize.

Definition at line 47 of file particle.hh.

48{
49 particles::dynamics::initializeParticle<T, PARTICLETYPE>( _dynamicFieldGroupsD, _iParticle);
50}

◆ print() [1/2]

template<typename T , typename PARTICLETYPE >
template<bool multiOutput>
void olb::particles::Particle< T, PARTICLETYPE >::print ( )

Definition at line 61 of file particle.hh.

62{
63 print<multiOutput>(_iParticle);
64}

◆ print() [2/2]

template<typename T , typename PARTICLETYPE >
template<bool multiOutput>
void olb::particles::Particle< T, PARTICLETYPE >::print ( std::size_t iParticle)

Print.

Definition at line 54 of file particle.hh.

55{
56 particles::io::printGenericParticleInfo<T, PARTICLETYPE,multiOutput>( _dynamicFieldGroupsD, iParticle);
57}

◆ process()

template<typename T , typename PARTICLETYPE >
void olb::particles::Particle< T, PARTICLETYPE >::process ( T timeStepSize,
unsigned short iDyn = 0 )

Apply processing to the particle according to dynamics at iDyn.

Definition at line 110 of file particle.hh.

111{
113 getDynamics(iDyn)->process(*this, timeStepSize);
114 }
115}
dynamics::ParticleDynamics< T, PARTICLETYPE > * getDynamics(unsigned iDyn=0)
Get a pointer to specific dynamics.
Definition particle.hh:99
bool isMotionComputationEnabled(Particle< T, PARTICLETYPE > &particle)
Check if motion is enabled.

References olb::particles::access::isMotionComputationEnabled(), and olb::particles::dynamics::ParticleDynamics< T, PARTICLETYPE >::process().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serialize()

template<typename T , typename PARTICLETYPE >
std::size_t olb::particles::Particle< T, PARTICLETYPE >::serialize ( std::uint8_t * buffer) const
inline

Serialize data.

Definition at line 141 of file particle.h.

141 {
142 const std::vector<unsigned int> indices{static_cast<unsigned int>(_iParticle)};
143 return Communicatable(_dynamicFieldGroupsD).serialize(indices, buffer);
144 }
+ Here is the caller graph for this function:

◆ setField() [1/2]

template<typename T , typename PARTICLETYPE >
template<typename GROUP , typename FIELD >
std::enable_if_t<(PARTICLETYPE::template size< typename PARTICLETYPE::template derivedField< GROUP >::template derivedField< FIELD > >() > 1), void > olb::particles::Particle< T, PARTICLETYPE >::setField ( const FieldD< T, PARTICLETYPE, typename PARTICLETYPE::template derivedField< GROUP > ::template derivedField< FIELD > > & v)

Set descriptor-declared FIELD.

Definition at line 164 of file particle.hh.

168{
169 using GROUP_EVAL = typename PARTICLETYPE
170 ::template derivedField<GROUP>;
171 using FIELD_EVAL = typename GROUP_EVAL
172 ::template derivedField<FIELD>;
173 //Analogous to BlockStaticFieldsD
174 auto& field = _dynamicFieldGroupsD.template get<GROUP_EVAL>()
175 .template get<FIELD_EVAL>();
176 for (unsigned iDim=0; iDim < PARTICLETYPE::template size<FIELD_EVAL>(); ++iDim) {
177 field[iDim][_iParticle] = v[iDim];
178 }
179}
std::enable_if_t< DESCRIPTOR::d==2, std::shared_ptr< SuperF2D< T > > > field(SuperLattice< T, DESCRIPTOR > &sLattice)
Returns external field functor.

◆ setField() [2/2]

template<typename T , typename PARTICLETYPE >
template<typename GROUP , typename FIELD >
std::enable_if_t<(PARTICLETYPE::template size< typename PARTICLETYPE::template derivedField< GROUP >::template derivedField< FIELD > >()==1), void > olb::particles::Particle< T, PARTICLETYPE >::setField ( typename PARTICLETYPE::template derivedField< GROUP > ::template derivedField< FIELD > ::template value_type< T > value)

Set descriptor-declared FIELD.

Definition at line 186 of file particle.hh.

190{
191 using GROUP_EVAL = typename PARTICLETYPE
192 ::template derivedField<GROUP>;
193 using FIELD_EVAL = typename GROUP_EVAL
194 ::template derivedField<FIELD>;
195 _dynamicFieldGroupsD.template get<GROUP_EVAL>()
196 .template get<FIELD_EVAL>()
197 .getRowPointer(_iParticle)[0] = value;
198}
typename std::integral_constant< TYPE, VALUE >::type value
Identity type to wrap non-type template arguments.
Definition meta.h:96

◆ setId()

template<typename T , typename PARTICLETYPE >
void olb::particles::Particle< T, PARTICLETYPE >::setId ( std::size_t iParticle)

Jump to arbitrary particle memory ID.

Definition at line 73 of file particle.hh.

74{
75 _iParticle = iParticle;
76}

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