dune-localfunctions
2.1.1
|
00001 // -*- tab-width: 8; indent-tabs-mode: nil -*- 00002 // vi: set ts=s sw=2 et sts=2: 00003 #ifndef DUNE_REFINED_P1_LOCALFINITEELEMENT_HH 00004 #define DUNE_REFINED_P1_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 <dune/localfunctions/refined/refinedp1/refinedp1localbasis.hh> 00012 #include <dune/localfunctions/lagrange/pk2d/pk2dlocalcoefficients.hh> 00013 #include <dune/localfunctions/lagrange/pk2d/pk2dlocalinterpolation.hh> 00014 #include <dune/localfunctions/lagrange/pk2d/pk2dlocalbasis.hh> 00015 #include <dune/localfunctions/lagrange/pk3d/pk3dlocalcoefficients.hh> 00016 #include <dune/localfunctions/lagrange/pk3d/pk3dlocalinterpolation.hh> 00017 #include <dune/localfunctions/lagrange/pk3d/pk3dlocalbasis.hh> 00018 00019 namespace Dune 00020 { 00021 00024 template<class D, class R, int dim> 00025 class RefinedP1LocalFiniteElement 00026 { 00027 RefinedP1LocalFiniteElement() {} 00028 00029 public: 00030 // We steal the p0 traits since they exist for all dim. 00031 // This allows to instanciate the type and access the Traits. 00032 typedef typename P0LocalFiniteElement<D,R,dim>::Traits Traits; 00033 }; 00034 00037 template<class D, class R> 00038 class RefinedP1LocalFiniteElement<D,R,2> 00039 { 00040 public: 00043 typedef LocalFiniteElementTraits<RefinedP1LocalBasis<D,R,2>, 00044 Pk2DLocalCoefficients<2>, 00045 Pk2DLocalInterpolation<Pk2DLocalBasis<D,R,2> > > Traits; 00046 00049 RefinedP1LocalFiniteElement () 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 RefinedP1LocalFiniteElement * clone () const 00083 { 00084 return new RefinedP1LocalFiniteElement(*this); 00085 } 00086 00087 private: 00088 RefinedP1LocalBasis<D,R,2> basis; 00089 Pk2DLocalCoefficients<2> coefficients; 00090 Pk2DLocalInterpolation<Pk2DLocalBasis<D,R,2> > interpolation; 00091 GeometryType gt; 00092 }; 00093 00096 template<class D, class R> 00097 class RefinedP1LocalFiniteElement<D,R,3> 00098 { 00099 public: 00102 typedef LocalFiniteElementTraits<RefinedP1LocalBasis<D,R,3>, 00103 Pk3DLocalCoefficients<2>, 00104 Pk3DLocalInterpolation<Pk3DLocalBasis<D,R,2> > > Traits; 00105 00108 RefinedP1LocalFiniteElement () 00109 { 00110 gt.makeTetrahedron(); 00111 } 00112 00115 const typename Traits::LocalBasisType& localBasis () const 00116 { 00117 return basis; 00118 } 00119 00122 const typename Traits::LocalCoefficientsType& localCoefficients () const 00123 { 00124 return coefficients; 00125 } 00126 00129 const typename Traits::LocalInterpolationType& localInterpolation () const 00130 { 00131 return interpolation; 00132 } 00133 00136 GeometryType type () const 00137 { 00138 return gt; 00139 } 00140 00141 RefinedP1LocalFiniteElement* clone () const 00142 { 00143 return new RefinedP1LocalFiniteElement(*this); 00144 } 00145 00146 private: 00147 RefinedP1LocalBasis<D,R,3> basis; 00148 Pk3DLocalCoefficients<2> coefficients; 00149 Pk3DLocalInterpolation<Pk3DLocalBasis<D,R,2> > interpolation; 00150 GeometryType gt; 00151 }; 00152 00153 } 00154 00155 #endif