ESyS-Particle
4.0.1
|
00001 00002 // // 00003 // Copyright (c) 2003-2011 by The University of Queensland // 00004 // Earth Systems Science Computational Centre (ESSCC) // 00005 // http://www.uq.edu.au/esscc // 00006 // // 00007 // Primary Business: Brisbane, Queensland, Australia // 00008 // Licensed under the Open Software License version 3.0 // 00009 // http://www.opensource.org/licenses/osl-3.0.php // 00010 // // 00012 00013 #include "Foundation/console.h" 00014 00015 template<typename P,typename I> 00016 ParallelInteractionStorage_Single<P,I>::ParallelInteractionStorage_Single(AParallelParticleArray* ppa,const typename I::ParameterType& param):TParallelInteractionStorage<I>(ppa) 00017 { 00018 m_param=param; 00019 } 00020 00021 template<typename P,typename I> 00022 bool ParallelInteractionStorage_Single<P,I>::update() 00023 { 00024 console.XDebug() << "CDampingGroup<T>::Update()\n" ; 00025 // empty particle list first 00026 this->m_interactions.erase( 00027 this->m_interactions.begin(), 00028 this->m_interactions.end() 00029 ); 00030 // build new particle list 00031 typename ParallelParticleArray<P>::ParticleListHandle plh = 00032 ((ParallelParticleArray<P>*)this->m_ppa)->getAllParticles(); 00033 for( 00034 typename ParallelParticleArray<P>::ParticleListIterator iter=plh->begin(); 00035 iter!=plh->end(); 00036 iter++ 00037 ){ 00038 this->m_interactions.push_back(I(*iter,&m_param)); 00039 } 00040 console.XDebug() << "end CDampingGroup<T>::Update()\n" ; 00041 00042 return true; 00043 } 00044 00045 00046 template<typename P,typename InteractionType> 00047 void ParallelInteractionStorage_Single<P,InteractionType>::calcForces() 00048 { 00049 console.Debug() 00050 << "calculating " 00051 << this->m_interactions.size() 00052 << " damping forces\n" ; 00053 00054 for( 00055 typename std::list<InteractionType>::iterator it = this->m_interactions.begin(); 00056 it != this->m_interactions.end(); 00057 it++ 00058 ){ 00059 it->calcForces(); 00060 } 00061 } 00062 00063 template<typename P,typename InteractionType> 00064 void 00065 ParallelInteractionStorage_Single<P,InteractionType>::setTimeStepSize( 00066 double dt 00067 ) 00068 { 00069 console.Debug() 00070 << "Setting time step size for " 00071 << this->m_interactions.size() 00072 << " damping forces\n"; 00073 00074 m_param.setTimeStepSize(dt); 00075 for ( 00076 typename std::list<InteractionType>::iterator it = this->m_interactions.begin(); 00077 it != this->m_interactions.end(); 00078 it++ 00079 ){ 00080 it->setTimeStepSize(dt); 00081 } 00082 }