OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | List of all members
olb::Particle3D< T > Class Template Reference

#include <particle3D.h>

+ Inheritance diagram for olb::Particle3D< T >:
+ Collaboration diagram for olb::Particle3D< T >:

Public Member Functions

 Particle3D ()
 
 Particle3D (std::vector< T > pos, T mas=1., T rad=1., int id=0, T masAdd=0.)
 
 Particle3D (std::vector< T > pos, std::vector< T > vel, T mas=1., T rad=1., int id=0, T masAdd=0.)
 
 Particle3D (const Particle3D< T > &p)
 
void setPos (std::vector< T > pos)
 
void setStoredPos (std::vector< T > pos)
 
std::vector< T > & getStoredPos ()
 
std::vector< T > & getPos ()
 
const std::vector< T > & getPos () const
 
void setVel (std::vector< T > vel)
 
void setStoredVel (std::vector< T > vel)
 
std::vector< T > & getStoredVel ()
 
int getID ()
 
void setID (int id)
 
std::vector< T > & getVel ()
 
const std::vector< T > & getVel () const
 
void addForce (std::vector< T > &frc)
 
void setForce (std::vector< T > &frc)
 
void resetForce ()
 
std::vector< T > & getForce ()
 
const std::vector< T > & getForce () const
 
void setStoreForce (std::vector< T > &storeForce)
 
void resetStoreForce ()
 
std::vector< T > & getStoreForce ()
 
const std::vector< T > & getStoreForce () const
 
void serialize (T serial[])
 
void unserialize (T *)
 
void print ()
 
void printDeep (std::string message)
 
const T & getMass ()
 
const T & getAddedMass ()
 
const T & getEffectiveMass ()
 
const T & getInvMass ()
 
const T & getInvEffectiveMass ()
 
const T & getMass () const
 
const T & getAddedMass () const
 
const T & getEffectiveMass () const
 
void setMass (T m)
 
void setAddedMass (T m)
 
const T & getRad ()
 
const T & getRad () const
 
void setRad (T r)
 
const int & getCuboid ()
 
void setCuboid (int c)
 
const bool & getActive ()
 
const bool & getActive () const
 
void setActive (bool act)
 

Public Attributes

std::vector< std::pair< size_t, T > > _verletList
 

Static Public Attributes

static const int serialPartSize = 19
 

Protected Attributes

std::vector< T > _pos
 
std::vector< T > _vel
 
std::vector< T > _force
 
_invMas
 
_invMasAdd
 
_invEffectiveMas
 
_effectiveMas
 
_mas
 
_masAdd
 
_rad
 
int _cuboid
 globIC
 
int _id
 
bool _active
 
std::vector< T > _storePos
 
std::vector< T > _storeVel
 
std::vector< T > _storeForce
 

Detailed Description

template<typename T>
class olb::Particle3D< T >

Definition at line 42 of file particle3D.h.

Constructor & Destructor Documentation

◆ Particle3D() [1/4]

template<typename T >
olb::Particle3D< T >::Particle3D ( )

Definition at line 42 of file particle3D.hh.

43 : _pos(3, 0.),
44 _vel(3, 0.),
45 _force(3, 0.),
46 _effectiveMas(1.),
47 _mas(1.),
48 _masAdd(0.),
49 _rad(0),
50 _cuboid(0),
51 _id(0),
52 _active(false),
53 _storeForce(3, 0.)
54 { }
std::vector< T > _vel
Definition particle3D.h:118
std::vector< T > _pos
Definition particle3D.h:117
std::vector< T > _force
Definition particle3D.h:119
std::vector< T > _storeForce
Definition particle3D.h:133
int _cuboid
globIC
Definition particle3D.h:128

◆ Particle3D() [2/4]

template<typename T >
olb::Particle3D< T >::Particle3D ( std::vector< T > pos,
T mas = 1.,
T rad = 1.,
int id = 0,
T masAdd = 0. )

Definition at line 78 of file particle3D.hh.

79 : _pos(pos),
80 _vel(3, 0.),
81 _force(3, 0.),
82 _rad(rad),
83 _cuboid(0),
84 _id(id),
85 _active(true),
86 _storeForce(3, 0.)
87 {
88 setMass(mas);
89 setAddedMass(masAdd);
90 // RK4
91 // _positions = std::vector<std::vector<T> > (4, std::vector<T> (3, T() ));
92 // _velocities = std::vector<std::vector<T> > (4, std::vector<T> (3, T() ));
93 // _forces = std::vector<std::vector<T> > (4, std::vector<T> (3, T() ));
94 }
void setMass(T m)
void setAddedMass(T m)

