pk2dlocalinterpolation.hh
Go to the documentation of this file.00001
00002
00003 #ifndef DUNE_Pk2DLOCALINTERPOLATION_HH
00004 #define DUNE_Pk2DLOCALINTERPOLATION_HH
00005
00006 #include <vector>
00007
00008 namespace Dune
00009 {
00010 template<class LB>
00011 class Pk2DLocalInterpolation
00012 {
00014 enum {N = LB::N};
00015
00017 enum {k = LB::O};
00018
00019 private:
00020 static const int kdiv = (k == 0? 1 : k);
00021
00022 public:
00023
00024 template<typename F, typename C>
00025 void interpolate (const F& f, std::vector<C>& out) const
00026 {
00027 typename LB::Traits::DomainType x;
00028 typename LB::Traits::RangeType y;
00029 typedef typename LB::Traits::DomainFieldType D;
00030 out.resize(N);
00031 int n=0;
00032 for (int j=0; j<=k; j++)
00033 for (int i=0; i<=k-j; i++)
00034 {
00035 x[0] = ((D)i)/((D)kdiv); x[1] = ((D)j)/((D)kdiv);
00036 f.evaluate(x,y);
00037 out[n] = y;
00038 n++;
00039 }
00040 }
00041
00042 };
00043 }
00044
00045 #endif