rannacherturek2dlocalbasis.hh
Go to the documentation of this file.00001
00002 #ifndef DUNE_RANNACHER_TUREK2DLOCALBASIS_HH
00003 #define DUNE_RANNACHER_TUREK2DLOCALBASIS_HH
00004
00005 #include <vector>
00006
00007 #include <dune/common/fvector.hh>
00008 #include <dune/common/fmatrix.hh>
00009
00010 #include <dune/localfunctions/common/localbasis.hh>
00011
00012 namespace Dune {
00013
00014 template<class D, class R>
00015 class RannacherTurek2DLocalBasis
00016 {
00017 public:
00018 typedef LocalBasisTraits<D,2,FieldVector<D,2>,
00019 R,1,FieldVector<R,1>,
00020 FieldMatrix<R,1,2> > Traits;
00021
00022 unsigned int size () const {
00023 return 4;
00024 }
00025
00027 inline void
00028 evaluateFunction (const typename Traits::DomainType& in,
00029 std::vector<typename Traits::RangeType>& out) const
00030 {
00031 out.resize(4);
00032 typename Traits::DomainFieldType qbase = in[0]*in[0]-in[1]*in[1];
00033 out[0] = .75 - 2*in[0] + in[1] + qbase;
00034 out[1] = -.25 + in[1] + qbase;
00035 out[2] = .75 + in[0] - 2*in[1] - qbase;
00036 out[3] = -.25 + in[0] - qbase;
00037 }
00038
00040 inline void
00041 evaluateJacobian (const typename Traits::DomainType& in,
00042 std::vector<typename Traits::JacobianType>& out) const
00043 {
00044 out.resize(4);
00045
00046
00047
00048
00049 out[0][0][0] = -2 + 2*in[0]; out[0][0][1] = 1 - 2*in[1];
00050 out[1][0][0] = 2*in[0]; out[1][0][1] = 1 - 2*in[1];
00051 out[2][0][0] = 1 - 2*in[0]; out[2][0][1] = -2 + 2*in[1];
00052 out[3][0][0] = 1 - 2*in[0]; out[3][0][1] = 2*in[1];
00053 }
00054
00056 unsigned int order () const {
00057
00058 return 2;
00059 }
00060 };
00061
00062 }
00063
00064 #endif // DUNE_RANNACHER_TUREK2DLOCALBASIS_HH