dune-localfunctions
2.2.0
|
00001 // -*- tab-width: 8; indent-tabs-mode: nil -*- 00002 // vi: set ts=8 sw=2 et sts=2: 00003 #ifndef DUNE_PQ22DLOCALFINITEELEMENT_HH 00004 #define DUNE_PQ22DLOCALFINITEELEMENT_HH 00005 00006 #include <dune/common/fmatrix.hh> 00007 00008 #include <dune/localfunctions/common/virtualinterface.hh> 00009 #include <dune/localfunctions/common/virtualwrappers.hh> 00010 #include "q22d.hh" 00011 #include "pk2d.hh" 00012 00013 namespace Dune 00014 { 00015 template<class D, class R> 00016 class PQ22DLocalFiniteElement 00017 { 00018 typedef Dune::FieldVector<D,2> Domain; 00019 typedef Dune::FieldVector<R,1> Range; 00020 typedef LocalBasisTraits<D,2,Domain, R,1,Range, Dune::FieldMatrix<R,1,2>, 0 > BasisTraits; 00021 00022 typedef typename Dune::LocalFiniteElementVirtualInterface<BasisTraits> LocalFiniteElementBase; 00023 public: 00024 typedef LocalFiniteElementTraits< 00025 LocalBasisVirtualInterface<BasisTraits>, 00026 LocalCoefficientsVirtualInterface, 00027 LocalInterpolationVirtualInterface< Domain, Range > 00028 > Traits; 00029 typedef typename Traits::LocalBasisType LocalBasis; 00030 typedef typename Traits::LocalCoefficientsType LocalCoefficients; 00031 typedef typename Traits::LocalInterpolationType LocalInterpolation; 00032 00033 PQ22DLocalFiniteElement ( const GeometryType > ) 00034 : gt_(gt) 00035 { 00036 if ( gt.isTriangle() ) 00037 setup( Pk2DLocalFiniteElement<D,R,2>() ); 00038 else if ( gt.isQuadrilateral() ) 00039 setup( Q22DLocalFiniteElement<D,R>() ); 00040 } 00041 00042 PQ22DLocalFiniteElement ( const GeometryType >, const std::vector<unsigned int> vertexmap ) 00043 : gt_(gt) 00044 { 00045 if ( gt.isTriangle() ) 00046 setup( Pk2DLocalFiniteElement<D,R,2>(vertexmap) ); 00047 else if ( gt.isQuadrilateral() ) 00048 setup( Q22DLocalFiniteElement<D,R>() ); 00049 } 00050 00051 PQ22DLocalFiniteElement ( const PQ22DLocalFiniteElement<D, R>& other ) 00052 : gt_(other.gt_) 00053 { 00054 fe_ = other.fe_->clone(); 00055 } 00056 00057 ~PQ22DLocalFiniteElement ( ) 00058 { 00059 delete fe_; 00060 } 00061 00062 const LocalBasis& localBasis () const 00063 { 00064 return fe_->localBasis(); 00065 } 00066 00067 const LocalCoefficients& localCoefficients () const 00068 { 00069 return fe_->localCoefficients(); 00070 } 00071 00072 const LocalInterpolation& localInterpolation () const 00073 { 00074 return fe_->localInterpolation(); 00075 } 00076 00077 const GeometryType &type () const 00078 { 00079 return gt_; 00080 } 00081 00082 private: 00083 00084 template <class FE> 00085 void setup(const FE& fe) 00086 { 00087 fe_ = new LocalFiniteElementVirtualImp<FE>(fe); 00088 } 00089 00090 const GeometryType gt_; 00091 const LocalFiniteElementBase *fe_; 00092 }; 00093 00094 } 00095 00096 #endif