Functionality associated with a particular choice of basis functions and quadrature for spectral operations. More...
Namespaces  
Swsh  
Namespace for spinweighted spherical harmonic utilities.  
Enumerations  
enum  MortarSize { Full, UpperHalf, LowerHalf } 
The portion of an element covered by a mortar.  
enum  Basis { Chebyshev, Legendre } 
The choice of basis functions for computing collocation points and weights. More...  
enum  Quadrature { Gauss, GaussLobatto } 
The choice of quadrature method to compute integration weights. More...  
Functions  
const Matrix &  projection_matrix_mortar_to_element (MortarSize size, const Mesh< 1 > &element_mesh, const Mesh< 1 > &mortar_mesh) noexcept 
The projection matrix from a 1D mortar to an element. More...  
const Matrix &  projection_matrix_element_to_mortar (MortarSize size, const Mesh< 1 > &mortar_mesh, const Mesh< 1 > &element_mesh) noexcept 
The projection matrix from a 1D element to a mortar. See projection_matrix_mortar_to_element() for details.  
std::ostream &  operator<< (std::ostream &os, const Basis &basis) noexcept 
std::ostream &  operator<< (std::ostream &os, const Quadrature &quadrature) noexcept 
template<Basis BasisType, Quadrature QuadratureType>  
const DataVector &  collocation_points (size_t num_points) noexcept 
Collocation points. More...  
template<Basis BasisType, Quadrature QuadratureType>  
const DataVector &  quadrature_weights (size_t num_points) noexcept 
Weights to compute definite integrals. More...  
template<Basis BasisType, Quadrature QuadratureType, typename T >  
Matrix  interpolation_matrix (size_t num_points, const T &target_points) noexcept 
Matrix used to interpolate to the target_points . More...  
template<typename T >  
Matrix  interpolation_matrix (const Mesh< 1 > &mesh, const T &target_points) noexcept 
Interpolation matrix to the target_points for a onedimensional mesh. More...  
template<Basis BasisType, typename T >  
T  compute_basis_function_value (size_t k, const T &x) noexcept 
Compute the function values of the basis function \(\Phi_k(x)\) (zeroindexed).  
template<Basis >  
DataVector  compute_inverse_weight_function_values (const DataVector &) noexcept 
Compute the inverse of the weight function \(w(x)\) w.r.t. which the basis functions are orthogonal. See the description of quadrature_weights(size_t) for details.  
template<Basis BasisType>  
double  compute_basis_function_normalization_square (size_t k) noexcept 
Compute the normalization square of the basis function \(\Phi_k\) (zeroindexed), i.e. the weighted definite integral over its square.  
template<Basis BasisType, Quadrature QuadratureType>  
std::pair< DataVector, DataVector >  compute_collocation_points_and_weights (size_t num_points) noexcept 
Compute the collocation points and weights associated to the basis and quadrature. More...  
const DataVector &  collocation_points (const Mesh< 1 > &mesh) noexcept 
Collocation points for a onedimensional mesh. More...  
const DataVector &  quadrature_weights (const Mesh< 1 > &mesh) noexcept 
Quadrature weights for a onedimensional mesh. More...  
template<Basis BasisType, Quadrature QuadratureType>  
const Matrix &  differentiation_matrix (size_t num_points) noexcept 
Matrix used to compute the derivative of a function. More...  
const Matrix &  differentiation_matrix (const Mesh< 1 > &mesh) noexcept 
Differentiation matrix for a onedimensional mesh. More...  
template<Basis BasisType, Quadrature QuadratureType>  
const Matrix &  spectral_to_grid_points_matrix (size_t num_points) noexcept 
Matrix used to transform from the spectral coefficients (modes) of a function to its nodal coefficients. Also referred to as the Vandermonde matrix. More...  
const Matrix &  spectral_to_grid_points_matrix (const Mesh< 1 > &mesh) noexcept 
Transformation matrix from modal to nodal coefficients for a onedimensional mesh. More...  
template<Basis BasisType, Quadrature QuadratureType>  
const Matrix &  grid_points_to_spectral_matrix (size_t num_points) noexcept 
Matrix used to transform from the nodal coefficients of a function to its spectral coefficients (modes). Also referred to as the inverse Vandermonde matrix. More...  
const Matrix &  grid_points_to_spectral_matrix (const Mesh< 1 > &mesh) noexcept 
Transformation matrix from nodal to modal coefficients for a onedimensional mesh. More...  
template<Basis BasisType, Quadrature QuadratureType>  
const Matrix &  linear_filter_matrix (size_t num_points) noexcept 
Matrix used to linearize a function. More...  
const Matrix &  linear_filter_matrix (const Mesh< 1 > &mesh) noexcept 
Linear filter matrix for a onedimensional mesh. More...  
Variables  
template<Basis , Quadrature >  
constexpr size_t  minimum_number_of_points {std::numeric_limits<size_t>::max()} 
Minimum number of possible collocation points for a quadrature type. More...  
template<Basis >  
constexpr size_t  maximum_number_of_points = 12 
Maximum number of allowed collocation points.  
Functionality associated with a particular choice of basis functions and quadrature for spectral operations.
The functions in this namespace provide lowlevel access to collocation points, quadrature weights and associated matrices, such as for differentiation and interpolation. They are available in two versions: either templated directly on the enum cases of the Spectral::Basis and Spectral::Quadrature types, or taking a onedimensional Mesh as their argument.
Most algorithms in this namespace are adapted from [16].

noexcept 
Collocation points for a onedimensional mesh.

noexcept 
Collocation points.
num_points  The number of collocation points 

