dune-localfunctions  2.4.1
raviartthomas4cube2dlocalbasis.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 #ifndef DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS4_CUBE2D_LOCALBASIS_HH
4 #define DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS4_CUBE2D_LOCALBASIS_HH
5 
6 #include <vector>
7 
8 #include <dune/common/fmatrix.hh>
9 
10 #include "../../common/localbasis.hh"
11 
12 namespace Dune
13 {
23  template<class D, class R>
25  {
26 
27  public:
28  typedef LocalBasisTraits<D,2,Dune::FieldVector<D,2>,R,2,Dune::FieldVector<R,2>,
29  Dune::FieldMatrix<R,2,2> > Traits;
30 
33  {
34  sign0 = sign1 = sign2 = sign3 = 1.0;
35  }
36 
42  RT4Cube2DLocalBasis (unsigned int s)
43  {
44  sign0 = sign1 = sign2 = sign3 = 1.0;
45  if (s & 1)
46  {
47  sign0 = -1.0;
48  }
49  if (s & 2)
50  {
51  sign1 = -1.0;
52  }
53  if (s & 4)
54  {
55  sign2 = -1.0;
56  }
57  if (s & 8)
58  {
59  sign3 = -1.0;
60  }
61  }
62 
64  unsigned int size () const
65  {
66  return 60;
67  }
68 
75  inline void evaluateFunction (const typename Traits::DomainType& in,
76  std::vector<typename Traits::RangeType>& out) const
77  {
78  out.resize(60);
79 
80  double l1_x=(-1.0+2.0*in[0]);
81  double l1_y=(-1.0+2.0*in[1]);
82  double l2_x=(1.0-6.0*in[0]+6.0*pow(in[0],2));
83  double l2_y=(1.0-6.0*in[1]+6.0*pow(in[1],2));
84  double l3_x=(-1.0+12.0*in[0]-30.0*pow(in[0],2)+20.0*pow(in[0],3));
85  double l3_y=(-1.0+12.0*in[1]-30.0*pow(in[1],2)+20.0*pow(in[1],3));
86  double l4_x=(1.0-20.0*in[0]+90.0*pow(in[0],2)-140.0*pow(in[0],3)+70.0*pow(in[0],4));
87  double l4_y=(1.0-20.0*in[1]+90.0*pow(in[1],2)-140.0*pow(in[1],3)+70.0*pow(in[1],4));
88  double l5_x=(-1.0+30.0*in[0]-210.0*pow(in[0],2)+560.0*pow(in[0],3)-630.0*pow(in[0],4)+252.0*pow(in[0],5));
89  double l5_y=(-1.0+30.0*in[1]-210.0*pow(in[1],2)+560.0*pow(in[1],3)-630.0*pow(in[1],4)+252.0*pow(in[1],5));
90 
91  out[0][0]=sign0*(0.5*(-l4_x)+0.5*l5_x);
92  out[0][1]=0.0;
93  out[1][0]=-(1.5)*l4_x*l1_y+1.5*l5_x*l1_y;
94  out[1][1]=0.0;
95  out[2][0]=sign0*(-(2.5)*l4_x*l2_y+2.5*l5_x*l2_y);
96  out[2][1]=0.0;
97  out[3][0]=-(3.5)*l4_x*l3_y+3.5*l5_x*l3_y;
98  out[3][1]=0.0;
99  out[4][0]=sign0*(-(4.5)*l4_x*l4_y+4.5*l5_x*l4_y);
100  out[4][1]=0.0;
101 
102  out[5][0]=sign1*(0.5*l4_x+0.5*l5_x);
103  out[5][1]=0.0;
104  out[6][0]=-(1.5)*l4_x*l1_y-1.5*l5_x*l1_y;
105  out[6][1]=0.0;
106  out[7][0]=sign1*(2.5*l4_x*l2_y+2.5*l5_x*l2_y);
107  out[7][1]=0.0;
108  out[8][0]=-(3.5)*l4_x*l3_y-3.5*l5_x*l3_y;
109  out[8][1]=0.0;
110  out[9][0]=sign1*(4.5*l4_x*l4_y+4.5*l5_x*l4_y);
111  out[9][1]=0.0;
112 
113  out[10][0]=0.0;
114  out[10][1]=sign2*(0.5*(-l4_y)+0.5*l5_y);
115  out[11][0]=0.0;
116  out[11][1]=1.5*l1_x*l4_y-1.5*l1_x*l5_y;
117  out[12][0]=0.0;
118  out[12][1]=sign2*(-(2.5)*l2_x*l4_y+2.5*l2_x*l5_y);
119  out[13][0]=0.0;
120  out[13][1]=3.5*l3_x*l4_y-3.5*l3_x*l5_y;
121  out[14][0]=0.0;
122  out[14][1]=sign2*(-(4.5)*l4_x*l4_y+4.5*l4_x*l5_y);
123 
124  out[15][0]=0.0;
125  out[15][1]=sign3*(0.5*l4_y+0.5*l5_y);
126  out[16][0]=0.0;
127  out[16][1]=1.5*l1_x*l4_y+1.5*l1_x*l5_y;
128  out[17][0]=0.0;
129  out[17][1]=sign3*(2.5*l2_x*l4_y+2.5*l2_x*l5_y);
130  out[18][0]=0.0;
131  out[18][1]=3.5*l3_x*l4_y+3.5*l3_x*l5_y;
132  out[19][0]=0.0;
133  out[19][1]=sign3*(4.5*l4_x*l4_y+4.5*l4_x*l5_y);
134 
135  out[20][0]=1.0-l4_x;
136  out[20][1]=0.0;
137  out[21][0]=3.0*l1_y-3.0*l4_x*l1_y;
138  out[21][1]=0.0;
139  out[22][0]=5.0*l2_y-5.0*l4_x*l2_y;
140  out[22][1]=0.0;
141  out[23][0]=7.0*l3_y-7.0*l4_x*l3_y;
142  out[23][1]=0.0;
143  out[24][0]=9.0*l4_y-9.0*l4_x*l4_y;
144  out[24][1]=0.0;
145  out[25][0]=3.0*l1_x-3.0*l5_x;
146  out[25][1]=0.0;
147  out[26][0]=9.0*l1_x*l1_y-9.0*l5_x*l1_y;
148  out[26][1]=0.0;
149  out[27][0]=15.0*l1_x*l2_y-15.0*l5_x*l2_y;
150  out[27][1]=0.0;
151  out[28][0]=21.0*l1_x*l3_y-21.0*l5_x*l3_y;
152  out[28][1]=0.0;
153  out[29][0]=27.0*l1_x*l4_y-27.0*l5_x*l4_y;
154  out[29][1]=0.0;
155  out[30][0]=5.0*l2_x-5.0*l4_x;
156  out[30][1]=0.0;
157  out[31][0]=15.0*l2_x*l1_y-15.0*l4_x*l1_y;
158  out[31][1]=0.0;
159  out[32][0]=25.0*l2_x*l2_y-25.0*l4_x*l2_y;
160  out[32][1]=0.0;
161  out[33][0]=35.0*l2_x*l3_y-35.0*l4_x*l3_y;
162  out[33][1]=0.0;
163  out[34][0]=45.0*l2_x*l4_y-45.0*l4_x*l4_y;
164  out[34][1]=0.0;
165  out[35][0]=7.0*l3_x-7.0*l5_x;
166  out[35][1]=0.0;
167  out[36][0]=21.0*l3_x*l1_y-21.0*l5_x*l1_y;
168  out[36][1]=0.0;
169  out[37][0]=35.0*l3_x*l2_y-35.0*l5_x*l2_y;
170  out[37][1]=0.0;
171  out[38][0]=49.0*l3_x*l3_y-49.0*l5_x*l3_y;
172  out[38][1]=0.0;
173  out[39][0]=63.0*l3_x*l4_y-63.0*l5_x*l4_y;
174  out[39][1]=0.0;
175  out[40][0]=0.0;
176  out[40][1]=1.0-l4_y;
177  out[41][0]=0.0;
178  out[41][1]=3.0*l1_y-3.0*l5_y;
179  out[42][0]=0.0;
180  out[42][1]=5.0*l2_y-5.0*l4_y;
181  out[43][0]=0.0;
182  out[43][1]=7.0*l3_y-7.0*l5_y;
183  out[44][0]=0.0;
184  out[44][1]=3.0*l1_x-3.0*l1_x*l4_y;
185  out[45][0]=0.0;
186  out[45][1]=9.0*l1_x*l1_y-9.0*l1_x*l5_y;
187  out[46][0]=0.0;
188  out[46][1]=15.0*l1_x*l2_y-15.0*l1_x*l4_y;
189  out[47][0]=0.0;
190  out[47][1]=21.0*l1_x*l3_y-21.0*l1_x*l5_y;
191  out[48][0]=0.0;
192  out[48][1]=5.0*l2_x-5.0*l2_x*l4_y;
193  out[49][0]=0.0;
194  out[49][1]=15.0*l2_x*l1_y-15.0*l2_x*l5_y;
195  out[50][0]=0.0;
196  out[50][1]=25.0*l2_x*l2_y-25.0*l2_x*l4_y;
197  out[51][0]=0.0;
198  out[51][1]=35.0*l2_x*l3_y-35.0*l2_x*l5_y;
199  out[52][0]=0.0;
200  out[52][1]=7.0*l3_x-7.0*l3_x*l4_y;
201  out[53][0]=0.0;
202  out[53][1]=21.0*l3_x*l1_y-21.0*l3_x*l5_y;
203  out[54][0]=0.0;
204  out[54][1]=35.0*l3_x*l2_y-35.0*l3_x*l4_y;
205  out[55][0]=0.0;
206  out[55][1]=49.0*l3_x*l3_y-49.0*l3_x*l5_y;
207  out[56][0]=0.0;
208  out[56][1]=9.0*l4_x-9.0*l4_x*l4_y;
209  out[57][0]=0.0;
210  out[57][1]=27.0*l4_x*l1_y-27.0*l4_x*l5_y;
211  out[58][0]=0.0;
212  out[58][1]=45.0*l4_x*l2_y-45.0*l4_x*l4_y;
213  out[59][0]=0.0;
214  out[59][1]=63.0*l4_x*l3_y-63.0*l4_x*l5_y;
215  }
216 
223  inline void evaluateJacobian (const typename Traits::DomainType& in,
224  std::vector<typename Traits::JacobianType>& out) const
225  {
226  out.resize(60);
227  }
228 
230  unsigned int order () const
231  {
232  return 9;
233  }
234 
235  private:
236  R sign0, sign1, sign2, sign3;
237  };
238 }
239 
240 #endif // DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS3_CUBE2D_LOCALBASIS_HH
void evaluateJacobian(const typename Traits::DomainType &in, std::vector< typename Traits::JacobianType > &out) const
Evaluate Jacobian of all shape functions.
Definition: raviartthomas4cube2dlocalbasis.hh:223
unsigned int order() const
Polynomial order of the shape functions.
Definition: raviartthomas4cube2dlocalbasis.hh:230
RT4Cube2DLocalBasis(unsigned int s)
Make set number s, where 0 <= s < 16.
Definition: raviartthomas4cube2dlocalbasis.hh:42
LocalBasisTraits< D, 2, Dune::FieldVector< D, 2 >, R, 2, Dune::FieldVector< R, 2 >, Dune::FieldMatrix< R, 2, 2 > > Traits
Definition: raviartthomas4cube2dlocalbasis.hh:29
Type traits for LocalBasisVirtualInterface.
Definition: localbasis.hh:37
unsigned int size() const
number of shape functions
Definition: raviartthomas4cube2dlocalbasis.hh:64
Definition: brezzidouglasmarini1cube2dlocalbasis.hh:14
RT4Cube2DLocalBasis()
Standard constructor.
Definition: raviartthomas4cube2dlocalbasis.hh:32
Second order Raviart-Thomas shape functions on the reference quadrilateral.
Definition: raviartthomas4cube2dlocalbasis.hh:24
D DomainType
domain type
Definition: localbasis.hh:49
void evaluateFunction(const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate all shape functions.
Definition: raviartthomas4cube2dlocalbasis.hh:75