SpECTRE Documentation Coverage Report
Current view: top level - NumericalAlgorithms/Spectral - QuadratureWeights.hpp Hit Total Coverage
Commit: 1f2210958b4f38fdc0400907ee7c6d5af5111418 Lines: 2 3 66.7 %
Date: 2025-12-05 05:03:31
Legend: Lines: hit not hit

          Line data    Source code
       1           0 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : #pragma once
       5             : 
       6             : #include <cstddef>
       7             : 
       8             : /// \cond
       9             : class DataVector;
      10             : template <size_t>
      11             : class Mesh;
      12             : namespace Spectral {
      13             : enum class Basis : uint8_t;
      14             : enum class Quadrature : uint8_t;
      15             : }  // namespace Spectral
      16             : /// \endcond
      17             : 
      18             : namespace Spectral {
      19             : /*!
      20             :  * \brief Weights to compute definite integrals.
      21             :  *
      22             :  * \details These are the coefficients to contract with the nodal
      23             :  * function values \f$f_k\f$ to approximate the definite integral \f$I[f]=\int
      24             :  * f(x)\mathrm{d}x\f$.
      25             :  *
      26             :  * Note that the term _quadrature_ also often refers to the quantity
      27             :  * \f$Q[f]=\int f(x)w(x)\mathrm{d}x\approx \sum_k f_k w_k\f$. Here, \f$w(x)\f$
      28             :  * denotes the basis-specific weight function w.r.t. to which the basis
      29             :  * functions \f$\Phi_k\f$ are orthogonal, i.e \f$\int\Phi_i(x)\Phi_j(x)w(x)=0\f$
      30             :  * for \f$i\neq j\f$. The weights \f$w_k\f$ approximate this inner product. To
      31             :  * approximate the definite integral \f$I[f]\f$ we must employ the
      32             :  * coefficients \f$\frac{w_k}{w(\xi_k)}\f$ instead, where the \f$\xi_k\f$ are
      33             :  * the collocation points. These are the coefficients this function returns.
      34             :  * Only for a unit weight function \f$w(x)=1\f$, i.e. a Legendre basis, is
      35             :  * \f$I[f]=Q[f]\f$ so this function returns the \f$w_k\f$ identically.
      36             :  *
      37             :  * For a `FiniteDifference` basis or `CellCentered` and `FaceCentered`
      38             :  * quadratures, the interpretation of the quadrature weights in term
      39             :  * of an approximation to \f$I(q)\f$ remains correct, but its explanation
      40             :  * in terms of orthonormal basis is not, i.e. we set \f$w_k\f$ to the grid
      41             :  * spacing at each point, and the inverse weight \f$\frac{1}{w(\xi_k)}=1\f$ to
      42             :  * recover the midpoint method for definite integrals.
      43             :  *
      44             :  * \param num_points The number of collocation points
      45             :  */
      46             : template <Basis BasisType, Quadrature QuadratureType>
      47           1 : const DataVector& quadrature_weights(size_t num_points);
      48             : 
      49             : /*!
      50             :  * \brief Quadrature weights for a one-dimensional mesh.
      51             :  *
      52             :  * \see quadrature_weights(size_t)
      53             :  */
      54           1 : const DataVector& quadrature_weights(const Mesh<1>& mesh);
      55             : }  // namespace Spectral

Generated by: LCOV version 1.14