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_LSMBOXPACKER_H 00015 #define ESYS_LSMBOXPACKER_H 00016 00017 #include <Geometry/Packer.h> 00018 #include <Foundation/vec3.h> 00019 #include <Foundation/BoundingBox.h> 00020 00021 #include <vector> 00022 00023 namespace esys 00024 { 00025 namespace lsm 00026 { 00027 typedef std::vector<bool> BoolVector; 00031 template <typename TmplPackerBase> 00032 class BoxPacker : public TmplPackerBase 00033 { 00034 public: 00035 typedef TmplPackerBase Inherited; 00036 typedef typename Inherited::Particle Particle; 00037 typedef typename Inherited::NTable NTable; 00038 typedef typename Inherited::NTablePtr NTablePtr; 00039 typedef typename Inherited::ParticlePool ParticlePool; 00040 typedef typename Inherited::ParticlePoolPtr ParticlePoolPtr; 00041 00042 BoxPacker( 00043 ParticlePoolPtr particlePoolPtr, 00044 NTablePtr nTablePtr, 00045 const BoundingBox &bBox, 00046 const BoolVector &periodicDimensions, 00047 double tolerance 00048 ); 00049 00050 virtual ~BoxPacker(); 00051 00052 virtual void generate() = 0; 00053 00054 bool particleFitsInBBox(const Particle &particle) const; 00055 00056 bool is2d() const; 00057 00058 bool particleFitsInBBoxWithNeighbours(const Particle &particle) const; 00059 00060 bool particleFitsWithNeighbours(const Particle &particle) const; 00061 00062 double getTolerance() const; 00063 00064 const BoundingBox &getBBox() const; 00065 00066 00067 const BoolVector &getPeriodicDimensions() const; 00068 00069 private: 00070 BoundingBox m_bBox; 00071 BoolVector m_periodicDimensions; 00072 double m_tolerance; 00073 }; 00074 }; 00075 }; 00076 00077 #include "Geometry/BoxPacker.hpp" 00078 00079 #endif