ESyS-Particle  4.0.1
SimpleBlock.h
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 #ifndef ESYS_LSMSIMPLEBLOCK_H
00015 #define ESYS_LSMSIMPLEBLOCK_H
00016 
00017 #include "Foundation/BoundingBox.h"
00018 #include "Geometry/ParticleCollection.h"
00019 #include "Geometry/SimpleParticle.h"
00020 #include "Geometry/NeighbourTable.h"
00021 #include "Geometry/BasicInteraction.h"
00022 #include "Geometry/Vec3L.h"
00023 
00024 #include <boost/shared_ptr.hpp>
00025 #include <boost/pool/object_pool.hpp>
00026 
00027 #include <vector>
00028 #include <float.h>
00029 
00030 namespace esys
00031 {
00032   namespace lsm
00033   {
00037     template <typename TmplParticle = SimpleParticle>
00038     class SimpleBlockGenerator
00039     {
00040     public:
00041       SimpleBlockGenerator(
00042           unsigned int numX,
00043           unsigned int numY,
00044           unsigned int numZ,
00045           double radius = 0.5
00046       );
00047 
00048       virtual ~SimpleBlockGenerator();
00049 
00050       double getRadius() const;
00051     
00052       template <typename TmplParticleCollection>
00053       void createParticles(TmplParticleCollection &particleCollection);
00054 
00055     protected:
00056       Vec3 getPos(const Vec3L &idx);
00057 
00058       int getId(const Vec3L &idx);
00059 
00060     private:
00061       double       m_radius;
00062       Vec3L        m_dimCounts;
00063     };
00064 
00068     template <typename TmplParticle = SimpleParticle>
00069     class SimpleBlock : public ParticleCollection<TmplParticle>
00070     {
00071     public:
00072       typedef typename ParticleCollection<TmplParticle>::Particle Particle;
00073       SimpleBlock(
00074           unsigned int numX,
00075           unsigned int numY,
00076           unsigned int numZ,
00077           double radius = 0.5
00078       );
00079 
00080       virtual ~SimpleBlock();
00081 
00082       double getRadius() const;
00083 
00084     protected:
00085       void createParticles();
00086 
00087     private:
00088       SimpleBlockGenerator<Particle> m_generator;
00089     };
00090   };
00091 };
00092 
00093 #include "Geometry/SimpleBlock.hpp"
00094 
00095 #endif