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

linearFEM/element2D.hh
Go to the documentation of this file.
00001 // elements for linear FEM in 2D
00002 
00003 #ifndef element2DLin_hh
00004 #define element2DLin_hh
00005 
00006 #include "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 linearFEM {
00016   // forward declaration
00017   class TriangleGraphics;
00018   class QuadGraphics;
00019 
00020   // ************************************************************** Triangle **
00021 
00026   class Triangle : public Element {
00027   public:
00033     Triangle(const concepts::Triangle2d& cell, uint idx[]) :
00034       Element(3, idx), cell_(cell) {}
00041     Triangle(const concepts::Triangle2d& cell, concepts::TColumn<Real>* T0,
00042        concepts::TColumn<Real>* T1 = 0) :
00043       Element(T0, T1), cell_(cell) {}
00044     virtual const concepts::Triangle& support() const {
00045       return cell_.connector(); }
00046     virtual const concepts::Triangle2d& cell() const { return cell_; }
00054     Real shapefct(const uint i, const Real xi1, const Real xi2) const;
00060     concepts::Real2d shapefctD(const uint i) const;
00061     virtual const concepts::ElementGraphics<Real>* graphics() const;
00062   protected:
00063     virtual std::ostream& info(std::ostream& os) const;
00064   private:
00066     const concepts::Triangle2d& cell_;
00067     static std::auto_ptr<TriangleGraphics> graphics_;
00068   };
00069 
00070   // ****************************************************************** Quad **
00071 
00076   class Quad : public Element {
00077   public:
00083     Quad(const concepts::Quad2d& cell, uint idx[]) :
00084       Element(4, idx), cell_(cell) {}
00091     Quad(const concepts::Quad2d& cell, concepts::TColumn<Real>* T0,
00092    concepts::TColumn<Real>* T1 = 0) : Element(T0, T1), cell_(cell) {}
00093     virtual const concepts::Quad& support() const { return cell_.connector(); }
00094     virtual const concepts::Quad2d& cell() const { return cell_; }
00105     void evaluate(Real* res, const Real* x, const uint n) const;
00116     void evaluateD(concepts::Real2d* res, const Real* x, const uint n) const;
00117     virtual const concepts::ElementGraphics<Real>* graphics() const;
00118   protected:
00119     virtual std::ostream& info(std::ostream& os) const;
00120   private:
00122     const concepts::Quad2d& cell_;
00123     static std::auto_ptr<QuadGraphics> graphics_;
00124   };
00125 
00126 } // namespace linearFEM
00127 
00128 #endif // element2DLin_hh

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