00001 // Space for linear DG FEM in 1D 00002 00003 #ifndef linDG1Dspace_hh 00004 #define linDG1Dspace_hh 00005 00006 #include <iostream> 00007 00008 #include "basics/typedefs.hh" 00009 #include "space/space.hh" 00010 #include "space/elementPairs.hh" 00011 #include "linearFEM/element1D.hh" 00012 #include "linearFEM/space1D.hh" 00013 #include "toolbox/scannerConnectors.hh" 00014 00015 namespace concepts { 00016 00017 // forward declarations 00018 class Mesh1; 00019 00020 } // namespace concepts 00021 00022 namespace linDG1D { 00023 00024 using concepts::Real; 00025 00026 // ************************************************************** Linear1d ** 00027 00031 class Linear1d : public concepts::Space<Real> { 00032 public: 00033 typedef concepts::Scan<linearFEM::Line> Scan; 00034 typedef void (*SMap)(const concepts::TColumn<Real>&, 00035 concepts::TColumn<Real>&); 00041 Linear1d(concepts::Mesh1& msh, uint level); 00042 virtual ~Linear1d(); 00043 virtual uint dim() const { return dim_; } 00044 virtual uint nelm() const { return nelm_; } 00045 virtual Scan* scan() const 00046 { return new concepts::PListScan<linearFEM::Line>(*elm_); } 00047 const concepts::ElementPairList<Real>& elmPairs() const 00048 { return elmPair_; } 00049 protected: 00050 virtual std::ostream& info(std::ostream& os) const; 00051 private: 00053 uint dim_; 00055 uint nelm_; 00057 concepts::Mesh1& msh_; 00059 concepts::Joiner<linearFEM::Line*, 1>* elm_; 00070 concepts::ElementPairList<Real> elmPair_; 00080 void constructor_(concepts::Cell1& cell, uint level); 00081 00083 struct TwoElements { 00084 TwoElements() { elms[0] = 0; elms[1] = 0; } 00085 void addElm(const linearFEM::Line* elm, const uint idx) { 00086 conceptsAssert(elms[1] == 0, concepts::Assertion()); 00087 if (elms[0] == 0) { 00088 elms[0] = elm; 00089 idxs[0] = idx; 00090 } 00091 else { 00092 elms[1] = elm; 00093 idxs[1] = idx; 00094 } 00095 } 00096 const linearFEM::Line* elms[2]; 00097 uint idxs[2]; 00098 }; 00099 }; 00100 00101 } // namespace linDG1D 00102 00103 #endif // linDG1Dspace_hh