Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)

linDG2D/elementPair.hh
Go to the documentation of this file.
00001 // element pair for linear DG FEM in 2D
00002 
00003 #ifndef elementPairDG2D_hh
00004 #define elementPairDG2D_hh
00005 
00006 #include "space/elementPairs.hh"
00007 #include "edgeInfo.hh"
00008 
00009 // debugging
00010 #include "basics/debug.hh"
00011 
00012 #define DGElementPair2dConstr_D 0
00013 
00014 namespace linDG2D {
00015 
00016   using concepts::Real;
00017 
00018   // *********************************************************** ElementPair **
00019 
00024   class ElementPair : public concepts::ElementPair<Real> {
00025   public:
00031     ElementPair(const Triangle& elm1, const Triangle& elm2, 
00032                 const EdgeInfo& edgeInfo) : 
00033       elm1_(elm1), elm2_(elm2), edgeInfo_(edgeInfo) {
00034       DEBUGL(DGElementPair2dConstr_D, elm1 << ", " << elm2);
00035       idxs_[0] = &(elm1.cell()) == edgeInfo.cell(0) ? 
00036         edgeInfo.idx(0) : edgeInfo.idx(1);
00037       idxs_[1] = &(elm2.cell()) == edgeInfo.cell(0) ? 
00038         edgeInfo.idx(0) : edgeInfo.idx(1);
00039     }
00041     virtual const Triangle& elm1() const { return elm1_; }
00043     virtual const Triangle& elm2() const { return elm2_; }
00045     const EdgeInfo& edgeInfo() const { return edgeInfo_; }
00052     Real shapeFct(uint e, uint i, Real xi) const {
00053       const Triangle& elm = e == 0 ? elm1_ : elm2_;
00054       Real xim = &(elm.cell()) == edgeInfo_.cell(0) ? xi : 1.0 - xi;
00055       switch(idxs_[e]) {
00056       case 0: return elm.shapeFct(i, xim, 0.0);
00057       case 1: return elm.shapeFct(i, 1.0, xim);
00058       case 2: return elm.shapeFct(i, 1.0-xim, 1.0-xim);
00059       default: conceptsAssert(false, concepts::Assertion()); return 0.0;
00060       }
00061     }
00062   private:
00063     const Triangle& elm1_;
00064     const Triangle& elm2_;
00065     const EdgeInfo& edgeInfo_;
00066     uint idxs_[2];
00067   };
00068 
00069 }
00070 
00071 #endif // elementPairDG2D_hh

Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)