dune-localfunctions  2.2.0
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/geometry/type.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 
00023   template<class D, class R, int dim>
00024   class Q1LocalFiniteElement
00025   {
00026   public:
00029       typedef LocalFiniteElementTraits<Q1LocalBasis<D,R,dim>,Q1LocalCoefficients<dim>,
00030           Q1LocalInterpolation<dim,Q1LocalBasis<D,R,dim> > > Traits;
00031 
00034         Q1LocalFiniteElement ()
00035         {
00036           gt.makeCube(dim);
00037         }
00038 
00041         const typename Traits::LocalBasisType& localBasis () const
00042         {
00043           return basis;
00044         }
00045         
00048         const typename Traits::LocalCoefficientsType& localCoefficients () const
00049         {
00050           return coefficients;
00051         }
00052         
00055         const typename Traits::LocalInterpolationType& localInterpolation () const
00056         {
00057           return interpolation;
00058         }
00059         
00062         GeometryType type () const
00063         {
00064           return gt;
00065         }
00066 
00067     Q1LocalFiniteElement* clone () const
00068     {
00069       return new Q1LocalFiniteElement(*this);
00070     }
00071 
00072   private:
00073         Q1LocalBasis<D,R,dim> basis;
00074         Q1LocalCoefficients<dim> coefficients;
00075         Q1LocalInterpolation<dim,Q1LocalBasis<D,R,dim> > interpolation;
00076         GeometryType gt;
00077   };
00078 
00080 
00085   template<class Geometry, class RF>
00086   class Q1FiniteElementFactory :
00087     public ScalarLocalToGlobalFiniteElementAdaptorFactory<
00088       Q1LocalFiniteElement<
00089         typename Geometry::ctype, RF, Geometry::mydimension
00090         >,
00091       Geometry
00092       >
00093   {
00094     typedef Q1LocalFiniteElement<
00095       typename Geometry::ctype, RF, Geometry::mydimension
00096       > LFE;
00097     typedef ScalarLocalToGlobalFiniteElementAdaptorFactory<LFE, Geometry> Base;
00098 
00099     static const LFE lfe;
00100 
00101   public:
00103     Q1FiniteElementFactory() : Base(lfe) {}
00104   };
00105 
00106   template<class Geometry, class RF>
00107   const typename Q1FiniteElementFactory<Geometry, RF>::LFE
00108   Q1FiniteElementFactory<Geometry, RF>::lfe;
00109 }
00110 
00111 #endif