Rheolef  7.1
an efficient C++ finite element environment
gauss_radau_jacobi.icc
Go to the documentation of this file.
1 #include "rheolef/compiler.h"
22 #include "rheolef/gamma.h"
23 #include "rheolef/jacobi.h"
24 #include "rheolef/jacobi_roots.h"
25 #include <iterator>
26 namespace rheolef {
27 template <class Size, class OutputIterator1, class OutputIterator2>
28 void gauss_radau_jacobi (Size R,
29  typename std::iterator_traits<OutputIterator1>::value_type alpha,
30  typename std::iterator_traits<OutputIterator1>::value_type beta,
31  OutputIterator1 zeta, OutputIterator2 omega)
32 {
33  typedef typename std::iterator_traits<OutputIterator1>::value_type T;
34  check_macro (R >= 1, "gauss_radau_jacobi: node number " << R << " may be >= 1");
35  T num = pow(T(2), alpha+beta)/(beta+T(1.*R));
36  T w0 = pow(T(2), alpha+beta+1)*(beta+1);
37  if (alpha == floor(alpha) && beta == floor(beta)) {
38  num *= T(1.*R)/((alpha+T(1.*R))*(beta+T(1.*R)));
39  w0 *= 1/(T(1.*R)*(alpha+T(1.*R)));
40  for (Size k = 1; k <= size_t(static_cast<int>(beta)); k++) {
41  num *= T(1.*R+k)/(alpha+T(1.*R+k));
42  w0 *= T(sqr(T(int(k))))/(T(1.*R+k)*(alpha+R+k));
43  }
44  } else {
45  num *= (my_gamma(alpha+R)/my_gamma(alpha+beta+R+1))
46  *(my_gamma(beta+R)/my_gamma(T(1.*R)));
47  w0 *= sqr(my_gamma(beta+1))
48  *(my_gamma(T(1.*R))/my_gamma(beta+R+1))
49  *(my_gamma(alpha+R)/my_gamma(alpha+beta+R+1));
50  }
51  zeta [0] = -1;
52  omega[0] = w0;
53  jacobi_roots (R-1, alpha, beta+1, zeta+1);
54  jacobi<T> P1 (R-1, alpha, beta);
55  for (Size r = 1; r < R; ++r)
56  omega[r] = num*(1-zeta[r])/sqr(P1(zeta[r]));
57 }
58 } // namespace rheolef
rheolef::my_gamma
T my_gamma(const T &x)
Definition: gamma.icc:25
bdf::alpha
Float alpha[pmax+1][pmax+1]
Definition: bdf.icc:28
check_macro
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
rheolef::gauss_radau_jacobi
void gauss_radau_jacobi(Size R, typename std::iterator_traits< OutputIterator1 >::value_type alpha, typename std::iterator_traits< OutputIterator1 >::value_type beta, OutputIterator1 zeta, OutputIterator2 omega)
Definition: gauss_radau_jacobi.icc:28
rheolef::pow
space_mult_list< T, M > pow(const space_basic< T, M > &X, size_t n)
Definition: space_mult.h:120
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37
rheolef::jacobi
Definition: jacobi.icc:24
rheolef::jacobi_roots
void jacobi_roots(Size R, T alpha, T beta, OutputIterator zeta)
Definition: jacobi_roots.icc:26
rk::beta
Float beta[][pmax+1]
Definition: runge_kutta_semiimplicit.icc:60
T
Expr1::float_type T
Definition: field_expr.h:261