- Home
- About DUNE
- Download
- Documentation
- Community
- Development
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_P1_LOCALINTERPOLATION_HH 00004 #define DUNE_P1_LOCALINTERPOLATION_HH 00005 00006 #include <vector> 00007 00008 namespace Dune 00009 { 00010 template<int dim, class LB> 00011 class P1LocalInterpolation 00012 { 00013 public: 00015 template<typename F, typename C> 00016 void interpolate (const F& f, std::vector<C>& out) const 00017 { 00018 typename LB::Traits::RangeType y; 00019 typename LB::Traits::DomainType x; 00020 00021 out.resize(dim+1); 00022 00023 // vertex 0 00024 for (int i=0; i<dim; i++) 00025 x[i] = 0; 00026 f.evaluate(x,y); out[0] = y; 00027 00028 // remaining vertices 00029 for (int i=0; i<dim; i++) { 00030 for (int j=0; j<dim; j++) 00031 x[j] = (i==j); 00032 00033 f.evaluate(x,y); out[i+1] = y; 00034 00035 } 00036 00037 } 00038 00039 }; 00040 } 00041 00042 #endif
Generated on Fri Apr 29 2011 with Doxygen (ver 1.7.1) [doxygen-log,error-log].