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 nodal coefficients of a function to 21 : * its spectral coefficients (modes). Also referred to as the inverse 22 : * _Vandermonde matrix_. 23 : * 24 : * \details This is the inverse to the Vandermonde matrix \f$\mathcal{V}\f$ 25 : * computed in modal_to_nodal_matrix(size_t). It can be computed 26 : * analytically for Gauss quadrature by evaluating 27 : * \f$\sum_j\mathcal{V}^{-1}_{ij}u_j=\widetilde{u}_i= 28 : * \frac{(u,\Phi_i)}{\gamma_i}\f$ 29 : * for a Lagrange basis function \f$u(x)=l_k(x)\f$ to find 30 : * \f$\mathcal{V}^{-1}_{ij}=\mathcal{V}_{ji}\frac{w_j}{\gamma_i}\f$ where the 31 : * \f$w_j\f$ are the Gauss quadrature weights and \f$\gamma_i\f$ is the norm 32 : * square of the spectral basis function \f$\Phi_i\f$. 33 : * 34 : * \param num_points The number of collocation points 35 : * 36 : * \see modal_to_nodal_matrix(size_t) 37 : */ 38 : template <Basis BasisType, Quadrature QuadratureType> 39 1 : const Matrix& nodal_to_modal_matrix(size_t num_points); 40 : 41 : /*! 42 : * \brief Transformation matrix from nodal to modal coefficients for a 43 : * one-dimensional mesh. 44 : * 45 : * \see nodal_to_modal_matrix(size_t) 46 : */ 47 1 : const Matrix& nodal_to_modal_matrix(const Mesh<1>& mesh); 48 : } // namespace Spectral