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

hp1D/element.hh
Go to the documentation of this file.
00001 /* abstract base class for hp elements in 1D
00002  */
00003 
00004 #ifndef Element1D_h
00005 #define Element1D_h 
00006 
00007 #include "basics/typedefs.hh"
00008 #include "basics/vectorsMatrices.hh"
00009 #include "geometry/connector.hh"
00010 #include "geometry/cell1D.hh"
00011 #include "geometry/integral.hh"
00012 #include "space/element.hh"
00013 #include "space/tmatrix.hh"
00014 #include "integration/quadRule.hh"
00015 #include "integration/karniadakis.hh"
00016 #include "lineGraphics.hh"
00017 
00018 
00019 namespace hp1D {
00020   using concepts::Real;
00021 
00022   // ********************************************************* IntegrableElm **
00023 
00026   class IntegrableElm : public concepts::IntegrationCell {
00027   public:
00028     IntegrableElm(const concepts::EdgeNd& cell);
00029 
00032     const concepts::Real3d chi(const Real x) const { return cell_.elemMap(x); }
00033 
00035     inline Real jacobianDeterminant(const Real x) const {
00036       // factor comes due to integration over [-1,1]^2
00037       return cell_.jacobianDeterminant(x) * 0.5; 
00038     }
00039 
00041     const concepts::QuadratureRule* integration() const { 
00042       return int_.get();
00043     }
00044 
00052     static concepts::QuadRuleFactory& rule() { return rule_; }
00053 
00054     virtual bool quadraturePoint(uint i, intPoint& p,
00055                                  intFormType form = ZERO,
00056                                  bool localCoord = false) const;
00057   protected:
00059     const concepts::EdgeNd& cell_;
00061     std::auto_ptr<concepts::QuadratureRule> int_;
00062     // Factory for the integration rule
00063     static concepts::QuadRuleFactory rule_;
00064   };
00065 
00066   // *************************************************************** Element **
00067 
00071   template<class F>
00072   class Element : public concepts::ElementWithCell<F>, public IntegrableElm {
00073   public:
00080     Element(const concepts::EdgeNd& cell, uint p,
00081             concepts::TColumn<F>* T0, concepts::TColumn<F>* T1);
00082     virtual ~Element();
00083 
00084     virtual const concepts::Edge& support() const {
00085       return cell_.connector(); }
00086     virtual concepts::Real3d vertex(uint i) const;
00087     virtual const concepts::EdgeNd& cell() const { return cell_; }
00088 
00089     virtual const concepts::TMatrix<F>& T() const { return T_; }
00091     void appendT(concepts::TColumn<F>* T) { T_.append(T); }
00092 
00094     ushort p() const { return p_; }
00095 
00099     void recomputeShapefunctions();
00100 
00102     const concepts::Karniadakis<1,0>* shpfct() const { return shpfct_.get(); }
00104     const concepts::Karniadakis<1,1>* shpfctD() const {
00105       return shpfctD_.get(); }
00106 
00107     virtual const concepts::ElementGraphics<Real>* graphics() const;
00108   protected:
00109     virtual std::ostream& info(std::ostream& os) const;
00110 
00112     concepts::TMatrix<Real> T_;
00113   private:
00115     std::auto_ptr<concepts::Karniadakis<1,0> > shpfct_;
00117     std::auto_ptr<concepts::Karniadakis<1,1> > shpfctD_;
00118 
00120     ushort p_;
00121     static std::auto_ptr<LineGraphics> graphics_;
00122   };
00123 
00124 } // namespace hp1D
00125 
00126 namespace concepts {
00127 
00128   // ****************************************************************** Scan **
00129 
00131 
00132   template<class F>
00133   class Scan<hp1D::Element<F> > : public Scan<ElementWithCell<F> > {
00134   public:  
00135     hp1D::Element<F>& operator++(int) = 0;
00136   };
00137 
00138 } // namespace concepts
00139 
00140 
00141 #endif // Element1D_h

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