dune-localfunctions  2.1.1
prismp2localinterpolation.hh
Go to the documentation of this file.
00001 // -*- tab-width: 4; indent-tabs-mode: nil -*-
00002 #ifndef DUNE_PRISM_P2_LOCALINTERPOLATION_HH
00003 #define DUNE_PRISM_P2_LOCALINTERPOLATION_HH
00004 
00005 #include <vector>
00006 
00007 namespace Dune 
00008 {
00009     template<class LB>
00010   class PrismP2LocalInterpolation 
00011   {
00012   public:
00013 
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           
00020           out.resize(18);
00021       typename LB::Traits::DomainType x;
00022 
00023       x[0] = 0.0;   x[1] = 0.0;   x[2] = 0.0;
00024           f.evaluate(x,y); out[0] = y;
00025 
00026       x[0] = 1.0;   x[1] = 0.0;   x[2] = 0.0;
00027           f.evaluate(x,y); out[1] = y;
00028 
00029       x[0] = 0.0;   x[1] = 1.0;   x[2] = 0.0;
00030           f.evaluate(x,y); out[2] = y;
00031 
00032       x[0] = 0.0;   x[1] = 0.0;   x[2] = 1.0;
00033           f.evaluate(x,y); out[3] = y;
00034 
00035       x[0] = 1.0;   x[1] = 0.0;   x[2] = 1.0;
00036           f.evaluate(x,y); out[4] = y;
00037 
00038       x[0] = 0.0;   x[1] = 1.0;   x[2] = 1.0;
00039           f.evaluate(x,y); out[5] = y;                    
00040                   
00041       x[0] = 0.0;   x[1] = 0.0;   x[2] = 0.5;
00042           f.evaluate(x,y); out[6] = y;
00043 
00044       x[0] = 1.0;   x[1] = 0.0;   x[2] = 0.5;
00045           f.evaluate(x,y); out[7] = y;
00046 
00047       x[0] = 0;   x[1] = 1.0;   x[2] = 0.5;
00048           f.evaluate(x,y); out[8] = y;
00049 
00050       x[0] = 0.5;   x[1] = 0.0;   x[2] = 0.0;
00051           f.evaluate(x,y); out[9] = y;
00052 
00053       x[0] = 0.0;   x[1] = 0.5;   x[2] = 0.0;
00054           f.evaluate(x,y); out[10] = y;
00055 
00056       x[0] = 0.5;   x[1] = 0.5;   x[2] = 0.0;
00057           f.evaluate(x,y); out[11] = y;
00058 
00059           x[0] = 0.5;   x[1] = 0.0;   x[2] = 1.0;
00060           f.evaluate(x,y); out[12] = y;
00061 
00062           x[0] = 0.0;   x[1] = 0.5;   x[2] = 1.0;
00063           f.evaluate(x,y); out[13] = y;
00064 
00065           x[0] = 0.5;   x[1] = 0.5;   x[2] = 1.0;
00066           f.evaluate(x,y); out[14] = y;
00067         
00068           x[0] = 0.5;   x[1] = 0.0;   x[2] = 0.5;
00069           f.evaluate(x,y); out[15] = y;
00070 
00071           x[0] = 0.0;   x[1] = 0.5;   x[2] = 0.5;
00072           f.evaluate(x,y); out[16] = y;
00073 
00074           x[0] = 0.5;   x[1] = 0.5;   x[2] = 0.5;
00075           f.evaluate(x,y); out[17] = y;
00076         }
00077 
00078   };
00079 }
00080 
00081 #endif