ESyS-Particle  4.0.1
ClosePackBlock.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_LSMCLOSEPACKBLOCK_H
00015 #define ESYS_LSMCLOSEPACKBLOCK_H
00016 
00017 #include "Geometry/ClosePackIterator.h"
00018 #include "Geometry/ParticleCollection.h"
00019 
00020 namespace esys
00021 {
00022   namespace lsm
00023   {
00027     template <typename TmplClosePackIterator,typename TmplParticle>
00028     class ClosePackBlockGenerator
00029     {
00030     public:
00031       typedef TmplClosePackIterator CentrePointIterator;
00032       
00033       ClosePackBlockGenerator(
00034           unsigned int numX,
00035           unsigned int numY,
00036           unsigned int numZ,
00037           double radius = 0.5,
00038           ClosePackOrientation orientation = DEFAULT_ORIENT
00039       );
00040 
00041       virtual ~ClosePackBlockGenerator();
00042 
00043       double getRadius() const;
00044 
00045       template <typename TmplParticleCollection>
00046       void createParticles(TmplParticleCollection &particleCollection);
00047 
00048     protected:
00049 
00050     private:
00051       double               m_radius;
00052       Vec3L                m_dimCounts;
00053       ClosePackOrientation m_orientation;
00054     };
00055 
00059     template <typename TmplClosePackIterator, typename TmplParticle>
00060     class ClosePackBlock : public ParticleCollection<TmplParticle>
00061     {
00062     public:
00063       typedef typename ParticleCollection<TmplParticle>::Particle Particle;
00064       typedef TmplClosePackIterator ClosePackIterator;
00065       typedef ClosePackBlockGenerator<TmplClosePackIterator, Particle> BlockGenerator;
00066       ClosePackBlock(
00067           unsigned int numX,
00068           unsigned int numY,
00069           unsigned int numZ,
00070           double radius = 0.5,
00071           ClosePackOrientation orientation = DEFAULT_ORIENT
00072       );
00073 
00074       virtual ~ClosePackBlock();
00075 
00076       double getRadius() const;
00077 
00078     protected:
00079       void createParticles();
00080 
00081     private:
00082       BlockGenerator m_generator;
00083     };
00084   };
00085 };
00086 
00087 #include "Geometry/ClosePackBlock.hpp"
00088 
00089 #endif