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 : * If the mesh uses a Cartoon basis, the passed integrand must already be
37 : * multiplied by the appropriate Jacobian determinants (i.e. both the
38 : * $\boldsymbol{x}(\boldsymbol{\xi})$ and the cartesian to spherical/polar
39 : * coordinates mappings, the latter being either $x^2$ or $x$, respectively). If
40 : * the Mesh uses a Zernike basis, the passed integrand must already be
41 : * multiplied by the appropriate cartesian to spherical/polar Jacobain
42 : * determinant ($r$ for ZernikeB2 and $r^2$ for ZernikeB3).
43 : *
44 : * \param integrand the function to integrate.
45 : * \param mesh the Mesh defining the grid points on the manifold.
46 : */
47 : template <size_t Dim>
48 1 : double definite_integral(const DataVector& integrand, const Mesh<Dim>& mesh);
|