References olb::Particle3D< T >::setAddedMass(), and olb::Particle3D< T >::setMass().

+ Here is the call graph for this function:

◆ Particle3D() [3/4]

template<typename T >
olb::Particle3D< T >::Particle3D ( std::vector< T > pos,
std::vector< T > vel,
T mas = 1.,
T rad = 1.,
int id = 0,
T masAdd = 0. )

Definition at line 138 of file particle3D.hh.

139 : _pos(pos),
140 _vel(vel),
141 _force(12, 0.),
142 _rad(rad),
143 _cuboid(0),
144 _id(id),
145 _active(true),
146 _storeForce(3, 0.)
147 {
148 setMass(mas);
149 setAddedMass(masAdd);
150 _vel.resize(12, 0.);
151 // RK4
152 // _positions = std::vector<std::vector<T> > (4, std::vector<T> (3, T() ));
153 // _velocities = std::vector<std::vector<T> > (4, std::vector<T> (3, T() ));
154 // _forces = std::vector<std::vector<T> > (4, std::vector<T> (3, T() ));
155 }

◆ Particle3D() [4/4]

template<typename T >
olb::Particle3D< T >::Particle3D ( const Particle3D< T > & p)

Definition at line 97 of file particle3D.hh.

98 : _pos(p._pos),
99 _vel(p._vel),
100 _force(p._force),
101 _rad(p._rad),
102 _cuboid(p._cuboid),
103 _id(p._id),
104 _active(p._active),
105 _storeForce(p._storeForce)
106 {
107 setMass(p._mas);
108 setAddedMass(p._masAdd);
109 // RK4
110 // _positions = std::vector<std::vector<T> > (4, std::vector<T> (3, T() ));
111 // _velocities = std::vector<std::vector<T> > (4, std::vector<T> (3, T() ));
112 // _forces = std::vector<std::vector<T> > (4, std::vector<T> (3, T() ));
113 }

References olb::Particle3D< T >::_mas, olb::Particle3D< T >::_masAdd, olb::Particle3D< T >::setAddedMass(), and olb::Particle3D< T >::setMass().

+ Here is the call graph for this function:

Member Function Documentation

◆ addForce()

template<typename T >
void olb::Particle3D< T >::addForce ( std::vector< T > & frc)
inline

Definition at line 230 of file particle3D.hh.

231 {
232 for (int i = 0; i < 3; i++) {
233 _force[i] += force[i];
234 }
235 }

◆ getActive() [1/2]

template<typename T >
const bool & olb::Particle3D< T >::getActive ( )
inline

Definition at line 524 of file particle3D.hh.

525 {
526 return _active;
527 }

◆ getActive() [2/2]

template<typename T >
const bool & olb::Particle3D< T >::getActive ( ) const
inline

Definition at line 530 of file particle3D.hh.

531 {
532 return _active;
533 }

◆ getAddedMass() [1/2]

template<typename T >
const T & olb::Particle3D< T >::getAddedMass ( )
inline

Definition at line 429 of file particle3D.hh.

430 {
431 return _masAdd;
432 }

◆ getAddedMass() [2/2]

template<typename T >
const T & olb::Particle3D< T >::getAddedMass ( ) const
inline

Definition at line 459 of file particle3D.hh.

460 {
461 return _masAdd;
462 }

◆ getCuboid()

template<typename T >
const int & olb::Particle3D< T >::getCuboid ( )
inline

Definition at line 512 of file particle3D.hh.

513 {
514 return _cuboid;
515 }

◆ getEffectiveMass() [1/2]

template<typename T >
const T & olb::Particle3D< T >::getEffectiveMass ( )
inline

Definition at line 447 of file particle3D.hh.

448 {
449 return _effectiveMas;
450 }

◆ getEffectiveMass() [2/2]

template<typename T >
const T & olb::Particle3D< T >::getEffectiveMass ( ) const
inline

Definition at line 465 of file particle3D.hh.

466 {
467 return _effectiveMas;
468 }

◆ getForce() [1/2]

template<typename T >
std::vector< T > & olb::Particle3D< T >::getForce ( )
inline

Definition at line 268 of file particle3D.hh.

