ESyS-Particle
4.0.1
|
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 #ifndef __ESYS_LSM_SPHEREBLOCKGENERATOR 00014 #define __ESYS_LSM_SPHEREBLOCKGENERATOR 00015 00016 // --- project includes --- 00017 #include <Geometry/ParticleGenerator.h> 00018 #include <Geometry/SimpleParticle.h> 00019 00020 // --- STL includes --- 00021 #include <set> 00022 using std::set; 00023 00024 namespace esys 00025 { 00026 namespace lsm 00027 { 00031 class SphereBlockGenerator : public ParticleGenerator 00032 { 00033 public: 00034 // types 00035 typedef NTable::ParticleVector ParticleVector; 00036 typedef NTable::ParticleIterator ParticleIterator; 00037 typedef set<int> IdSet; 00038 00039 // functions 00040 SphereBlockGenerator(NTable&,ParticlePool&,double,const Vec3&,double,double,double,int,int); 00041 virtual ~SphereBlockGenerator(); 00042 00043 virtual void generate(); 00044 virtual void generateSeedParticles(); 00045 virtual void generateFillParticles(); 00046 virtual SimpleParticle generateParticle(const Vec3 &point); 00047 virtual void insertParticle(const SimpleParticle&); 00048 virtual double getRadius() const; 00049 int getNextId(); 00050 size_t getNumParticles() const {return m_idSet.size();}; 00051 const BoundingBox getBBox() const; 00052 virtual double getGridRadius() const; 00053 virtual bool particleFits(const SimpleParticle &particle) const; 00054 ParticleIterator getParticleIterator(){return ParticleIterator(m_particleVector);} 00055 vector<SimpleParticle*> getClosestNeighbors(const SimpleParticle&,int); 00056 bool findAFitWithSphere(SimpleParticle&, const vector<SimpleParticle*>&); 00057 bool findAFit(SimpleParticle&, const vector<SimpleParticle*>&); 00058 bool checkAFit(const SimpleParticle&); 00059 Vec3 getAPoint(); 00060 00061 private: 00062 ParticleVector m_particleVector; 00063 double m_tol; 00064 IdSet m_idSet; 00065 Vec3 m_center; 00066 double m_radius; 00067 double m_min_rad; 00068 double m_max_rad; 00069 int m_max_tries; 00070 int m_tag; 00071 }; 00072 }; 00073 }; 00074 00075 #endif // __ESYS_LSM_SPHEREBLOCKGENERATOR