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 00014 #ifndef ESYS_LSMBLOCKGENERATOR_H 00015 #define ESYS_LSMBLOCKGENERATOR_H 00016 00017 #include <Geometry/ParticleGenerator.h> 00018 #include <Geometry/SimpleParticle.h> 00019 #include <Foundation/BoundingBox.h> 00020 00021 #include <vector> 00022 #include <set> 00023 00024 namespace esys 00025 { 00026 namespace lsm 00027 { 00028 typedef std::vector<bool> BoolVector; 00032 class BlockGenerator : public ParticleGenerator 00033 { 00034 public: 00035 BlockGenerator( 00036 NTable &nTable, 00037 ParticlePool &particlePool, 00038 const BoundingBox &bBox, 00039 const BoolVector &periodicDimensions, 00040 double tolerance 00041 ); 00042 00043 virtual ~BlockGenerator(); 00044 00045 virtual void generate() = 0; 00046 00047 virtual void generateSeedParticles(); 00048 00049 virtual SimpleParticle generateParticle(const Vec3 &point); 00050 00051 virtual double getRadius() const = 0; 00052 00053 virtual double getGridRadius() const = 0; 00054 00055 size_t getNumParticles() const; 00056 00057 int getNextId(); 00058 00059 virtual bool particleFits(const SimpleParticle &particle) const; 00060 00061 bool is2d() const; 00062 00063 bool particleFitsInBBox(const SimpleParticle &particle) const; 00064 00065 bool particleFitsWithNeighbours(const SimpleParticle &particle) const; 00066 00067 void insertParticle(const SimpleParticle &particle); 00068 00069 double getTolerance() const; 00070 00071 const BoundingBox &getBBox() const; 00072 00073 bool contains(const SimpleParticle &particle) const; 00074 00075 typedef NTable::ParticleVector ParticleVector; 00076 typedef NTable::ParticleIterator ParticleIterator; 00077 00078 ParticleIterator getParticleIterator() 00079 { 00080 return ParticleIterator(m_particleVector); 00081 } 00082 00083 typedef std::set<int> IdSet; 00084 private: 00085 BoundingBox m_bBox; 00086 BoolVector m_periodicDimensions; 00087 ParticleVector m_particleVector; 00088 double m_tolerance; 00089 IdSet m_idSet; 00090 }; 00091 }; 00092 }; 00093 00094 #endif