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_LSMPACKERGENERATORS_H 00015 #define ESYS_LSMPACKERGENERATORS_H 00016 00017 #include "Foundation/vec3.h" 00018 00019 namespace esys 00020 { 00021 namespace lsm 00022 { 00026 template <typename TmplParticle> 00027 class ConstRadiusGen 00028 { 00029 public: 00030 typedef TmplParticle Particle; 00031 00032 ConstRadiusGen(double radius); 00033 00038 const double &getParticleRadius() const; 00039 00044 const double &getMinFitRadius() const; 00045 00050 const double &getMaxFitRadius() const; 00051 00057 Particle getParticle(const Vec3 &posn) const; 00058 00065 Particle getParticle(const Vec3 &posn, const double &maxRadius) const; 00066 00070 bool isValidFitRadius(const double &fitRadius) const; 00071 00072 private: 00073 double m_radius; 00074 }; 00075 00080 template <typename TmplParticle> 00081 class RangeRadiusGen 00082 { 00083 public: 00084 typedef TmplParticle Particle; 00085 00086 RangeRadiusGen(double minFitRadius, double maxFitRadius); 00087 00088 virtual ~RangeRadiusGen(); 00089 00094 const double &getMinFitRadius() const; 00095 00100 const double &getMaxFitRadius() const; 00101 00105 bool isValidFitRadius(const double &fitRadius) const; 00106 00107 private: 00108 double m_minFitRadius; 00109 double m_maxFitRadius; 00110 }; 00111 00116 template <typename TmplParticle> 00117 class RndRadiusGen : public RangeRadiusGen<TmplParticle> 00118 { 00119 public: 00120 typedef RangeRadiusGen<TmplParticle> Inherited; 00121 typedef typename Inherited::Particle Particle; 00122 00123 RndRadiusGen( 00124 double minFitRadius, 00125 double maxFitRadius 00126 ); 00127 00131 double getRandomRadius() const; 00132 00133 Particle getParticle(const Vec3 &posn) const; 00134 00135 Particle getParticle(const Vec3 &posn, double suggestedRadius) const; 00136 00137 private: 00138 }; 00139 00140 template <typename TmplGrain> 00141 class GrainRndRadiusGen : public RndRadiusGen<typename TmplGrain::Particle> 00142 { 00143 public: 00144 typedef RndRadiusGen<typename TmplGrain::Particle> Inherited; 00145 typedef TmplGrain Grain; 00146 typedef typename Grain::Particle Particle; 00147 00148 GrainRndRadiusGen(double minGrainRadius, double maxGrainRadius); 00149 00150 virtual ~GrainRndRadiusGen(); 00151 00152 const double &getMinGrainRadius() const; 00153 00154 const double &getMaxGrainRadius() const; 00155 00156 virtual Grain getGrain(const Particle &p) = 0; 00157 }; 00158 00159 template <typename TmplGrain> 00160 class SingleParticleGrainGen : public GrainRndRadiusGen<TmplGrain> 00161 { 00162 public: 00163 typedef GrainRndRadiusGen<TmplGrain> Inherited; 00164 typedef typename Inherited::Grain Grain; 00165 typedef typename Grain::Particle Particle; 00166 00167 SingleParticleGrainGen(double minGrainRadius, double maxGrainRadius); 00168 00169 const double &getMinParticleRadius() const; 00170 00171 const double &getMaxParticleRadius() const; 00172 00173 virtual Grain getGrain(const Particle &p); 00174 }; 00175 } 00176 } 00177 00178 #include "Geometry/PackerGenerators.hpp" 00179 00180 #endif