ESyS-Particle  4.0.1
BodyForceGroup.hpp
1 
2 // //
3 // Copyright (c) 2003-2011 by The University of Queensland //
4 // Earth Systems Science Computational Centre (ESSCC) //
5 // http://www.uq.edu.au/esscc //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.opensource.org/licenses/osl-3.0.php //
10 // //
12 
13 
14 #include "ppa/src/pp_array.h"
15 
16 namespace esys
17 {
18  namespace lsm
19  {
20  template <class TmplParticle>
21  BodyForceGroup<TmplParticle>::BodyForceGroup(
22  const BodyForceIGP &prms,
23  ParticleArray &particleArray
24  )
25  : m_acceleration(prms.getAcceleration()),
26  m_pParticleArray(&particleArray)
27  {
28  }
29 
30  template <class TmplParticle>
31  BodyForceGroup<TmplParticle>::~BodyForceGroup()
32  {
33  }
34 
35  template <class TmplParticle>
36  void BodyForceGroup<TmplParticle>::Update(ParallelParticleArray<TmplParticle> *particleArray)
37  {
38  }
39 
40  template <class TmplParticle>
42  {
43  return m_acceleration*mass;
44  }
45 
46  template <class TmplParticle>
47  void BodyForceGroup<TmplParticle>::applyForce(TmplParticle &particle) const
48  {
49  particle.applyForce(getForce(particle.getMass()), particle.getPos());
50  }
51 
52  template <class TmplParticle>
54  {
55  typename ParticleArray::ParticleListHandle plh = m_pParticleArray->getAllParticles();
56  for (
57  ParticleIterator it = plh->begin();
58  it != plh->end();
59  it++
60  )
61  {
62  applyForce(*(*it));
63  }
64  }
65  }
66 }