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_REFINED_P0_LOCALBASIS_HH 00004 #define DUNE_REFINED_P0_LOCALBASIS_HH 00005 00006 #include <dune/common/fvector.hh> 00007 #include <dune/common/fmatrix.hh> 00008 00009 #include <dune/localfunctions/common/localbasis.hh> 00010 #include <dune/localfunctions/refined/common/refinedsimplexlocalbasis.hh> 00011 00012 namespace Dune 00013 { 00014 00033 template<class D, class R, int dim> 00034 class RefinedP0LocalBasis 00035 : public RefinedSimplexLocalBasis<D,dim> 00036 { 00037 // 2 to the k-th power 00038 enum {N = 1<<dim}; 00039 public: 00041 typedef LocalBasisTraits<D,dim,Dune::FieldVector<D,dim>,R,1,Dune::FieldVector<R,1>, Dune::FieldMatrix<R,1,dim> > Traits; 00042 00044 unsigned int size () const 00045 { 00046 return N; 00047 } 00048 00050 inline void evaluateFunction (const typename Traits::DomainType& in, 00051 std::vector<typename Traits::RangeType>& out) const 00052 { 00053 int subElement = this->getSubElement(in); 00054 out.resize(N); 00055 for(int i=0; i<N; ++i) 00056 out[i] = (i==subElement)? 1 : 0; 00057 } 00058 00059 inline void 00060 evaluateJacobian (const typename Traits::DomainType& in, // position 00061 std::vector<typename Traits::JacobianType>& out) const // return value 00062 { 00063 out.resize(N); 00064 for(int i=0; i<N; ++i) 00065 out[i][0] = 0; 00066 } 00067 00072 unsigned int order () const 00073 { 00074 return 0; 00075 } 00076 00077 }; 00078 00079 } 00080 #endif