dune-localfunctions  2.4.1-rc2
raviartthomas3cube2dlocalbasis.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_RAVIARTTHOMAS3_CUBE2D_LOCALBASIS_HH
4 #define DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS3_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  RT3Cube2DLocalBasis (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 40;
67  }
68 
75  inline void evaluateFunction (const typename Traits::DomainType& in,
76  std::vector<typename Traits::RangeType>& out) const
77  {
78  out.resize(40);
79  double tmp1=-1.0+16.0*in[0]-60.0*pow(in[0],2)+80.0*pow(in[0],3)-35.0*pow(in[0],4);
80  double tmp2=(1.0-16.0*in[0]+60.0*pow(in[0],2)-80.0*pow(in[0],3)+35.0*pow(in[0],4));
81  double tmp3=(-1.0+2.0*in[1]);
82  double tmp4=(1.0-6.0*in[1]+6.0*pow(in[1],2));
83  double tmp5=(-1.0+12.0*in[1]-30.0*pow(in[1],2)+20.0*pow(in[1],3));
84  double tmp6=in[0]*(-4.0+30.0*in[0]-60.0*pow(in[0],2)+35.0*pow(in[0],3));
85  double tmp7=-1.0+16.0*in[1]-60.0*pow(in[1],2)+80.0*pow(in[1],3)-35.0*pow(in[1],4);
86  double tmp8=(1.0-16.0*in[1]+60.0*pow(in[1],2)-80.0*pow(in[1],3)+35.0*pow(in[1],4));
87  double tmp9=(-1.0+2.0*in[0]);
88  double tmp10=(1.0-6.0*in[0]+6.0*pow(in[0],2));
89  double tmp11=(-1.0+12.0*in[0]-30.0*pow(in[0],2)+20.0*pow(in[0],3));
90  double tmp12=in[1]*(-4.0+30.0*in[1]-60.0*pow(in[1],2)+35.0*pow(in[1],3));
91  double tmp13=in[0]*(2.0-9.0*in[0]+14.0*pow(in[0],2)-7.0*pow(in[0],3));
92  double tmp14=in[0]*(-2.0+9.0*in[0]-14.0*pow(in[0],2)+7.0*pow(in[0],3));
93  double tmp15=in[0]*(1.0-3.0*in[0]+2.0*pow(in[0],2));
94  double tmp16=in[0]*(-1.0+6.0*in[0]-10.0*pow(in[0],2)+5.0*pow(in[0],3));
95  double tmp17=in[1]*(2.0-9.0*in[1]+14.0*pow(in[1],2)-7.0*pow(in[1],3));
96  double tmp18=in[1]*(1.0-3.0*in[1]+2.0*pow(in[1],2));
97  double tmp19=in[1]*(-1.0+6.0*in[1]-10.0*pow(in[1],2)+5.0*pow(in[1],3));
98  double tmp20=in[1]*(-2.0+9.0*in[1]-14.0*pow(in[1],2)+7.0*pow(in[1],3));
99 
100  out[0][0]=sign0*tmp1;
101  out[0][1]=0;
102  out[1][0]=(-3.0*tmp2*tmp3);
103  out[1][1]=0;
104  out[2][0]=sign0*(-5.0*tmp2*tmp4);
105  out[2][1]=0;
106  out[3][0]=(-7.0*tmp2*tmp5);
107  out[3][1]=0;
108 
109  out[4][0]=sign1*tmp6;
110  out[4][1]=0;
111  out[5][0]=(-3.0*tmp6*tmp3);
112  out[5][1]=0;
113  out[6][0]=sign1*(5.0*tmp6*tmp4);
114  out[6][1]=0;
115  out[7][0]=(-7.0*tmp6*tmp5);
116  out[7][1]=0;
117 
118  out[8][0]=0;
119  out[8][1]=sign2*tmp7;
120  out[9][0]=0;
121  out[9][1]=3.0*tmp9*tmp8;
122  out[10][0]=0;
123  out[10][1]=sign2*(-5.0*tmp10*tmp8);
124  out[11][0]=0;
125  out[11][1]=7.0*tmp11*tmp8;
126 
127  out[12][0]=0;
128  out[12][1]=sign3*tmp12;
129  out[13][0]=0;
130  out[13][1]=3.0*tmp9*tmp12;
131  out[14][0]=0;
132  out[14][1]=sign3*5.0*tmp10*tmp12;
133  out[15][0]=0;
134  out[15][1]=7.0*tmp11*tmp12;
135 
136  out[16][0]=10.0*tmp13;
137  out[16][1]=0;
138  out[17][0]=-30.0*tmp14*tmp3;
139  out[17][1]=0;
140  out[18][0]=-50.0*tmp14*tmp4;
141  out[18][1]=0;
142  out[19][0]=-70.0*tmp14*tmp5;
143  out[19][1]=0;
144  out[20][0]=-30.0*tmp15;
145  out[20][1]=0;
146  out[21][0]=-90.0*tmp15*tmp3;
147  out[21][1]=0;
148  out[22][0]=-150.0*tmp15*tmp4;
149  out[22][1]=0;
150  out[23][0]=-210.0*tmp15*tmp5;
151  out[23][1]=0;
152  out[24][0]=-70.0*tmp16;
153  out[24][1]=0;
154  out[25][0]=-210.0*tmp16*tmp3;
155  out[25][1]=0;
156  out[26][0]=-350.0*tmp16*tmp4;
157  out[26][1]=0;
158  out[27][0]=-490.0*tmp16*tmp5;
159  out[27][1]=0;
160  out[28][0]=0;
161  out[28][1]=10.0*tmp17;
162  out[29][0]=0;
163  out[29][1]=-30.0*tmp18;
164  out[30][0]=0;
165  out[30][1]=-70.0*tmp19;
166  out[31][0]=0;
167  out[31][1]=-30.0*tmp9*tmp20;
168  out[32][0]=0;
169  out[32][1]=-90.0*tmp9*tmp18;
170  out[33][0]=0;
171  out[33][1]=-210.0*tmp9*tmp19;
172  out[34][0]=0;
173  out[34][1]=-50.0*tmp10*tmp20;
174  out[35][0]=0;
175  out[35][1]=-150.0*tmp10*tmp18;
176  out[36][0]=0;
177  out[36][1]=-350.0*tmp10*tmp19;
178  out[37][0]=0;
179  out[37][1]=-70.0*tmp11*tmp20;
180  out[38][0]=0;
181  out[38][1]=-210.0*tmp11*tmp18;
182  out[39][0]=0;
183  out[39][1]=-490.0*tmp11*tmp19;
184  }
185 
192  inline void evaluateJacobian (const typename Traits::DomainType& in,
193  std::vector<typename Traits::JacobianType>& out) const
194  {
195  out.resize(40);
196  }
197 
199  unsigned int order () const
200  {
201  return 7;
202  }
203 
204  private:
205  R sign0, sign1, sign2, sign3;
206  };
207 }
208 
209 #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: raviartthomas3cube2dlocalbasis.hh:192
Second order Raviart-Thomas shape functions on the reference quadrilateral.
Definition: raviartthomas3cube2dlocalbasis.hh:24
Type traits for LocalBasisVirtualInterface.
Definition: localbasis.hh:37
unsigned int order() const
Polynomial order of the shape functions.
Definition: raviartthomas3cube2dlocalbasis.hh:199
unsigned int size() const
number of shape functions
Definition: raviartthomas3cube2dlocalbasis.hh:64
void evaluateFunction(const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate all shape functions.
Definition: raviartthomas3cube2dlocalbasis.hh:75
Definition: brezzidouglasmarini1cube2dlocalbasis.hh:14
RT3Cube2DLocalBasis(unsigned int s)
Make set number s, where 0 <= s < 16.
Definition: raviartthomas3cube2dlocalbasis.hh:42
LocalBasisTraits< D, 2, Dune::FieldVector< D, 2 >, R, 2, Dune::FieldVector< R, 2 >, Dune::FieldMatrix< R, 2, 2 > > Traits
Definition: raviartthomas3cube2dlocalbasis.hh:29
RT3Cube2DLocalBasis()
Standard constructor.
Definition: raviartthomas3cube2dlocalbasis.hh:32
D DomainType
domain type
Definition: localbasis.hh:49