refinedp0localinterpolation.hh

Go to the documentation of this file.
00001 // -*- tab-width: 8; indent-tabs-mode: nil -*-
00002 // vi: set ts=8 sw=2 et sts=2:
00003 #ifndef DUNE_REFINED_P0_LOCALINTERPOLATION_HH
00004 #define DUNE_REFINED_P0_LOCALINTERPOLATION_HH
00005 
00006 #include <dune/localfunctions/refined/refinedp0/refinedp0localbasis.hh>
00007 
00008 namespace Dune 
00009 {
00010   template<class LB>
00011   class RefinedP0LocalInterpolation 
00012   {};
00013 
00014   template<class D, class R>
00015   class RefinedP0LocalInterpolation<RefinedP0LocalBasis<D,R,2> >
00016   {
00017     typedef RefinedP0LocalBasis<D,R,2> LB;
00018     typedef typename LB::Traits::DomainType DT;
00019 
00020   public:
00021     RefinedP0LocalInterpolation() :
00022       interpolationPoints_(4)
00023     {
00024       // Interpolation is done by evaluating at the subtriangle centers
00025       interpolationPoints_[0][0] = 1.0/6;
00026       interpolationPoints_[0][1] = 1.0/6;
00027 
00028       interpolationPoints_[1][0] = 4.0/6;
00029       interpolationPoints_[1][1] = 1.0/6;
00030 
00031       interpolationPoints_[2][0] = 1.0/6;
00032       interpolationPoints_[2][1] = 4.0/6;
00033 
00034       interpolationPoints_[3][0] = 2.0/6;
00035       interpolationPoints_[3][1] = 2.0/6;
00036     }
00037 
00038 
00039     template<typename F, typename C>
00040     void interpolate (const F& f, std::vector<C>& out) const
00041     {
00042       typename LB::Traits::RangeType y;
00043       out.resize(4);
00044       for (int i = 0; i < 4; ++i) 
00045       {
00046         f.evaluate(interpolationPoints_[i], y);
00047         out[i] = y;
00048       }
00049     }
00050 
00051   private:
00052     std::vector<DT> interpolationPoints_;
00053   };
00054 }
00055 
00056 #endif
Generated on Sat Apr 24 11:15:35 2010 for dune-localfunctions by  doxygen 1.6.3