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 : #include <limits> 8 : 9 : #include "NumericalAlgorithms/Spectral/Basis.hpp" 10 : #include "NumericalAlgorithms/Spectral/Quadrature.hpp" 11 : 12 : namespace Spectral { 13 : namespace detail { 14 : constexpr size_t minimum_number_of_points(const Basis /*basis*/, 15 : const Quadrature quadrature) { 16 : // NOLINTNEXTLINE(bugprone-branch-clone) 17 : if (quadrature == Quadrature::Gauss) { 18 : return 1; 19 : // NOLINTNEXTLINE(bugprone-branch-clone) 20 : } else if (quadrature == Quadrature::GaussLobatto) { 21 : return 2; 22 : // NOLINTNEXTLINE(bugprone-branch-clone) 23 : } else if (quadrature == Quadrature::CellCentered) { 24 : return 1; 25 : // NOLINTNEXTLINE(bugprone-branch-clone) 26 : } else if (quadrature == Quadrature::FaceCentered) { 27 : return 2; 28 : // NOLINTNEXTLINE(bugprone-branch-clone) 29 : } else if (quadrature == Quadrature::Equiangular) { 30 : return 1; 31 : // NOLINTNEXTLINE(bugprone-branch-clone) 32 : } else if (quadrature == Quadrature::AxialSymmetry) { 33 : return 1; 34 : } else if (quadrature == Quadrature::SphericalSymmetry) { 35 : return 1; 36 : } 37 : return std::numeric_limits<size_t>::max(); 38 : } 39 : } // namespace detail 40 : 41 : /*! 42 : * \brief Minimum number of possible collocation points for a quadrature type. 43 : * 44 : * \details Since Gauss-Lobatto quadrature has points on the domain boundaries 45 : * it must have at least two collocation points. Gauss quadrature can have only 46 : * one collocation point. 47 : * 48 : * \details For `CellCentered` the minimum number of points is 1, while for 49 : * `FaceCentered` it is 2. 50 : */ 51 : template <Basis basis, Quadrature quadrature> 52 1 : constexpr size_t minimum_number_of_points = 53 : detail::minimum_number_of_points(basis, quadrature); 54 : } // namespace Spectral