dune-fem  2.4.1-rc
legendrepolynomials.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_SPACE_SHAPEFUNCTIONSET_LEGENDREPOLYNOMIALS_HH
2 #define DUNE_FEM_SPACE_SHAPEFUNCTIONSET_LEGENDREPOLYNOMIALS_HH
3 
4 // C++ inlcudes
5 #include <cassert>
6 #include <iostream>
7 
8 
9 namespace Dune
10 {
11 
12  namespace Fem
13  {
14 
16  {
17  public:
18  static const int maxOrder = 11;
19 
20  static const double factor[ maxOrder ][ maxOrder ];
21  static const double weight[ maxOrder ];
22 
23  public:
24  static double evaluate ( const int num, const double x )
25  {
26  assert( 0 <= num && num < maxOrder );
27 
28  double phi = factor[ num ][ num ];
29  for( int i = num-1; i >= 0; --i )
30  phi = phi * x + factor[ num ][ i ];
31  return weight[ num ] * phi;
32  }
33 
34  static double jacobian ( const int num, const double x )
35  {
36  assert( 0 <= num && num < maxOrder );
37 
38  double phi = 0.;
39  if( num >= 1 )
40  {
41  phi = factor[ num ][ num ] * num;
42  for( int i = num-1; i >= 1; --i )
43  phi = phi * x + factor[ num ][ i ] * i;
44  }
45  return weight[ num ] * phi;
46  }
47 
48  static double hessian ( const int num, const double x )
49  {
50  assert( 0 <= num && num < maxOrder );
51 
52  double phi=0.;
53  if( num >= 2 )
54  {
55  phi = factor[ num ][ num ] * num * ( num-1 );
56  for( int i = num-1; i >= 2; --i )
57  phi = phi * x + factor[ num ][ i ] * i * (i-1);
58  }
59  return weight[ num ] * phi;
60  }
61  };
62 
63  } // namespace Fem
64 
65 } // namespace Dune
66 
67 #endif // #ifndef DUNE_FEM_SPACE_SHAPEFUNCTIONSET_LEGENDREPOLYNOMIALS_HH
static const double factor[maxOrder][maxOrder]
Definition: legendrepolynomials.hh:20
static double jacobian(const int num, const double x)
Definition: legendrepolynomials.hh:34
Definition: coordinate.hh:4
static const double weight[maxOrder]
Definition: legendrepolynomials.hh:21
static double hessian(const int num, const double x)
Definition: legendrepolynomials.hh:48
static const int maxOrder
Definition: legendrepolynomials.hh:18
static double evaluate(const int num, const double x)
Definition: legendrepolynomials.hh:24
Definition: legendrepolynomials.hh:15