ESyS-Particle  4.0.1
RandomBlockGenerator.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_LSMRANDOMBLOCKGENERATOR_H
00015 #define ESYS_LSMRANDOMBLOCKGENERATOR_H
00016 
00017 #include <Geometry/BlockGenerator.h>
00018 #include <Geometry/Plane.h>
00019 
00020 #include <vector>
00021 #include <boost/shared_ptr.hpp>
00022 
00023 namespace esys
00024 {
00025   namespace lsm
00026   {
00027     class ParticleFitter;
00028 
00029     typedef std::vector<Plane>                PlaneVector;
00030     typedef boost::shared_ptr<ParticleFitter> FitterPtr;
00031     typedef std::vector<FitterPtr>            FitterPtrVector;
00032 
00036     class RandomBlockGenerator : public BlockGenerator
00037     {
00038     public:
00039       RandomBlockGenerator(
00040         NTable            &nTable,
00041         ParticlePool      &particlePool,
00042         const BoundingBox &bBox,
00043         const BoolVector  &periodicDimensions,
00044         double            tolerance,
00045         double            minSphereRadius,
00046         double            maxSphereRadius,
00047         const PlaneVector &fitPlaneVector,
00048         int               maxInsertionFailures
00049       );
00050 
00051       virtual ~RandomBlockGenerator();
00052 
00053       virtual bool particleFits(const SimpleParticle &particle) const;
00054 
00055       virtual void generate();
00056 
00057       double getRandom(double min, double max) const;
00058 
00059       virtual double getRadius() const;
00060 
00061       virtual double getGridRadius() const;
00062 
00063       Vec3 getRandomPoint() const;
00064 
00065       ParticleVector getClosestNeighbors(const SimpleParticle& particle, int numClosest);
00066 
00067       int getMaxInsertionFailures() const;
00068 
00069       FitterPtrVector getFitterPtrVector();
00070 
00071       void generateFillParticles();
00072 
00073       const PlaneVector &getFitPlaneVector() const;
00074 
00075       Plane getClosestFitPlane(const SimpleParticle &particle) const;
00076 
00077     private:
00078       double      m_minRadius;
00079       double      m_maxRadius;
00080       PlaneVector m_fitPlaneVector;
00081       int         m_maxInsertionFailures;
00082     };
00083   };
00084 };
00085 
00086 #endif