Scroll to navigation

integrate(4rheolef) rheolef-7.0 integrate(4rheolef)

NAME

integrate - integrate a function or an expression

DESCRIPTION

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.

SYNOPSIS


Float integrate (geo domain);
Float integrate (geo domain, quadrature_option qopt);
Value integrate (geo domain, Expression, quadrature_option qopt);

field integrate (Expression);
field integrate (Expression, quadrature_option qopt);
field integrate (geo domain, Expression);
field integrate (geo domain, Expression, quadrature_option qopt);

form integrate (Expression);
form integrate (Expression, integrate_option qopt);
form integrate (geo domain, Expression);
form integrate (geo domain, Expression, integrate_option qopt);

EXAMPLE

For computing the measure of a domain:


Float meas_omega = integrate (omega);
For computing the integral of a function:


Float f (const point& x);
...
quadrature_option qopt;
qopt.set_order (3);
Float int_f = integrate (omega, f, qopt);
The last argument specifies the quadrature formulae (see quadrature_option(2)) used for the computation of the integral. The function can be replaced by any field-valued expression (see field(2)). For computing a right-hand-side of a variational formulation with the previous function f:


space Xh (omega, "P1");
test v (Xh);
field lh = integrate (f*v);
For computing a bilinear form:


trial u (Xh);
test v (Xh);
form m = integrate (u*v);
The expression u*v can be replaced by any bilinear expression (see field(2)).

DEFAULT ARGUMENTS

In the case of a linear or bilinear form, the domain is optional: by default it is the full domain definition of the test function. Also, the quadrature formulae is optional: by default, its order is 2*k+1 where k is the polynomial degree of the Xh space associated to the test function v. When both a test u and trial v functions are supplied, let k1 and k2 be their polynomial degrees. Then the default quadrature is chosen to be exact at least for k1+k2+1 polynoms. When the integration is performed 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);
field l3h = integrate ("boundary", f*v);
For convenience, only the domain name can be supplied.

SEE ALSO

test(2), test(2), quadrature_option(2), field(2), field(2)

COPYRIGHT

Copyright (C) 2000-2018 Pierre Saramito <Pierre.Saramito@imag.fr> GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

rheolef-7.0 rheolef-7.0