noexcept 
Compute the collocation points and weights associated to the basis and quadrature.
This function is expected to return the tuple \((\xi_k,w_k)\) where the \(\xi_k\) are the collocation points and the \(w_k\) are defined in the description of quadrature_weights(size_t)
.

noexcept 
Matrix used to compute the derivative of a function.
For a function represented by the nodal coefficients \(u_j\) a matrix multiplication with the differentiation matrix \(D_{ij}\) gives the coefficients of the function's derivative. Since \(u(x)\) is expanded in Lagrange polynomials \(u(x)=\sum_j u_j l_j(x)\) the differentiation matrix is computed as \(D_{ij}=l_j^\prime(\xi_i)\) where the \(\xi_i\) are the collocation points.
num_points  The number of collocation points 
Differentiation matrix for a onedimensional mesh.

noexcept 
Matrix used to transform from the nodal coefficients of a function to its spectral coefficients (modes). Also referred to as the inverse Vandermonde matrix.
This is the inverse to the Vandermonde matrix \(\mathcal{V}\) computed in spectral_to_grid_points_matrix(size_t). It can be computed analytically for Gauss quadrature by evaluating \(\sum_j\mathcal{V}^{1}_{ij}u_j=\widetilde{u}_i= \frac{(u,\Phi_i)}{\gamma_i}\) for a Lagrange basis function \(u(x)=l_k(x)\) to find \(\mathcal{V}^{1}_{ij}=\mathcal{V}_{ji}\frac{w_j}{\gamma_i}\) where the \(w_j\) are the Gauss quadrature weights and \(\gamma_i\) is the norm square of the spectral basis function \(\Phi_i\).
num_points  The number of collocation points 
Transformation matrix from nodal to modal coefficients for a onedimensional mesh.

noexcept 
Matrix used to interpolate to the target_points
.
BasisType
(often \([1,1]\)), the resulting matrix performs polynomial extrapolation instead of interpolation. The extapolation will be correct but may suffer from reduced accuracy, especially for higherorder polynomials (i.e., larger values of num_points
).num_points  The number of collocation points 
target_points  The points to interpolate to 

noexcept 
Interpolation matrix to the target_points
for a onedimensional mesh.

noexcept 
Matrix used to linearize a function.
Filters out all except the lowest two modes by applying \(\mathcal{V}^{1}\cdot\mathrm{diag}(1,1,0,0,...)\cdot\mathcal{V}\) to the nodal coefficients, where \(\mathcal{V}\) is the Vandermonde matrix computed in spectral_to_grid_points_matrix(size_t)
.
num_points  The number of collocation points 
Linear filter matrix for a onedimensional mesh.

noexcept 
The projection matrix from a 1D mortar to an element.
The projection matrices returned by this function (and by projection_matrix_element_to_mortar()) define orthogonal projection operators between the spaces of functions on the boundary of the element and the mortar. These projections are usually the correct way to transfer data onto and off of the mortars.
The halfinterval projections are based on an equation derived by Saul. This shows that the projection from the spectral basis for the entire interval to the spectral basis for the upper half interval is
\begin{equation*} T_{jk} = \frac{2 j + 1}{2} 2^j \sum_{n=0}^{jk} \binom{j}{k+n} \binom{(j + k + n  1)/2}{j} \frac{(k + n)!^2}{(2 k + n + 1)! n!} \end{equation*}

noexcept 
Quadrature weights for a onedimensional mesh.

noexcept 
Weights to compute definite integrals.
These are the coefficients to contract with the nodal function values \(f_k\) to approximate the definite integral \(I[f]=\int f(x)\mathrm{d}x\).
Note that the term quadrature also often refers to the quantity \(Q[f]=\int f(x)w(x)\mathrm{d}x\approx \sum_k f_k w_k\). Here, \(w(x)\) denotes the basisspecific weight function w.r.t. to which the basis functions \(\Phi_k\) are orthogonal, i.e \(\int\Phi_i(x)\Phi_j(x)w(x)=0\) for \(i\neq j\). The weights \(w_k\) approximate this inner product. To approximate the definite integral \(I[f]\) we must employ the coefficients \(\frac{w_k}{w(\xi_k)}\) instead, where the \(\xi_k\) are the collocation points. These are the coefficients this function returns. Only for a unit weight function \(w(x)=1\), i.e. a Legendre basis, is \(I[f]=Q[f]\) so this function returns the \(w_k\) identically.
num_points  The number of collocation points 

noexcept 
Matrix used to transform from the spectral coefficients (modes) of a function to its nodal coefficients. Also referred to as the Vandermonde matrix.
The Vandermonde matrix is computed as \(\mathcal{V}_{ij}=\Phi_j(\xi_i)\) where the \(\Phi_j(x)\) are the spectral basis functions used in the modal expansion \(u(x)=\sum_j \widetilde{u}_j\Phi_j(x)\), e.g. normalized Legendre polynomials, and the \(\xi_i\) are the collocation points used to construct the interpolating Lagrange polynomials in the nodal expansion \(u(x)=\sum_j u_j l_j(x)\). Then the Vandermonde matrix arises as \(u(\xi_i)=u_i=\sum_j \widetilde{u}_j\Phi_j(\xi_i)=\sum_j \mathcal{V}_{ij}\widetilde{u}_j\).
num_points  The number of collocation points 
Transformation matrix from modal to nodal coefficients for a onedimensional mesh.
constexpr size_t Spectral::minimum_number_of_points {std::numeric_limits<size_t>::max()} 
Minimum number of possible collocation points for a quadrature type.
Since GaussLobatto quadrature has points on the domain boundaries it must have at least two collocation points. Gauss quadrature can have only one collocation point.