hierarchicalprismp2localinterpolation.hh

Go to the documentation of this file.
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_HIERARCHICAL_PRISM_P2_LOCALINTERPOLATION_HH
00004 #define DUNE_HIERARCHICAL_PRISM_P2_LOCALINTERPOLATION_HH
00005 
00006 #include <vector>
00007 
00008 namespace Dune 
00009 {
00013   template<class LB>
00014   class HierarchicalPrismP2LocalInterpolation 
00015   {
00016   public:
00017 
00018     template<typename F, typename C>
00019     void interpolate (const F& f, std::vector<C>& out) const
00020     {
00021       typename LB::Traits::DomainType x;
00022       typename LB::Traits::RangeType y;
00023       out.resize(18);
00024       //dune_static_assert(LB::Traits::dimDomain ==3, "LocalInterpolation for HierarchicalPrismP2 finite elements"
00025        //   " is only implemented for dimDomain ==3!");
00026 
00027     
00028           //First the  vertex dofs
00029           x[0] = 0.0;    x[1] = 0.0;     x[2] = 0.0;    f.evaluate(x, y);    out[0] = y;
00030           x[0] = 1.0;    x[1] = 0.0;     x[2] = 0.0;    f.evaluate(x, y);    out[1] = y;
00031           x[0] = 0.0;    x[1] = 1.0;     x[2] = 0.0;    f.evaluate(x, y);    out[2] = y;
00032           x[0] = 0.0;    x[1] = 0.0;     x[2] = 1.0;    f.evaluate(x, y);    out[3] = y;
00033           x[0] = 1.0;    x[1] = 0.0;     x[2] = 1.0;    f.evaluate(x, y);    out[4] = y;
00034           x[0] = 0.0;    x[1] = 1.0;     x[2] = 1.0;    f.evaluate(x, y);    out[5] = y;
00035 
00036 
00037           // Then: the 9 edge dofs and the 3 face dofs
00038           x[0] = 0.0;    x[1] = 0.0;     x[2] = 0.5;    f.evaluate(x, y);
00039           out[6] = y - 0.5*(out[0] + out[3]);
00040 
00041           x[0] = 1.0;    x[1] = 0.0;     x[2] = 0.5;    f.evaluate(x, y);
00042           out[7] = y - 0.5*(out[1] + out[4]);
00043 
00044           x[0] = 0.0;    x[1] = 1.0;     x[2] = 0.5;    f.evaluate(x, y);
00045           out[8] = y - 0.5*(out[2] + out[5]);
00046 
00047           x[0] = 0.5;    x[1] = 0.0;     x[2] = 0.0;    f.evaluate(x, y);
00048           out[9] = y - 0.5*(out[0] + out[1]);
00049 
00050           x[0] = 0.0;    x[1] = 0.5;     x[2] = 0.0;    f.evaluate(x, y);
00051           out[10] = y - 0.5*(out[2] + out[0]);
00052 
00053           x[0] = 0.5;    x[1] = 0.5;     x[2] = 0.0;    f.evaluate(x, y);
00054           out[11] = y - 0.5*(out[2] + out[1]);
00055          
00056           x[0] = 0.5;    x[1] = 0.0;     x[2] = 1.0;    f.evaluate(x, y);
00057           out[12] = y - 0.5*(out[3] + out[4]);
00058                 
00059           x[0] = 0.0;    x[1] = 0.5;     x[2] = 1.0;    f.evaluate(x, y);
00060           out[13] = y - 0.5*(out[3] + out[5]);
00061              
00062           x[0] = 0.5;    x[1] = 0.5;     x[2] = 1.0;    f.evaluate(x, y);
00063           out[14] = y - 0.5*(out[4] + out[5]);
00064            
00065          
00066           //faces
00067           x[0] = 0.5;    x[1] = 0.0;     x[2] = 0.5;    f.evaluate(x, y);
00068           out[15] = y - 0.25*(out[4] + out[1] + out[0] +  out[3] );
00069 
00070           x[0] = 0.0;    x[1] = 0.5;     x[2] = 0.5;    f.evaluate(x, y);
00071           out[16] = y - 0.25*(out[2] + out[0] + out[3] + out[5] );
00072 
00073           x[0] = 0.5;    x[1] = 0.5;     x[2] = 0.5;    f.evaluate(x, y);
00074           out[17] = y - 0.25*(out[2] + out[1] + out[4] + out[5] );
00075 
00076 }
00077 
00078 
00079   };
00080 }
00081 
00082 #endif

Generated on Fri Apr 29 2011 with Doxygen (ver 1.7.1) [doxygen-log,error-log].