36template <
typename T,
typename PARTICLETYPE>
40 std::size_t iParticle )
41 : _dynamicFieldGroupsD( dynamicFieldGroupsD ),
42 _dynamicsVector( dynamicsVector ),
43 _iParticle( iParticle)
46template <
typename T,
typename PARTICLETYPE>
49 particles::dynamics::initializeParticle<T, PARTICLETYPE>( _dynamicFieldGroupsD, _iParticle);
52template <
typename T,
typename PARTICLETYPE>
53template<
bool multiOutput>
56 particles::io::printGenericParticleInfo<T, PARTICLETYPE,multiOutput>( _dynamicFieldGroupsD, iParticle);
59template <
typename T,
typename PARTICLETYPE>
60template<
bool multiOutput>
63 print<multiOutput>(_iParticle);
66template <
typename T,
typename PARTICLETYPE>
72template <
typename T,
typename PARTICLETYPE>
75 _iParticle = iParticle;
78template <
typename T,
typename PARTICLETYPE>
84template<
typename T,
typename PARTICLETYPE>
88 _dynamicsVector.push_back( dynamicsSPtr );
91template<
typename T,
typename PARTICLETYPE>
92template <
typename DYNAMICS,
typename ...Args>
94 _dynamicsVector.push_back( std::make_shared<DYNAMICS>(std::forward<Args>(args)...) );
97template<
typename T,
typename PARTICLETYPE>
98template<
bool boundsCheck>
102 if constexpr(boundsCheck){
103 return _dynamicsVector.at(iDyn).get();
105 return _dynamicsVector[iDyn].get();
109template<
typename T,
typename PARTICLETYPE>
113 getDynamics(iDyn)->
process(*
this, timeStepSize);
120template <
typename T,
typename PARTICLETYPE>
121template <
typename GROUP,
typename FIELD>
123 PARTICLETYPE::template size<
124 typename PARTICLETYPE::template derivedField<GROUP>::template derivedField<FIELD>
127 typename PARTICLETYPE::template derivedField<GROUP>::template derivedField<FIELD>>
131 using GROUP_EVAL =
typename PARTICLETYPE
132 ::template derivedField<GROUP>;
133 using FIELD_EVAL =
typename GROUP_EVAL
134 ::template derivedField<FIELD>;
135 return _dynamicFieldGroupsD.template get<GROUP_EVAL>()
136 .template get<FIELD_EVAL>()
137 .getRowPointer(_iParticle);
141template <
typename T,
typename PARTICLETYPE>
142template <
typename GROUP,
typename FIELD>
144 PARTICLETYPE::template size<
145 typename PARTICLETYPE::template derivedField<GROUP>::template derivedField<FIELD>
147 typename PARTICLETYPE::template derivedField<GROUP>::template derivedField<FIELD>::template value_type<T>>
150 using GROUP_EVAL =
typename PARTICLETYPE
151 ::template derivedField<GROUP>;
152 using FIELD_EVAL =
typename GROUP_EVAL
153 ::template derivedField<FIELD>;
154 return _dynamicFieldGroupsD.template get<GROUP_EVAL>()
155 .template get<FIELD_EVAL>()
156 .getRowPointer(_iParticle)[0];
159template <
typename T,
typename PARTICLETYPE>
160template <
typename GROUP,
typename FIELD>
161std::enable_if_t<(PARTICLETYPE::template size<
162 typename PARTICLETYPE::template derivedField<GROUP>::template derivedField<FIELD>
165 const FieldD<T,PARTICLETYPE,
166 typename PARTICLETYPE::template derivedField<GROUP>
167 ::template derivedField<FIELD>>& v )
169 using GROUP_EVAL =
typename PARTICLETYPE
170 ::template derivedField<GROUP>;
171 using FIELD_EVAL =
typename GROUP_EVAL
172 ::template derivedField<FIELD>;
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];
181template <
typename T,
typename PARTICLETYPE>
182template <
typename GROUP,
typename FIELD>
183std::enable_if_t<(PARTICLETYPE::template size<
184 typename PARTICLETYPE::template derivedField<GROUP>::template derivedField<FIELD>
187 typename PARTICLETYPE::template derivedField<GROUP>
188 ::template derivedField<FIELD>
189 ::template value_type<T> value)
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;
Storage for dynamic field groups (Prototype for ParticleSystem)
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.
std::size_t getId() const
Return memory ID of the currently represented particle.
void addDynamics(std::shared_ptr< dynamics::ParticleDynamics< T, PARTICLETYPE > > &dynamicsSPtr)
Add dynamics.
void advanceId()
Jump to next particle in linearization sequence.
dynamics::ParticleDynamics< T, PARTICLETYPE > * getDynamics(unsigned iDyn=0)
Get a pointer to specific dynamics.
void defineDynamics(Args &&...args)
Define dynamics (factory method)
Particle(DATA &dynamicFieldGroupsD, std::vector< std::shared_ptr< dynamics::ParticleDynamics< T, PARTICLETYPE > > > &dynamicsVector, std::size_t iParticle)
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.
void process(T timeStepSize, unsigned short iDyn=0)
Apply processing to the particle according to dynamics at iDyn.
void setId(std::size_t iParticle)
Jump to arbitrary particle memory ID.
bool isMotionComputationEnabled(Particle< T, PARTICLETYPE > &particle)
Check if motion is enabled.
Top level namespace for all of OpenLB.
virtual void process(Particle< T, PARTICLETYPE > &particle, T timeStepSize)=0
Implementation of the processing step.