dune-localfunctions  2.2.0
q22dlocalbasis.hh
Go to the documentation of this file.
00001 #ifndef DUNE_Q22DLOCALBASIS_HH
00002 #define DUNE_Q22DLOCALBASIS_HH
00003 
00004 #warning This file is deprecated and will be removed after Dune 2.2.  \
00005          Please use q2localbasis.hh instead!
00006 
00007 #include <dune/common/fmatrix.hh>
00008 
00009 #include <dune/localfunctions/common/localbasis.hh>
00010 
00011 namespace Dune 
00012 {
00023 template<class D, class R>
00024 class Q22DLocalBasis
00025 {
00026 public:
00027   typedef LocalBasisTraits<D,2,Dune::FieldVector<D,2>,R,1,Dune::FieldVector<R,1>,
00028                              Dune::FieldMatrix<R,1,2> > Traits;
00029 
00031   unsigned int size () const
00032   {
00033         return 9;
00034   }
00035 
00037   inline void evaluateFunction (const typename Traits::DomainType& in,
00038                                          std::vector<typename Traits::RangeType>& out) const
00039   { 
00040         out.resize(9);
00041 
00042         R x=in[0], y=in[1];
00043         R X0=2*x*x-3*x+1, X1=-4*x*x+4*x, X2=2*x*x-x;
00044         R Y0=2*y*y-3*y+1, Y1=-4*y*y+4*y, Y2=2*y*y-y;
00045 
00046         out[2] = X0*Y2; 
00047         out[7] = X1*Y2; 
00048         out[3] = X2*Y2;
00049 
00050         out[4] = X0*Y1; 
00051         out[8] = X1*Y1; 
00052         out[5] = X2*Y1;
00053 
00054         out[0] = X0*Y0; 
00055         out[6] = X1*Y0; 
00056         out[1] = X2*Y0;
00057   }
00058 
00060   inline void 
00061   evaluateJacobian (const typename Traits::DomainType& in,         // position
00062                         std::vector<typename Traits::JacobianType>& out) const      // return value
00063   {  
00064         out.resize(9);
00065 
00066         R x=in[0], y=in[1];
00067         R X0=2*x*x-3*x+1, X1=-4*x*x+4*x, X2=2*x*x-x;
00068         R Y0=2*y*y-3*y+1, Y1=-4*y*y+4*y, Y2=2*y*y-y;
00069         R DX0=4*x-3, DX1=-8*x+4, DX2=4*x-1;
00070         R DY0=4*y-3, DY1=-8*y+4, DY2=4*y-1;
00071 
00072         out[2][0][0] = DX0*Y2; out[7][0][0] = DX1*Y2; out[3][0][0] = DX2*Y2;
00073         out[2][0][1] = X0*DY2; out[7][0][1] = X1*DY2; out[3][0][1] = X2*DY2;
00074 
00075         out[4][0][0] = DX0*Y1; out[8][0][0] = DX1*Y1; out[5][0][0] = DX2*Y1;
00076         out[4][0][1] = X0*DY1; out[8][0][1] = X1*DY1; out[5][0][1] = X2*DY1;
00077 
00078         out[0][0][0] = DX0*Y0; out[6][0][0] = DX1*Y0; out[1][0][0] = DX2*Y0;
00079         out[0][0][1] = X0*DY0; out[6][0][1] = X1*DY0; out[1][0][1] = X2*DY0;
00080   }
00081 
00083   unsigned int order () const
00084   {
00085         return 2;
00086   }
00087 };
00088 }
00089 #endif