19#ifndef LIBMESH_FE_LAGRANGE_GLL_SHAPE_1D_H
20#define LIBMESH_FE_LAGRANGE_GLL_SHAPE_1D_H
23#include "libmesh/libmesh_common.h"
24#include "libmesh/enum_order.h"
25#include "libmesh/int_range.h"
26#include "libmesh/quadrature_gauss_lobatto.h"
61 std::vector<std::vector<Real>>
deriv;
63#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
65 std::vector<std::vector<Real>>
second;
89 libmesh_assert_equal_to(rule.
n_points(), n);
93 b.nodes[i] = rule.
qp(i)(0);
101 product *=
b.nodes[i] -
b.nodes[j];
102 b.weights[i] = 1. / product;
109 b.deriv.
assign(n, std::vector<Real>(n, 0.));
116 b.deriv[k][i] = (
b.weights[i] /
b.weights[k]) / (
b.nodes[k] -
b.nodes[i]);
117 row_sum +=
b.deriv[k][i];
119 b.deriv[k][k] = -row_sum;
122#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
126 b.second.assign(n, std::vector<Real>(n, 0.));
134 2. *
b.deriv[k][i] * (
b.deriv[k][k] - 1. / (
b.nodes[k] -
b.nodes[i]));
135 row_sum +=
b.second[k][i];
137 b.second[k][k] = -row_sum;
154 static const std::array<GLLBasis1D, fe_lagrange_gll_max_points_1D + 1> bases = []()
156 std::array<GLLBasis1D, fe_lagrange_gll_max_points_1D + 1>
b;
162 const unsigned int n =
static_cast<unsigned int>(order) + 1;
165 "The Gauss-Lobatto nodal basis supports orders 1 through "
167 <<
" was requested.");
183 const auto it = std::lower_bound(
b.nodes.begin(),
b.nodes.end(), xi);
185 if (it !=
b.nodes.end() && *it == xi)
186 return cast_int<unsigned int>(std::distance(
b.nodes.begin(), it));
200 const unsigned int i,
205 libmesh_assert_less (i,
b.nodes.size());
209 return (i == k) ? 1. : 0.;
211 Real numerator = 0., denominator = 0.;
215 const Real term =
b.weights[j] / (xi -
b.nodes[j]);
223 return numerator / denominator;
233template <
typename Column>
238 Real numerator = 0., denominator = 0.;
242 const Real term =
b.weights[k] / (xi -
b.nodes[k]);
244 numerator += term * f(k);
248 return numerator / denominator;
261 const unsigned int i,
262 const unsigned int libmesh_dbg_var(j),
266 libmesh_assert_equal_to (j, 0);
270 libmesh_assert_less (i,
b.nodes.size());
274 return b.deriv[k][i];
277 {
return b.deriv[m][i]; });
280#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
289 const unsigned int i,
290 const unsigned int libmesh_dbg_var(j),
294 libmesh_assert_equal_to (j, 0);
298 libmesh_assert_less (i,
b.nodes.size());
302 return b.second[k][i];
305 {
return b.second[m][i]; });
unsigned int n_points() const
Point qp(const unsigned int i) const
virtual void init(const Elem &e, unsigned int p_level=invalid_uint)
Initializes the data structures for a quadrature rule for the element e.
This class implements Gauss-Lobatto quadrature for 1D elements and 2D/3D tensor product elements.
LIBMESH_DEVICE_INLINE void assign(const TypeVector< T2 > &)
Assign to this vector without creating a temporary.
The libMesh namespace provides an interface to certain functionality in the library.
unsigned int fe_lagrange_gll_1D_point(const GLLBasis1D &b, const Real xi)
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
const GLLBasis1D & fe_lagrange_gll_1D_basis(const Order order)
Real fe_lagrange_gll_1D_shape_deriv(const Order order, const unsigned int i, const unsigned int libmesh_dbg_var(j), const Real xi)
constexpr unsigned int fe_lagrange_gll_max_points_1D
The number of points in the largest Gauss-Lobatto rule that QGaussLobatto tabulates,...
Real fe_lagrange_gll_1D_interpolate(const GLLBasis1D &b, const Real xi, const Column &f)
GLLBasis1D build_gll_basis_1D(const unsigned int n)
Real fe_lagrange_gll_1D_shape_second_deriv(const Order order, const unsigned int i, const unsigned int libmesh_dbg_var(j), const Real xi)
Real fe_lagrange_gll_1D_shape(const Order order, const unsigned int i, const Real xi)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
The one-dimensional nodal basis of degree n-1 on n Gauss-Lobatto points.
std::vector< std::vector< Real > > deriv
deriv[k][i] is the derivative of the i'th shape function at the k'th point
std::vector< Real > nodes
The interpolation points in ascending order. The first is -1 and the last is 1.
std::vector< std::vector< Real > > second
second[k][i] is the second derivative of the i'th shape function at the k'th point
std::vector< Real > weights
The barycentric weights. The i'th is the reciprocal of .