dune-localfunctions  2.1.1
q1.hh
Go to the documentation of this file.
00001 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
00002 // vi: set et ts=4 sw=2 sts=2:
00003 
00004 #ifndef DUNE_Q1_LOCALFINITEELEMENT_HH
00005 #define DUNE_Q1_LOCALFINITEELEMENT_HH
00006 
00007 #include <dune/common/geometrytype.hh>
00008 
00009 #include <dune/localfunctions/common/localfiniteelementtraits.hh>
00010 #include <dune/localfunctions/common/localtoglobaladaptors.hh>
00011 #include <dune/localfunctions/lagrange/q1/q1localbasis.hh>
00012 #include <dune/localfunctions/lagrange/q1/q1localcoefficients.hh>
00013 #include <dune/localfunctions/lagrange/q1/q1localinterpolation.hh>
00014 
00015 namespace Dune 
00016 {
00017 
00020   template<class D, class R, int dim>
00021   class Q1LocalFiniteElement
00022   {
00023   public:
00026       typedef LocalFiniteElementTraits<Q1LocalBasis<D,R,dim>,Q1LocalCoefficients<dim>,
00027           Q1LocalInterpolation<dim,Q1LocalBasis<D,R,dim> > > Traits;
00028 
00031         Q1LocalFiniteElement ()
00032         {
00033           gt.makeCube(dim);
00034         }
00035 
00038         const typename Traits::LocalBasisType& localBasis () const
00039         {
00040           return basis;
00041         }
00042         
00045         const typename Traits::LocalCoefficientsType& localCoefficients () const
00046         {
00047           return coefficients;
00048         }
00049         
00052         const typename Traits::LocalInterpolationType& localInterpolation () const
00053         {
00054           return interpolation;
00055         }
00056         
00059         GeometryType type () const
00060         {
00061           return gt;
00062         }
00063 
00064     Q1LocalFiniteElement* clone () const
00065     {
00066       return new Q1LocalFiniteElement(*this);
00067     }
00068 
00069   private:
00070         Q1LocalBasis<D,R,dim> basis;
00071         Q1LocalCoefficients<dim> coefficients;
00072         Q1LocalInterpolation<dim,Q1LocalBasis<D,R,dim> > interpolation;
00073         GeometryType gt;
00074   };
00075 
00077 
00082   template<class Geometry, class RF>
00083   class Q1FiniteElementFactory :
00084     public ScalarLocalToGlobalFiniteElementAdaptorFactory<
00085       Q1LocalFiniteElement<
00086         typename Geometry::ctype, RF, Geometry::mydimension
00087         >,
00088       Geometry
00089       >
00090   {
00091     typedef Q1LocalFiniteElement<
00092       typename Geometry::ctype, RF, Geometry::mydimension
00093       > LFE;
00094     typedef ScalarLocalToGlobalFiniteElementAdaptorFactory<LFE, Geometry> Base;
00095 
00096     static const LFE lfe;
00097 
00098   public:
00100     Q1FiniteElementFactory() : Base(lfe) {}
00101   };
00102 
00103   template<class Geometry, class RF>
00104   const typename Q1FiniteElementFactory<Geometry, RF>::LFE
00105   Q1FiniteElementFactory<Geometry, RF>::lfe;
00106 }
00107 
00108 #endif