dune-localfunctions  2.2.0
pyramidp2localinterpolation.hh
Go to the documentation of this file.
00001 // -*- tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
00002 // vi: set et ts=2 sw=2 sts=2:
00003 #ifndef DUNE_PYRAMID_P2_LOCALINTERPOLATION_HH
00004 #define DUNE_PYRAMID_P2_LOCALINTERPOLATION_HH
00005 
00006 #include <vector>
00007 
00008 namespace Dune 
00009 {
00010   template<class LB>
00011   class PyramidP2LocalInterpolation
00012   {
00013   public:
00014     
00016     template<typename F, typename C>
00017     void interpolate (const F& f, std::vector<C>& out) const
00018     {
00019       typename LB::Traits::RangeType y;
00020       
00021       out.resize(14);
00022       typename LB::Traits::DomainType x;
00023       
00024       x[0] = 0.0;   x[1] = 0.0;   x[2] = 0.0;
00025       f.evaluate(x,y); out[0] = y;
00026       
00027       x[0] = 1.0;   x[1] = 0.0;   x[2] = 0.0;
00028       f.evaluate(x,y); out[1] = y;
00029       
00030       x[0] = 0.0;   x[1] = 1.0;   x[2] = 0.0;
00031       f.evaluate(x,y); out[2] = y;
00032       
00033       x[0] = 1.0;   x[1] = 1.0;   x[2] = 0.0;
00034       f.evaluate(x,y); out[3] = y;
00035       
00036       x[0] = 0.0;   x[1] = 0.0;   x[2] = 1.0;
00037       f.evaluate(x,y); out[4] = y;
00038       
00039       x[0] = 0.0;   x[1] = 0.5;   x[2] = 0.0;
00040       f.evaluate(x,y); out[5] = y;                        
00041       
00042       x[0] = 1.0;   x[1] = 0.5;   x[2] = 0.0;
00043       f.evaluate(x,y); out[6] = y;
00044       
00045       x[0] = 0.5;   x[1] = 0.0;   x[2] = 0.0;
00046       f.evaluate(x,y); out[7] = y;
00047       
00048       x[0] = 0.5;   x[1] = 1.0;   x[2] = 0.0;
00049       f.evaluate(x,y); out[8] = y;
00050       
00051       x[0] = 0.0;   x[1] = 0.0;   x[2] = 0.5;
00052       f.evaluate(x,y); out[9] = y;
00053       
00054       x[0] = 0.5;   x[1] = 0.0;   x[2] = 0.5;
00055       f.evaluate(x,y); out[10] = y;
00056       
00057       x[0] = 0.0;   x[1] = 0.5;   x[2] = 0.5;
00058       f.evaluate(x,y); out[11] = y;
00059       
00060       x[0] = 0.5;   x[1] = 0.5;   x[2] = 0.5;
00061       f.evaluate(x,y); out[12] = y;
00062       
00063       x[0] = 0.5;   x[1] = 0.5;   x[2] = 0.0;
00064       f.evaluate(x,y); out[13] = y;
00065     }
00066     
00067   };
00068 }
00069 
00070 #endif