269 {
270 return _force;
271 }

◆ getForce() [2/2]

template<typename T >
const std::vector< T > & olb::Particle3D< T >::getForce ( ) const
inline

Definition at line 274 of file particle3D.hh.

275 {
276 return _force;
277 }

◆ getID()

template<typename T >
int olb::Particle3D< T >::getID ( )
inline

Definition at line 206 of file particle3D.hh.

207 {
208 return _id;
209 }

◆ getInvEffectiveMass()

template<typename T >
const T & olb::Particle3D< T >::getInvEffectiveMass ( )
inline

Definition at line 441 of file particle3D.hh.

442 {
443 return _invEffectiveMas;
444 }

◆ getInvMass()

template<typename T >
const T & olb::Particle3D< T >::getInvMass ( )
inline

Definition at line 435 of file particle3D.hh.

436 {
437 return _invMas;
438 }

◆ getMass() [1/2]

template<typename T >
const T & olb::Particle3D< T >::getMass ( )
inline

Definition at line 423 of file particle3D.hh.

424 {
425 return _mas;
426 }
+ Here is the caller graph for this function:

◆ getMass() [2/2]

template<typename T >
const T & olb::Particle3D< T >::getMass ( ) const
inline

Definition at line 453 of file particle3D.hh.

454 {
455 return _mas;
456 }

◆ getPos() [1/2]

template<typename T >
std::vector< T > & olb::Particle3D< T >::getPos ( )
inline

Definition at line 176 of file particle3D.hh.

177 {
178 return _pos;
179 }
+ Here is the caller graph for this function:

◆ getPos() [2/2]

template<typename T >
const std::vector< T > & olb::Particle3D< T >::getPos ( ) const
inline

Definition at line 182 of file particle3D.hh.

183 {
184 return _pos;
185 }

◆ getRad() [1/2]

template<typename T >
const T & olb::Particle3D< T >::getRad ( )
inline

Definition at line 494 of file particle3D.hh.

495 {
496 return _rad;
497 }
+ Here is the caller graph for this function:

◆ getRad() [2/2]

template<typename T >
const T & olb::Particle3D< T >::getRad ( ) const
inline

Definition at line 500 of file particle3D.hh.

501 {
502 return _rad;
503 }

◆ getStoredPos()

template<typename T >
std::vector< T > & olb::Particle3D< T >::getStoredPos ( )
inline

Definition at line 170 of file particle3D.hh.

171 {
172 return _storePos;
173 }
std::vector< T > _storePos
Definition particle3D.h:131

◆ getStoredVel()

template<typename T >
std::vector< T > & olb::Particle3D< T >::getStoredVel ( )
inline

Definition at line 200 of file particle3D.hh.

201 {
202 return _storeVel;
203 }
std::vector< T > _storeVel
Definition particle3D.h:132

◆ getStoreForce() [1/2]

template<typename T >
std::vector< T > & olb::Particle3D< T >::getStoreForce ( )
inline

Definition at line 280 of file particle3D.hh.

281 {
282 return _storeForce;
283 }

◆ getStoreForce() [2/2]

template<typename T >
const std::vector< T > & olb::Particle3D< T >::getStoreForce ( ) const
inline

Definition at line 286 of file particle3D.hh.

287 {
288 return _storeForce;
289 }

◆ getVel() [1/2]

template<typename T >
std::vector< T > & olb::Particle3D< T >::getVel ( )
inline

Definition at line 218 of file particle3D.hh.

219 {
220 return _vel;
221 }
+ Here is the caller graph for this function:

◆ getVel() [2/2]

template<typename T >
const std::vector< T > & olb::Particle3D< T >::getVel ( ) const
inline

Definition at line 224 of file particle3D.hh.

225 {
226 return _vel;
227 }

◆ print()

template<typename T >
void olb::Particle3D< T >::print ( )

Definition at line 396 of file particle3D.hh.

397 {
398 std::cout << "Pos=(" << _pos[0] << ", " << _pos[1] << ", " << _pos[2] << ") "
399 << "Vel=(" << _vel[0] << ", " << _vel[1] << ", " << _vel[2] << ") "
400 << "Cub=" << _cuboid
401 << std::endl;
402 }

◆ printDeep()

template<typename T >
void olb::Particle3D< T >::printDeep ( std::string message)

Definition at line 405 of file particle3D.hh.

