00001 /* Classes for DG spaces 00002 */ 00003 00004 #ifndef dgSpace_hh 00005 #define dgSpace_hh 00006 00007 #include "basics/typedefs.hh" 00008 #include "element.hh" 00009 #include "elementPair.hh" 00010 #include "space/space.hh" 00011 #include "space/elementPairs.hh" 00012 #include "toolbox/scannerConnectors.hh" 00013 #include "geometry/boundaryConditions.hh" 00014 #include "geometry/mesh.hh" 00015 #include "graphics/spaceTraits.hh" 00016 00017 #include <map> 00018 #include <memory> 00019 00020 #define DEBUG_SPACE 0 00021 00022 namespace concepts { 00023 00024 // *************************************************************** Scanner ** 00026 template<> 00027 class Scan<linDG3D::FvdgElement> : public Scan<ElementWithCell<Real> > { 00028 public: 00030 linDG3D::FvdgElement& operator++(int) = 0; 00031 }; 00032 } // namespace concepts 00033 00034 namespace linDG3D { 00035 using concepts::Real; 00036 00037 // ****************************************************************** Spaces ** 00038 00042 class FvdgSpace : public concepts::SpaceOnCells<Real> { 00043 public: 00044 virtual ~FvdgSpace() 00045 { concepts::Joiner<FvdgElement*, 1>::destructor(elm_); } 00046 typedef concepts::Scan<FvdgElement> Scanner; 00048 uint dim() const { return dim_; } 00050 uint nelm() const { return nelm_; } 00052 Scanner* scan() const { 00053 return new concepts::PListScan<FvdgElement>(*elm_); 00054 } 00056 const concepts::ElementPairList<Real>& boundaryElmPairList() const { 00057 return boundaryElmPairList_; 00058 } 00060 const concepts::ElementPairList<Real>& innerElmPairList() const { 00061 return innerElmPairList_; 00062 } 00063 00064 protected: 00068 FvdgSpace(concepts::BoundaryConditions* bc) : 00069 dim_(0), nelm_(0), bc_(bc), elm_(0), innerElmPairList_(0) {}; 00071 virtual std::ostream& info(std::ostream& os) const; 00072 uint dim_; 00073 uint nelm_; 00074 concepts::BoundaryConditions* bc_; 00075 concepts::Joiner<FvdgElement*, 1>* elm_; 00076 00077 concepts::ElementPairList<Real> innerElmPairList_; 00078 concepts::ElementPairList<Real> boundaryElmPairList_; 00079 00080 void createElementPairList_(); 00081 }; 00082 00083 //************************************************************ FvdgSpaceP0 ** 00088 class FvdgSpaceP0 : public FvdgSpace { 00089 public: 00094 FvdgSpaceP0(concepts::Mesh3& msh, concepts::BoundaryConditions* bc = 0); 00095 protected: 00097 virtual std::ostream& info(std::ostream& os) const; 00098 }; 00099 00100 //************************************************************ FvdgSpaceP1 ** 00105 class FvdgSpaceP1 : public FvdgSpace { 00106 public: 00111 FvdgSpaceP1(concepts::Mesh3& msh, concepts::BoundaryConditions* bc = 0); 00112 protected: 00114 virtual std::ostream& info(std::ostream& os) const; 00115 }; 00116 00117 } // namespace linDG3D 00118 00119 // *********************************************** Space Traits for Graphics ** 00120 00121 namespace graphics { 00123 template<> 00124 struct spaceTraits<linDG3D::FvdgSpace> { 00125 static inline uint dim() { return 3; } 00126 static inline bool positionConnection() { return false; } 00127 static inline bool boundaryElements() { return false; } 00128 }; 00130 template<> 00131 struct spaceTraits<linDG3D::FvdgSpaceP0> { 00132 static inline uint dim() { return 3; } 00133 static inline bool positionConnection() { return false; } 00134 static inline bool boundaryElements() { return false; } 00135 }; 00137 template<> 00138 struct spaceTraits<linDG3D::FvdgSpaceP1> { 00139 static inline uint dim() { return 3; } 00140 static inline bool positionConnection() { return false; } 00141 static inline bool boundaryElements() { return false; } 00142 }; 00143 } // namespace graphics 00144 00145 #endif // dgSpace_hh