SpECTRE Documentation Coverage Report
Current view: top level - NumericalAlgorithms/Spectral - DifferentiationMatrix.hpp Hit Total Coverage
Commit: 1f2210958b4f38fdc0400907ee7c6d5af5111418 Lines: 6 7 85.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 Matrix;
      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             : /*!
      21             :  * \brief %Matrix used to compute the derivative of a function.
      22             :  *
      23             :  * \details For a function represented by the nodal coefficients \f$u_j\f$ a
      24             :  * matrix multiplication with the differentiation matrix \f$D_{ij}\f$ gives the
      25             :  * coefficients of the function's derivative. Since \f$u(x)\f$ is expanded in
      26             :  * Lagrange polynomials \f$u(x)=\sum_j u_j l_j(x)\f$ the differentiation matrix
      27             :  * is computed as \f$D_{ij}=l_j^\prime(\xi_i)\f$ where the \f$\xi_i\f$ are the
      28             :  * collocation points.
      29             :  *
      30             :  * The finite difference matrix uses summation by parts operators,
      31             :  * \f$D_{2-1}, D_{4-2}, D_{4-3}\f$, and \f$D_{6-5}\f$ from \cite Diener2005tn.
      32             :  *
      33             :  * \param num_points The number of collocation points
      34             :  */
      35             : template <Basis BasisType, Quadrature QuadratureType>
      36           1 : const Matrix& differentiation_matrix(size_t num_points);
      37             : template <Basis BasisType, Quadrature QuadratureType>
      38           1 : const Matrix& differentiation_matrix_transpose(size_t num_points);
      39             : /// @}
      40             : 
      41             : /// @{
      42             : /*!
      43             :  * \brief Differentiation matrix for a one-dimensional mesh.
      44             :  *
      45             :  * \see differentiation_matrix(size_t)
      46             :  */
      47           1 : const Matrix& differentiation_matrix(const Mesh<1>& mesh);
      48           1 : const Matrix& differentiation_matrix_transpose(const Mesh<1>& mesh);
      49             : /// @}
      50             : 
      51             : /*!
      52             :  * \brief %Matrix used to compute the divergence of the flux in weak form.
      53             :  *
      54             :  * This is the transpose of the differentiation matrix multiplied by quadrature
      55             :  * weights that appear in DG integrals:
      56             :  *
      57             :  * \begin{equation}
      58             :  * \frac{D^T_{ij}} \frac{w_j}{w_i}
      59             :  * \end{equation}
      60             :  *
      61             :  * \param num_points The number of collocation points
      62             :  */
      63             : template <Basis BasisType, Quadrature QuadratureType>
      64           1 : const Matrix& weak_flux_differentiation_matrix(size_t num_points);
      65             : 
      66             : /*!
      67             :  * \brief %Matrix used to compute the divergence of the flux in weak form.
      68             :  *
      69             :  * \see weak_flux_differentiation_matrix(size_t)
      70             :  */
      71           1 : const Matrix& weak_flux_differentiation_matrix(const Mesh<1>& mesh);
      72             : }  // namespace Spectral

Generated by: LCOV version 1.14