406 {
407 std::cout << message
408 << " ID=" << this->getID()
409// << " rad=" << this->getRad()
410// << " mass=" << this->getMass()
411// << " invMass=" << this->getInvMass()
412// << " addedMass=" << this->getAddedMass()
413// << " force=(" << this->getForce()[0] << ", " << this->getForce()[1] << ", " << this->getForce()[2] << ")"
414// << " storeForce=(" << this->getStoreForce()[0] << " " << this->getStoreForce()[1] << ", " << this->getStoreForce()[2] << ")"
415// << " active=" << this->getActive()
416// << std::endl;
417 << " ";
418 this->print();
419// std::cout << std::endl;
420 }

◆ resetForce()

template<typename T >
void olb::Particle3D< T >::resetForce ( )
inline

Definition at line 243 of file particle3D.hh.

244 {
245 for (int i = 0; i < 3; i++) {
246 _force[i] = 0.;
247 }
248 }

◆ resetStoreForce()

template<typename T >
void olb::Particle3D< T >::resetStoreForce ( )
inline

Definition at line 260 of file particle3D.hh.

261 {
262 for (int i = 0; i < 3; i++) {
263 _storeForce[i] = T(0);
264 }
265 }

◆ serialize()

template<typename T >
void olb::Particle3D< T >::serialize ( T serial[])

Definition at line 347 of file particle3D.hh.

348 {
349 for (int i = 0; i < 3; i++) {
350 serial[i] = _pos[i];
351 serial[i + 3] = _vel[i];
352 serial[i + 6] = _force[i];
353 }
354 serial[9] = _mas;
355 serial[10] = _masAdd;
356 serial[11] = _effectiveMas;
357 serial[12] = _rad;
358 serial[13] = _cuboid;
359 serial[14] = _active;
360 serial[15] = _id;
361
362 for (int i = 0; i < 3; i++) {
363 serial[i + 16] = _storeForce[i];
364 }
365
366 //for (int i = 0; i < 18; i++) {
367 //cout << "serialize " << i << ": " << serial[i] << " tn: " << typeid(serial[i]).name() << std::endl;
368 //}
369 }

◆ setActive()

template<typename T >
void olb::Particle3D< T >::setActive ( bool act)
inline

Definition at line 536 of file particle3D.hh.

537 {
538 _active = act;
539 if (!act) {
540 _vel[0] = 0;
541 _vel[1] = 0;
542 _vel[2] = 0;
543 }
544 }

◆ setAddedMass()

template<typename T >
void olb::Particle3D< T >::setAddedMass ( T m)
inline

Definition at line 483 of file particle3D.hh.

484 {
485 if (m < T()) {
486 throw std::invalid_argument("Exception called in particle3D::setAddedMass(T). Input value must be >= 0, but instead was " + std::to_string(m));
487 }
488 _masAdd = m;
491 }
constexpr T m(unsigned iPop, unsigned jPop, tag::MRT)
+ Here is the caller graph for this function:

◆ setCuboid()

template<typename T >
void olb::Particle3D< T >::setCuboid ( int c)
inline

Definition at line 518 of file particle3D.hh.

519 {
520 _cuboid = c;
521 }
platform_constant int c[Q][D]

◆ setForce()

template<typename T >
void olb::Particle3D< T >::setForce ( std::vector< T > & frc)
inline

Definition at line 238 of file particle3D.hh.

239 {
240 _force = force;
241 }

◆ setID()

template<typename T >
void olb::Particle3D< T >::setID ( int id)
inline

Definition at line 212 of file particle3D.hh.

213 {
214 _id = id;
215 }

◆ setMass()

template<typename T >
void olb::Particle3D< T >::setMass ( T m)
inline

Definition at line 471 of file particle3D.hh.

472 {
473 if (m <= T()) {
474 throw std::invalid_argument("Exception called in particle3D::setMass(T). Input value must be > 0, but instead was " + std::to_string(m));
475 }
476 _mas = m;
477 _invMas = 1. / _mas;
480 }
+ Here is the caller graph for this function:

◆ setPos()

template<typename T >
void olb::Particle3D< T >::setPos ( std::vector< T > pos)
inline

Definition at line 158 of file particle3D.hh.

159 {
160 _pos = pos;
161 }

◆ setRad()

template<typename T >
void olb::Particle3D< T >::setRad ( T r)
inline

Definition at line 506 of file particle3D.hh.

507 {
508 _rad = r;
509 }

◆ setStoredPos()

