dune-localfunctions  2.2.1
q22dlocalbasis.hh
Go to the documentation of this file.
1 #ifndef DUNE_Q22DLOCALBASIS_HH
2 #define DUNE_Q22DLOCALBASIS_HH
3 
4 #warning This file is deprecated and will be removed after Dune 2.2. \
5  Please use q2localbasis.hh instead!
6 
7 #include <dune/common/fmatrix.hh>
8 
10 
11 namespace Dune
12 {
23 template<class D, class R>
25 {
26 public:
27  typedef LocalBasisTraits<D,2,Dune::FieldVector<D,2>,R,1,Dune::FieldVector<R,1>,
28  Dune::FieldMatrix<R,1,2> > Traits;
29 
31  unsigned int size () const
32  {
33  return 9;
34  }
35 
37  inline void evaluateFunction (const typename Traits::DomainType& in,
38  std::vector<typename Traits::RangeType>& out) const
39  {
40  out.resize(9);
41 
42  R x=in[0], y=in[1];
43  R X0=2*x*x-3*x+1, X1=-4*x*x+4*x, X2=2*x*x-x;
44  R Y0=2*y*y-3*y+1, Y1=-4*y*y+4*y, Y2=2*y*y-y;
45 
46  out[2] = X0*Y2;
47  out[7] = X1*Y2;
48  out[3] = X2*Y2;
49 
50  out[4] = X0*Y1;
51  out[8] = X1*Y1;
52  out[5] = X2*Y1;
53 
54  out[0] = X0*Y0;
55  out[6] = X1*Y0;
56  out[1] = X2*Y0;
57  }
58 
60  inline void
61  evaluateJacobian (const typename Traits::DomainType& in, // position
62  std::vector<typename Traits::JacobianType>& out) const // return value
63  {
64  out.resize(9);
65 
66  R x=in[0], y=in[1];
67  R X0=2*x*x-3*x+1, X1=-4*x*x+4*x, X2=2*x*x-x;
68  R Y0=2*y*y-3*y+1, Y1=-4*y*y+4*y, Y2=2*y*y-y;
69  R DX0=4*x-3, DX1=-8*x+4, DX2=4*x-1;
70  R DY0=4*y-3, DY1=-8*y+4, DY2=4*y-1;
71 
72  out[2][0][0] = DX0*Y2; out[7][0][0] = DX1*Y2; out[3][0][0] = DX2*Y2;
73  out[2][0][1] = X0*DY2; out[7][0][1] = X1*DY2; out[3][0][1] = X2*DY2;
74 
75  out[4][0][0] = DX0*Y1; out[8][0][0] = DX1*Y1; out[5][0][0] = DX2*Y1;
76  out[4][0][1] = X0*DY1; out[8][0][1] = X1*DY1; out[5][0][1] = X2*DY1;
77 
78  out[0][0][0] = DX0*Y0; out[6][0][0] = DX1*Y0; out[1][0][0] = DX2*Y0;
79  out[0][0][1] = X0*DY0; out[6][0][1] = X1*DY0; out[1][0][1] = X2*DY0;
80  }
81 
83  unsigned int order () const
84  {
85  return 2;
86  }
87 };
88 }
89 #endif