Line data Source code
1 1 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : /// \file 5 : /// Defines function definite_integral. 6 : 7 : #pragma once 8 : 9 : #include <cstddef> 10 : 11 : /// \cond 12 : class DataVector; 13 : template <size_t> 14 : class Mesh; 15 : /// \endcond 16 : 17 : /*! 18 : * \ingroup NumericalAlgorithmsGroup 19 : * \brief Compute the definite integral of a function over a manifold. 20 : * 21 : * Given a function \f$f\f$, compute its integral \f$I\f$ with respect to 22 : * the logical coordinates \f$\boldsymbol{\xi} = (\xi, \eta, \zeta)\f$. 23 : * E.g., in 1 dimension, \f$I = \int_{-1}^1 f d\xi\f$. 24 : * 25 : * The integral w.r.t. a different set of coordinates 26 : * \f$\boldsymbol{x} = \boldsymbol{x}(\boldsymbol{\xi})\f$ can be computed 27 : * by pre-multiplying \f$f\f$ by the Jacobian determinant 28 : * \f$J = \det d\boldsymbol{x}/d\boldsymbol{\xi}\f$ of the mapping 29 : * \f$\boldsymbol{x}(\boldsymbol{\xi})\f$. Note that, in the 30 : * \f$\boldsymbol{x}\f$ coordinates, the domain of integration is the image of 31 : * the logical cube (square in 2D, interval in 1D) under the mapping. 32 : * 33 : * The integral is computed by quadrature, using the quadrature rule for the 34 : * basis associated with the collocation points. 35 : * 36 : * \param integrand the function to integrate. 37 : * \param mesh the Mesh defining the grid points on the manifold. 38 : */ 39 : template <size_t Dim> 40 1 : double definite_integral(const DataVector& integrand, const Mesh<Dim>& mesh);