ESyS-Particle  4.0.1
SoftBWallInteractionGroup.hpp
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 //----------------------------------------------
00014 //       CSoftBWallInteractionGroup functions
00015 //----------------------------------------------
00016 
00017 #include "Foundation/console.h"
00018 
00019 template<class T>
00020 CSoftBWallInteractionGroup<T>::CSoftBWallInteractionGroup(TML_Comm* comm):AWallInteractionGroup<T>(comm)
00021 {}
00022 
00030 template<class T>
00031 CSoftBWallInteractionGroup<T>::CSoftBWallInteractionGroup(TML_Comm* comm,CWall* wallp, const CSoftBWallIGP* I)
00032   : AWallInteractionGroup<T>(comm)
00033 {
00034   console.XDebug() << "making CSoftBWallInteractionGroup \n";
00035 
00036   m_normalK=I->getNormalK();
00037   m_shearK=I->getShearK();
00038   this->m_wall=wallp;
00039   m_tag=I->getTag();
00040   m_scaling=I->getScaling();
00041 //  console.XDebug() << "kx, ky, kz: " << m_kx << ","<< m_ky << ","<< m_kz << "\n";
00042 }
00043 
00044 template<class T>
00045 void CSoftBWallInteractionGroup<T>::calcForces()
00046 {
00047 
00048   console.XDebug() << "calculating " << m_interactions.size() << " soft bonded wall forces\n" ;
00049 
00050   for(
00051     typename vector<CSoftBondedWallInteraction<T> >::iterator it=m_interactions.begin();
00052     it != m_interactions.end();
00053     it++
00054   ){
00055     it->calcForces();
00056   }
00057 }
00058 
00059 template<class T>
00060 void CSoftBWallInteractionGroup<T>::Update(ParallelParticleArray<T>* PPA)
00061 {
00062 
00063   console.XDebug() << "CSoftBWallInteractionGroup::Update()\n" ;
00064 
00065   // empty particle list first
00066   m_interactions.erase(m_interactions.begin(),m_interactions.end());
00067   // build new particle list
00068   typename ParallelParticleArray<T>::ParticleListHandle plh=
00069     PPA->getParticlesAtPlane(this->m_wall->getOrigin(),this->m_wall->getNormal());
00070   for(typename ParallelParticleArray<T>::ParticleListIterator iter=plh->begin();
00071       iter!=plh->end();
00072       iter++){
00073     if((*iter)->getTag()==m_tag){
00074       bool iflag=PPA->isInInner((*iter)->getPos());
00075       m_interactions.push_back(CSoftBondedWallInteraction<T>(*iter,this->m_wall,m_normalK,m_shearK,m_scaling,iflag));
00076     }
00077   }
00078   console.XDebug() << "end CSoftBWallInteractionGroup::Update()\n";
00079 }
00080 
00081 template<class T>
00082 ostream& operator<<(ostream& ost,const CSoftBWallInteractionGroup<T>& IG)
00083 {
00084   ost << "CBWallInteractionGroup" << endl << flush;
00085   ost << *(IG.m_wall) << endl << flush;
00086  
00087   return ost;
00088 }