Man pages sections > man4 > integrate

integrate - integrate a function or an expression

integrate(4rheolef) rheolef-6.7 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.

SYNOPSYS

 Float integrate (geo domain);
 Float integrate (geo domain, quadrature_option_type qopt);
 Value integrate (geo domain, Expression, quadrature_option_type qopt);
 field integrate (Expression);
 field integrate (Expression, quadrature_option_type qopt);
 field integrate (geo domain, Expression);
 field integrate (geo domain, Expression, quadrature_option_type qopt);
 form integrate (Expression);
 form integrate (Expression, form_option_type qopt);
 form integrate (geo domain, Expression);
 form integrate (geo domain, Expression, form_option_type 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_type qopt;
  qopt.set_order (3);
  Float int_f = integrate (omega, f, qopt);
 
The last argument specifies the quadrature formulae (see quadrature_option_type(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 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. 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);
  field l3h = integrate ("boundary", f*v);
 
For convenience, only the domain name can be supplied.
 

SEE ALSO

test(2), test(2), quadrature_option_type(2), field(2), field(2)
rheolef-6.7 rheolef-6.7