ESyS-Particle  4.0.1
Grain.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 #include "Geometry/Grain.h"
00015 #include <stdexcept>
00016 #include <fstream>
00017 #include <sstream>
00018 #include <iomanip>
00019 
00020 #include <boost/limits.hpp>
00021 
00022 namespace esys
00023 {
00024   namespace lsm
00025   {
00026     template <typename TmplParticleCollection>
00027     Grain<TmplParticleCollection>::Grain() : Inherited(), m_id(-1)
00028     {
00029     }
00030 
00031     template <typename TmplParticleCollection>
00032     Grain<TmplParticleCollection>::Grain(ParticlePoolPtr particlePoolPtr)
00033       : Inherited(particlePoolPtr),
00034         m_id(-1)
00035     {
00036     }
00037 
00038     template <typename TmplParticleCollection>
00039     Grain<TmplParticleCollection>::Grain(Id id) : Inherited(), m_id(id)
00040     {
00041     }
00042 
00043     template <typename TmplParticleCollection>
00044     Grain<TmplParticleCollection>::Grain(Id id, ParticlePoolPtr particlePoolPtr)
00045       : Inherited(particlePoolPtr),
00046         m_id(id)
00047     {
00048     }
00049 
00050     template <typename TmplParticleCollection>
00051     Grain<TmplParticleCollection>::Grain(const Grain &g)
00052       : Inherited(g), m_id(g.getId())
00053     {
00054     }
00055 
00056     template <typename TmplParticleCollection>
00057     Grain<TmplParticleCollection> &
00058     Grain<TmplParticleCollection>::operator=(const Grain &g)
00059     {
00060       Inherited::operator=(g);
00061       setId(g.getId());
00062       return *this;
00063     }
00064 
00065     template <typename TmplParticleCollection>
00066     typename Grain<TmplParticleCollection>::Id
00067     Grain<TmplParticleCollection>::getId() const
00068     {
00069       return m_id;
00070     }
00071     
00072     template <typename TmplParticleCollection>
00073     void Grain<TmplParticleCollection>::setId(Id id)
00074     {
00075       m_id = id;
00076     }
00077     
00078     template <typename TmplParticleCollection>
00079     void Grain<TmplParticleCollection>::setParticleIds(
00080       typename Particle::Id minId
00081     )
00082     {
00083       ParticleIterator it = this->getParticleIterator();
00084       while (it.hasNext())
00085       {
00086         it.next().setId(minId++);
00087       }
00088     }
00089   }
00090 }