ESyS-Particle  4.0.1
CubicBoxPacker.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_LSMCUBICBOXPACKER_H
00015 #define ESYS_LSMCUBICBOXPACKER_H
00016 
00017 #include <Geometry/BoxPacker.h>
00018 
00019 namespace esys
00020 {
00021   namespace lsm
00022   {
00023     typedef std::vector<bool> BoolVector;
00027     template <typename TmplParticleGenerator, typename TmplBoxPackerBase>
00028     class CubicBoxPacker : public TmplBoxPackerBase
00029     {
00030     public:
00031       typedef TmplParticleGenerator                ParticleGenerator;
00032       typedef boost::shared_ptr<ParticleGenerator> ParticleGeneratorPtr;
00033       typedef TmplBoxPackerBase                    Inherited;
00034       typedef Inherited                            BoxPackerBase;
00035       typedef typename Inherited::Particle         Particle;
00036       typedef typename Inherited::NTable           NTable;
00037       typedef typename Inherited::NTablePtr        NTablePtr;
00038       typedef typename Inherited::ParticlePool     ParticlePool;
00039       typedef typename Inherited::ParticlePoolPtr  ParticlePoolPtr;
00040 
00041       CubicBoxPacker(
00042         ParticleGeneratorPtr particleGeneratorPtr,
00043         ParticlePoolPtr      particlePoolPtr,
00044         NTablePtr            nTablePtr,
00045         const BoundingBox    &bBox,
00046         const BoolVector     &periodicDimensions,
00047         double               tolerance,
00048         double               cubicPackRadius
00049       );
00050 
00051       virtual ~CubicBoxPacker();
00052 
00053       Particle getCandidateParticle(const Vec3 &point);
00054 
00055       Particle getCandidateParticle(const Vec3 &point, double radius);
00056 
00057       double getCubicPackingRadius() const;
00058 
00059       const ParticleGenerator &getParticleGenerator() const;
00060 
00061       ParticleGenerator &getParticleGenerator();
00062 
00063       void setParticleGenerator(ParticleGenerator &particleGenerator);
00064 
00065       void setParticleGenerator(ParticleGeneratorPtr particleGenerator);
00066 
00067       void generateCubicPacking();
00068 
00069       virtual void generate();
00070 
00071     private:
00072       double               m_cubicPackRadius;
00073       ParticleGeneratorPtr m_particleGeneratorPtr;
00074       ParticleGenerator    *m_pParticleGenerator;
00075     };
00076   };
00077 };
00078 
00079 #include "Geometry/CubicBoxPacker.hpp"
00080 
00081 #endif