dune-localfunctions
2.2.0
|
00001 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- 00002 // vi: set ts=4 sw=2 et sts=2: 00003 #ifndef DUNE_Pk1DLOCALINTERPOLATION_HH 00004 #define DUNE_Pk1DLOCALINTERPOLATION_HH 00005 00006 #include <vector> 00007 00008 namespace Dune 00009 { 00010 template<class LB> 00011 class Pk1DLocalInterpolation 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 #if DUNE_COMMON_FIELDVECTOR_SIZE_IS_METHOD 00032 assert(x.size()==1); 00033 #endif 00034 for (int i=0; i<N; i++) 00035 { 00036 x[0] = ((D)i)/((D)kdiv); 00037 f.evaluate(x,y); 00038 out[i] = y; 00039 } 00040 } 00041 00042 }; 00043 } 00044 00045 #endif