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 00014 namespace esys 00015 { 00016 namespace lsm 00017 { 00018 template <typename TmplParticle> 00019 ParticleComparer<TmplParticle>::ParticleComparer(const Particle &p) 00020 : m_pParticle(&p) 00021 { 00022 } 00023 00024 template <typename TmplParticle> 00025 bool ParticleComparer<TmplParticle>::operator()( 00026 const Particle &p1, 00027 const Particle &p2 00028 ) const 00029 { 00030 return 00031 ( 00032 ((p1.getPos() - m_pParticle->getPos()).norm() - p1.getRad()) 00033 < 00034 ((p2.getPos() - m_pParticle->getPos()).norm() - p2.getRad()) 00035 ); 00036 } 00037 00038 template <typename TmplParticle> 00039 bool ParticleComparer<TmplParticle>::operator()( 00040 const Particle *p1, 00041 const Particle *p2 00042 ) const 00043 { 00044 return this->operator()(*p1,*p2); 00045 } 00046 } 00047 }