libMesh
src
fe
inf_fe_legendre_eval.C
Go to the documentation of this file.
1
// The libMesh Finite Element Library.
2
// Copyright (C) 2002-2019 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3
4
// This library is free software; you can redistribute it and/or
5
// modify it under the terms of the GNU Lesser General Public
6
// License as published by the Free Software Foundation; either
7
// version 2.1 of the License, or (at your option) any later version.
8
9
// This library is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
// Lesser General Public License for more details.
13
14
// You should have received a copy of the GNU Lesser General Public
15
// License along with this library; if not, write to the Free Software
16
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18
19
// Local Includes
20
#include "libmesh/libmesh_config.h"
21
22
#ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
23
24
#include "libmesh/inf_fe.h"
25
#include "libmesh/jacobi_polynomials.h"
26
27
using namespace
libMesh
;
28
29
// Anonymous namespace for local helper functions
30
namespace
{
31
32
// When alpha=beta=0, the Jacobi polynomials reduce to the Legendre polynomials.
33
Real
legendre_eval(
unsigned
int
n,
Real
x)
34
{
35
if
(n == 0)
36
return
1.;
37
38
Real
val =
JacobiPolynomials::value
(n,
/*alpha=*/
0,
/*beta=*/
0, x);
39
40
// For n>0, there is an even/odd shift of -1/+1 applied. I'm not
41
// sure why this is done for the infinite elements, as it is not
42
// part of the "standard" Legendre polynomial definition, I'm just
43
// copying what was done in the original implementation...
44
return
val + (n % 2 == 0 ? -1 : +1);
45
}
46
47
Real
legendre_eval_deriv(
unsigned
int
n,
Real
x)
48
{
49
return
JacobiPolynomials::deriv
(n,
/*alpha=*/
0,
/*beta=*/
0, x);
50
}
51
}
// anonymous namespace
52
53
54
namespace
libMesh
55
{
56
57
// Specialize the eval() function for 1, 2, and 3 dimensions and the CARTESIAN mapping type
58
// to call the local helper function from the anonymous namespace.
59
template
<>
Real
InfFE<1,LEGENDRE,CARTESIAN>::eval
(
Real
x,
Order
,
unsigned
n) {
return
legendre_eval(n, x); }
60
template
<>
Real
InfFE<2,LEGENDRE,CARTESIAN>::eval
(
Real
x,
Order
,
unsigned
n) {
return
legendre_eval(n, x); }
61
template
<>
Real
InfFE<3,LEGENDRE,CARTESIAN>::eval
(
Real
x,
Order
,
unsigned
n) {
return
legendre_eval(n, x); }
62
63
// Specialize the eval_deriv() function for 1, 2, and 3 dimensions and the CARTESIAN mapping type
64
// to call the local helper function from the anonymous namespace.
65
template
<>
Real
InfFE<1,LEGENDRE,CARTESIAN>::eval_deriv
(
Real
x,
Order
,
unsigned
n) {
return
legendre_eval_deriv(n, x); }
66
template
<>
Real
InfFE<2,LEGENDRE,CARTESIAN>::eval_deriv
(
Real
x,
Order
,
unsigned
n) {
return
legendre_eval_deriv(n, x); }
67
template
<>
Real
InfFE<3,LEGENDRE,CARTESIAN>::eval_deriv
(
Real
x,
Order
,
unsigned
n) {
return
legendre_eval_deriv(n, x); }
68
69
}
// namespace libMesh
70
71
72
#endif // LIBMESH_ENABLE_INFINITE_ELEMENTS
libMesh::InfFE::eval_deriv
static Real eval_deriv(Real v, Order o_radial, unsigned int i)
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition:
factoryfunction.C:55
libMesh::Order
Order
Definition:
enum_order.h:40
libMesh::JacobiPolynomials::value
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
The Jacobi polynomial value and derivative formulas are based on the corresponding Wikipedia article ...
Definition:
jacobi_polynomials.h:44
libMesh::JacobiPolynomials::deriv
Real deriv(unsigned n, unsigned alpha, unsigned beta, Real x)
Definition:
jacobi_polynomials.h:74
libMesh::InfFE::eval
static Real eval(Real v, Order o_radial, unsigned int i)
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition:
libmesh_common.h:121
Generated on Sat Jan 25 2020 12:06:59 for libMesh by
1.8.16