Integrate a function or an expression
Integrate an expression over a domain by using a quadrature formulae. There are three main usages of the integrate function, depending upon the type of the expression. (i) When the expression is a numerical one, it leads to a numerical value. (ii) When the expression involves a symbolic test-function see test(2), the result is a linear form, represented by the field class. (iii) When the expression involves both symbolic trial- and test-functions see test(2), the result is a bilinear form, represented by the field class.
template <class T, class M, class Expr> T integrate (const geo_basic<T,M>& omega, Expr expr, quadrature_option_type qopt) template <class T, class M, class Expr> field integrate (const geo_basic<T,M>& omega, VFExpr expr, quadrature_option_type qopt) template <class T, class M, class Expr> form integrate (const geo_basic<T,M>& omega, VFExpr expr, form_option_type fopt)
Float f (const point& x); ... quadrature_option_type qopt; Float value = integrate (omega, f, qopt); field lh = integrate (omega, f*v, qopt);
The last argument specifies the quadrature formulae used for the computation of the integral. The expression can be any function, classs-function or any linear or nonlinear field expression see field(2).
In the case of a linear form, the domain is optional: by default it is the full domain definition of the test function.
field l1h = integrate (f*v, qopt);
When the integration is perfomed on a subdomain, this subdomain simply replace the first argument and a domain name could also be used:
field l2h = integrate (omega["boundary"], f*v, qopt); field l3h = integrate ("boundary", f*v, qopt);
The quadrature formulae is required, except when a test and/or trial function is provided in the expression to integrate. In that case, the quadrature formulae is deduced from the space containing the test (or trial) function. When a test function is suppied, let k be its polynomial degree. Then the default quadrature is choosen to be exact at least for 2*k+1 polynoms. When both a test and trial functions are suppied, let k1 and k2 be their polynomial degrees. Then the default quadrature is choosen to be exact at least for k1+k2+1 polynoms. Also, when the expression is a constant, the quadrature function is optional: in that case, the constant is also optional and the following call:
Float meas = integrate (omega);
is valid and returns the measure of the domain.
test(2), test(2), field(2)