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 %Matrix used to transform from the spectral coefficients (modes) of a 43 : * function to its nodal coefficients. This two-index version is used for 44 : * two-dimensional basis function (i.e. Zernike with GaussRadauUpper 45 : * quadrature). 46 : * 47 : * For Zernike, \f$m\f$ is the angular index and \f$N\f$ is the 48 : * maximum supported spectral index (usually taken to be the maximum value, 49 : * \f$2 \, \texttt{num_points}-2\f$). Note that the size of a spectral space 50 : * vector is \f$(N - m) / 2 + 1\f$, using integer division. 51 : * 52 : * \see modal_to_nodal_matrix(size_t) 53 : */ 54 : template <Basis BasisType, Quadrature QuadratureType> 55 1 : const Matrix& modal_to_nodal_matrix(size_t num_points, size_t m, size_t N); 56 : 57 : /*! 58 : * \brief Transformation matrix from modal to nodal coefficients for a 59 : * one-dimensional mesh. 60 : * 61 : * \see modal_to_nodal_matrix(size_t) 62 : */ 63 1 : const Matrix& modal_to_nodal_matrix(const Mesh<1>& mesh); 64 : 65 : /*! 66 : * \brief Transformation matrix from modal to nodal coefficients for a 67 : * one-dimensional mesh with a Zernike basis. 68 : * 69 : * \see modal_to_nodal_matrix(size_t, size_t, size_t) 70 : */ 71 1 : const Matrix& modal_to_nodal_matrix(const Mesh<1>& mesh, size_t m, size_t N); 72 : } // namespace Spectral