refinedp0.hh

Go to the documentation of this file.
00001 // -*- tab-width: 8; indent-tabs-mode: nil -*-
00002 // vi: set ts=8 sw=2 et sts=2:
00003 #ifndef DUNE_REFINED_P0_LOCALFINITEELEMENT_HH
00004 #define DUNE_REFINED_P0_LOCALFINITEELEMENT_HH
00005 
00006 #include <dune/common/geometrytype.hh>
00007 
00008 #include <dune/localfunctions/common/localfiniteelementtraits.hh>
00009 #include <dune/localfunctions/lagrange/p0.hh>
00010 
00011 #include "refinedp0/refinedp0localbasis.hh"
00012 #include "refinedp0/refinedp0localcoefficients.hh"
00013 #include "refinedp0/refinedp0localinterpolation.hh"
00014 
00018 namespace Dune
00019 {
00020 
00023   template<class D, class R, int dim>
00024   class RefinedP0LocalFiniteElement
00025   {
00026     RefinedP0LocalFiniteElement() {}
00027 
00028   public:
00029       // We steal the p0 traits since they exist for all dim.
00030       // This allows to instantiate the type and access the Traits.
00031       typedef typename P0LocalFiniteElement<D,R,dim>::Traits Traits;
00032   };
00033 
00036   template<class D, class R>
00037   class RefinedP0LocalFiniteElement<D,R,2>
00038   {
00039   public:
00042     typedef LocalFiniteElementTraits<
00043       RefinedP0LocalBasis<D,R,2>,
00044       RefinedP0LocalCoefficients<2>,
00045       RefinedP0LocalInterpolation<RefinedP0LocalBasis<D,R,2> > > Traits;
00046 
00049     RefinedP0LocalFiniteElement ()
00050     {
00051       gt.makeTriangle();
00052     }
00053 
00056     const typename Traits::LocalBasisType& localBasis () const
00057     {
00058       return basis_;
00059     }
00060 
00063     const typename Traits::LocalCoefficientsType& localCoefficients () const
00064     {
00065       return coefficients_;
00066     }
00067 
00070     const typename Traits::LocalInterpolationType& localInterpolation () const
00071     {
00072       return interpolation_;
00073     }
00074 
00077     GeometryType type () const
00078     {
00079       return gt;
00080     }
00081 
00082     RefinedP0LocalFiniteElement * clone () const
00083     {
00084       return new RefinedP0LocalFiniteElement(*this);
00085     }
00086 
00087   private:
00088     RefinedP0LocalBasis<D,R,2> basis_;
00089     RefinedP0LocalCoefficients<2> coefficients_;
00090     RefinedP0LocalInterpolation<RefinedP0LocalBasis<D,R,2> > interpolation_;
00091     GeometryType gt;
00092   };
00093 
00096   template<class D, class R>
00097   class RefinedP0LocalFiniteElement<D,R,3>
00098   {
00099   public:
00102     typedef LocalFiniteElementTraits<
00103       RefinedP0LocalBasis<D,R,3>,
00104       RefinedP0LocalCoefficients<3>,
00105       RefinedP0LocalInterpolation<RefinedP0LocalBasis<D,R,3> > > Traits;
00106 
00109     RefinedP0LocalFiniteElement ()
00110     {
00111       gt.makeTetrahedron();
00112     }
00113 
00116     const typename Traits::LocalBasisType& localBasis () const
00117     {
00118       return basis_;
00119     }
00120 
00123     const typename Traits::LocalCoefficientsType& localCoefficients () const
00124     {
00125       return coefficients_;
00126     }
00127 
00130     const typename Traits::LocalInterpolationType& localInterpolation () const
00131     {
00132       return interpolation_;
00133     }
00134 
00137     GeometryType type () const
00138     {
00139       return gt;
00140     }
00141 
00142     RefinedP0LocalFiniteElement * clone () const
00143     {
00144       return new RefinedP0LocalFiniteElement(*this);
00145     }
00146 
00147   private:
00148     RefinedP0LocalBasis<D,R,3> basis_;
00149     RefinedP0LocalCoefficients<3> coefficients_;
00150     RefinedP0LocalInterpolation<RefinedP0LocalBasis<D,R,3> > interpolation_;
00151     GeometryType gt;
00152   };
00153 
00154 
00155 }
00156 
00157 #endif

Generated on Fri Apr 29 2011 with Doxygen (ver 1.7.1) [doxygen-log,error-log].