ESyS-Particle  4.0.1
pi_storage_single.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 #include "Foundation/console.h"
14 
15 template<typename P,typename I>
17 {
18  m_param=param;
19 }
20 
21 template<typename P,typename I>
23 {
24  console.XDebug() << "CDampingGroup<T>::Update()\n" ;
25  // empty particle list first
26  this->m_interactions.erase(
27  this->m_interactions.begin(),
28  this->m_interactions.end()
29  );
30  // build new particle list
31  typename ParallelParticleArray<P>::ParticleListHandle plh =
32  ((ParallelParticleArray<P>*)this->m_ppa)->getAllParticles();
33  for(
34  typename ParallelParticleArray<P>::ParticleListIterator iter=plh->begin();
35  iter!=plh->end();
36  iter++
37  ){
38  this->m_interactions.push_back(I(*iter,&m_param));
39  }
40  console.XDebug() << "end CDampingGroup<T>::Update()\n" ;
41 
42  return true;
43 }
44 
45 
46 template<typename P,typename InteractionType>
48 {
49  console.Debug()
50  << "calculating "
51  << this->m_interactions.size()
52  << " damping forces\n" ;
53 
54  for(
55  typename std::list<InteractionType>::iterator it = this->m_interactions.begin();
56  it != this->m_interactions.end();
57  it++
58  ){
59  it->calcForces();
60  }
61 }
62 
63 template<typename P,typename InteractionType>
64 void
66  double dt
67 )
68 {
69  console.Debug()
70  << "Setting time step size for "
71  << this->m_interactions.size()
72  << " damping forces\n";
73 
74  m_param.setTimeStepSize(dt);
75  for (
76  typename std::list<InteractionType>::iterator it = this->m_interactions.begin();
77  it != this->m_interactions.end();
78  it++
79  ){
80  it->setTimeStepSize(dt);
81  }
82 }