p0localinterpolation.hh
Go to the documentation of this file.00001
00002
00003 #ifndef DUNE_P0LOCALINTERPOLATION_HH
00004 #define DUNE_P0LOCALINTERPOLATION_HH
00005
00006 #include <vector>
00007 #include <dune/grid/common/genericreferenceelements.hh>
00008
00009
00010 namespace Dune
00011 {
00012
00013 template<class LB>
00014 class P0LocalInterpolation
00015 {
00016 public:
00017 P0LocalInterpolation (GeometryType::BasicType basicType, int d) : gt(basicType,d)
00018 {}
00019
00021 template<typename F, typename C>
00022 void interpolate (const F& f, std::vector<C>& out) const
00023 {
00024 typedef typename LB::Traits::DomainType DomainType;
00025 typedef typename LB::Traits::RangeType RangeType;
00026 typedef typename LB::Traits::DomainFieldType DF;
00027 const int dim=LB::Traits::dimDomain;
00028
00029 DomainType x = Dune::GenericReferenceElements<DF,dim>::general(gt).position(0,0);
00030 RangeType y;
00031
00032 out.resize(1);
00033 f.evaluate(x,y); out[0] = y;
00034 }
00035
00036 private:
00037 GeometryType gt;
00038 };
00039
00040 }
00041
00042 #endif