1@doc raw""" 2 gauss_quadrature(q) 3 4Return the Gauss-Legendre quadrature rule with `q` points (integrates polynomials of degree 5$2q-1$ exactly). 6 7A tuple `(x,w)` is returned. 8""" 9function gauss_quadrature(q) 10 x = zeros(CeedScalar, q) 11 w = zeros(CeedScalar, q) 12 C.CeedGaussQuadrature(q, x, w) 13 x, w 14end 15 16struct QuadratureMode{T} end 17const Abscissa = QuadratureMode{:Abscissa}() 18const AbscissaAndWeights = QuadratureMode{:AbscissaAndWeights}() 19 20@doc raw""" 21 lobatto_quadrature(q, mode::Mode=Abscissa) 22 23Return the Gauss-Lobatto quadrature rule with `q` points (integrates polynomials of degree 24$2q-3$ exactly). 25 26If `mode` is `AbscissaAndWeights`, then both the weights and abscissa are returned as a 27tuple `(x,w)`. 28 29Otherwise, (if `mode` is `Abscissa`), then only the abscissa `x` are returned. 30""" 31function lobatto_quadrature(q, mode::Mode=Abscissa) where {Mode} 32 return_weights = (mode == AbscissaAndWeights) 33 x = zeros(CeedScalar, q) 34 w = (return_weights) ? zeros(CeedScalar, q) : C_NULL 35 C.CeedLobattoQuadrature(q, x, w) 36 return_weights ? (x, w) : x 37end 38