template<typename T >
void olb::Particle3D< T >::setStoredPos ( std::vector< T > pos)
inline

Definition at line 164 of file particle3D.hh.

165 {
166 _storePos = pos;
167 }

◆ setStoredVel()

template<typename T >
void olb::Particle3D< T >::setStoredVel ( std::vector< T > vel)
inline

Definition at line 194 of file particle3D.hh.

195 {
196 _storeVel = vel;
197 }

◆ setStoreForce()

template<typename T >
void olb::Particle3D< T >::setStoreForce ( std::vector< T > & storeForce)
inline

Definition at line 252 of file particle3D.hh.

253 {
254 for (int i = 0; i < 3; i++) {
255 _storeForce[i] = storeForce[i];
256 }
257 }

◆ setVel()

template<typename T >
void olb::Particle3D< T >::setVel ( std::vector< T > vel)
inline

Definition at line 188 of file particle3D.hh.

189 {
190 _vel = vel;
191 }

◆ unserialize()

template<typename T >
void olb::Particle3D< T >::unserialize ( T * data)

Definition at line 372 of file particle3D.hh.

373 {
374 for (int i = 0; i < 3; i++) {
375 _pos[i] = data[i];
376 _vel[i] = data[i + 3];
377 _force[i] = data[i + 6];
378 }
379 _mas = data[9];
380 _masAdd = data[10];
381 _effectiveMas = data[11];
382 _rad = data[12];
383 _cuboid = int(data[13]);
384 _active = data[14];
385 _invMas = 1. / _mas;
386 _invMasAdd = 1. / _masAdd;
388 _id = data[15];
389
390 for (int i = 0; i < 3; i++) {
391 _storeForce[i] = data[i + 16];
392 }
393 }

Member Data Documentation

◆ _active

template<typename T >
bool olb::Particle3D< T >::_active
protected

Definition at line 130 of file particle3D.h.

◆ _cuboid

template<typename T >
int olb::Particle3D< T >::_cuboid
protected

globIC

Definition at line 128 of file particle3D.h.

◆ _effectiveMas

template<typename T >
T olb::Particle3D< T >::_effectiveMas
protected

Definition at line 123 of file particle3D.h.

◆ _force

template<typename T >
std::vector<T> olb::Particle3D< T >::_force
protected

Definition at line 119 of file particle3D.h.

◆ _id

template<typename T >
int olb::Particle3D< T >::_id
protected

Definition at line 129 of file particle3D.h.

◆ _invEffectiveMas

template<typename T >
T olb::Particle3D< T >::_invEffectiveMas
protected

Definition at line 122 of file particle3D.h.

◆ _invMas

template<typename T >
T olb::Particle3D< T >::_invMas
protected

Definition at line 120 of file particle3D.h.

◆ _invMasAdd

template<typename T >
T olb::Particle3D< T >::_invMasAdd
protected

Definition at line 121 of file particle3D.h.

◆ _mas

template<typename T >
T olb::Particle3D< T >::_mas
protected

Definition at line 124 of file particle3D.h.

◆ _masAdd

template<typename T >
T olb::Particle3D< T >::_masAdd
protected

Definition at line 125 of file particle3D.h.

◆ _pos

template<typename T >
std::vector<T> olb::Particle3D< T >::_pos
protected

Definition at line 117 of file particle3D.h.

◆ _rad

template<typename T >
T olb::Particle3D< T >::_rad
protected

Definition at line 126 of file particle3D.h.

◆ _storeForce

template<typename T >
std::vector<T> olb::Particle3D< T >::_storeForce
protected

Definition at line 133 of file particle3D.h.

◆ _storePos

template<typename T >
std::vector<T> olb::Particle3D< T >::_storePos
protected

Definition at line 131 of file particle3D.h.

◆ _storeVel

template<typename T >
std::vector<T> olb::Particle3D< T >::_storeVel
protected

Definition at line 132 of file particle3D.h.

◆ _vel

template<typename T >
std::vector<T> olb::Particle3D< T >::_vel
protected

Definition at line 118 of file particle3D.h.

◆ _verletList

template<typename T >
std::vector<std::pair<size_t, T> > olb::Particle3D< T >::_verletList

Definition at line 114 of file particle3D.h.

◆ serialPartSize

template<typename T >
const int olb::Particle3D< T >::serialPartSize = 19
static

Definition at line 113 of file particle3D.h.


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