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 : * \brief %Matrix used to transform from the spectral coefficients (modes) of a 21 : * function to its nodal coefficients. Also referred to as the _Vandermonde 22 : * matrix_. 23 : * 24 : * \details The Vandermonde matrix is computed as 25 : * \f$\mathcal{V}_{ij}=\Phi_j(\xi_i)\f$ where the \f$\Phi_j(x)\f$ are the 26 : * spectral basis functions used in the modal expansion 27 : * \f$u(x)=\sum_j \widetilde{u}_j\Phi_j(x)\f$, e.g. normalized Legendre 28 : * polynomials, and the \f$\xi_i\f$ are the collocation points used to construct 29 : * the interpolating Lagrange polynomials in the nodal expansion 30 : * \f$u(x)=\sum_j u_j l_j(x)\f$. Then the Vandermonde matrix arises as 31 : * \f$u(\xi_i)=u_i=\sum_j \widetilde{u}_j\Phi_j(\xi_i)=\sum_j 32 : * \mathcal{V}_{ij}\widetilde{u}_j\f$. 33 : * 34 : * \param num_points The number of collocation points 35 : 36 : * \see nodal_to_modal_matrix(size_t) 37 : */ 38 : template <Basis BasisType, Quadrature QuadratureType> 39 1 : const Matrix& modal_to_nodal_matrix(size_t num_points); 40 : 41 : /*! 42 : * \brief Transformation matrix from modal to nodal coefficients for a 43 : * one-dimensional mesh. 44 : * 45 : * \see modal_to_nodal_matrix(size_t) 46 : */ 47 1 : const Matrix& modal_to_nodal_matrix(const Mesh<1>& mesh); 48 : } // namespace Spectral