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

linDG2D/triangle.hh
Go to the documentation of this file.
00001 // triangle element for linear DGFEM
00002 
00003 #ifndef DGTriangle_hh
00004 #define DGTriangle_hh
00005 
00006 #include "linearFEM/element.hh"
00007 #include "geometry/cell2D.hh"
00008 
00009 namespace concepts {
00010   // forward declaration
00011   template<typename F>
00012   class ElementGraphics;
00013 }
00014 
00015 namespace linDG2D {
00016 
00017   // forward declaration
00018   class TriangleGraphics;
00019 
00020   using concepts::Real;
00021 
00022   // ************************************************************** Triangle **
00023 
00027   class Triangle : public linearFEM::Element {
00028   public:
00035     Triangle(const concepts::Triangle2d& cell, uint nDoF, uint idx[])
00036       : linearFEM::Element(nDoF, idx), cell_(cell) {}
00038     virtual const concepts::Triangle& support() const {
00039       return cell_.connector();
00040     }
00042     virtual const concepts::Triangle2d& cell() const { return cell_; }
00050     virtual Real shapeFct(const uint i, const Real xi1, const Real xi2) const = 0;
00056     virtual Real solution(const concepts::Vector<Real>& coeffs,
00057                           const Real xi1, const Real xi2) const = 0;
00059     virtual const concepts::ElementGraphics<Real>* graphics() const;
00060   protected:
00061     virtual std::ostream& info(std::ostream& os) const;
00062   private:
00064     const concepts::Triangle2d& cell_;
00066     static std::auto_ptr<TriangleGraphics> graphics_;
00067   };
00068 
00069   // ************************************************************ TriangleP1 **
00070 
00074   class TriangleP1 : public Triangle {
00075   public:
00081     TriangleP1(const concepts::Triangle2d& cell, uint idx[])
00082       : Triangle(cell, 3, idx) {}
00090     virtual Real shapeFct(const uint i, const Real xi1, const Real xi2) const;
00096     concepts::Real2d shapeFctGradient(const uint i) const;
00102     virtual Real solution(const concepts::Vector<Real>& coeffs,
00103                           const Real xi1, const Real xi2) const;
00104   protected:
00105     virtual std::ostream& info(std::ostream& os) const;
00106   };
00107 
00108   // ************************************************************ TriangleP0 **
00109 
00113   class TriangleP0 : public Triangle {
00114   public:
00120     TriangleP0(const concepts::Triangle2d& cell, uint* idx)
00121       : Triangle(cell, 1, idx) {}
00129     virtual Real shapeFct(const uint i, const Real xi1, const Real xi2) const {
00130       return 1;
00131     }
00132     virtual Real solution(const concepts::Vector<Real>& coeffs,
00133                           const Real xi1, const Real xi2) const;
00134   protected:
00135     virtual std::ostream& info(std::ostream& os) const;
00136   };
00137 
00138 } // namespace linDG2D
00139 
00140 #endif // DGTriangle_hh
00141 

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