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