.TH "integrate" 3rheolef "Version 7.2" "rheolef" \" -*- nroff -*- .ad l .nh .SH NAME integrate \- expression integration (rheolef-7\&.2) .SH "SYNOPSIS" .PP .PP .nf template Value integrate (geo domain, Expression, integrate_option iopt); .fi .PP .SH "DESCRIPTION" .PP This overloaded function is able to return either a scalar constant, a \fBfield(2)\fP or a bilinear \fBform(2)\fP, depending upon its arguments\&. .PP .IP "1." 4 When the expression involves both \fCtrial\fP and \fBtest(2)\fP functions, the result is a bilinear \fBform(2)\fP .IP "2." 4 When the expression involves either a \fCtrial\fP or a \fBtest(2)\fP function, the result is a linear form, represented by the \fBfield(2)\fP class .IP "3." 4 When the expression involves neither a \fCtrial\fP nor a \fBtest(2)\fP function, the result is a scalar constant .PP .PP The general call involves three arguments: .PP .IP "1." 4 the \fBgeo(2)\fP domain of integration .IP "2." 4 the expression to integrate .IP "3." 4 the \fBintegrate_option(3)\fP .PP .PP Here is the overloaded synopsis: .PP .nf Float integrate (geo domain, Expression, integrate_option iopt); field integrate (geo domain, Expression, integrate_option iopt); form integrate (geo domain, Expression, integrate_option iopt); .fi .PP .SH "OMITTED ARGUMENTS" .PP Some argument could be omitted when the expression involves a \fBtest(2)\fP function: .PP .IP "\(bu" 2 when the domain of integration is omitted, then it is taken as those of the \fBtest(2)\fP function .PP .PP The reduced synopsis is: .PP .nf field integrate (Expression, integrate_option iopt); form integrate (Expression, integrate_option iopt); .fi .PP .IP "\(bu" 2 when the \fBintegrate_option(3)\fP is omitted, then a Gauss quadrature formula is considered such that it integrates exactly \fC2*k+1\fP polynomials where \fCk\fP is the polynomial degree of the \fBtest(2)\fP function\&. When a \fCtrial\fP function is also involved, then this degree is \fCk1+k2+1\fP where \fCk1\fP and \fCk2\fP are the polynomial degree of the \fBtest(2)\fP and \fCtrial\fP functions\&. .PP .PP The reduced synopsis is: .PP .nf field integrate (geo domain, Expression); form integrate (geo domain, Expression); .fi .PP Both arguments could be omitted an the synopsis becomes: .PP .nf field integrate (Expression); form integrate (Expression); .fi .PP .SH "INTEGRATION OVER A SUBDOMAIN" .PP Let \fComega\fP be a finite element mesh of a geometric domain, as described by the \fBgeo(2)\fP class\&. A subdomain is defined by indexation, e\&.g\&. \fComega['left']\fP and, when a \fBtest(2)\fP function is involved, the \fComega\fP could be omitted, and only the string \fC'left'\fP has to be present e\&.g\&. .PP .nf test v (Xh); field lh = integrate ('left', 2*v); .fi .PP is equivalent to .PP .nf field lh = integrate (omega['left'], 2*v); .fi .PP .SH "MEASURE OF A DOMAIN" .PP Finally, when only the domain argument is provided, the \fCintegrate\fP function returns its measure: .PP .nf Float integrate (geo domain); .fi .PP .SH "EXAMPLES" .PP The computation of the measure of a domain: .PP .nf Float meas_omega = integrate (omega); Float meas_left = integrate (omega['left']); .fi .PP The integral of a function: .PP .nf Float f (const point& x) { return exp(x[0]+x[1]); } \&.\&.\&. integrate_option iopt; iopt\&.set_order (3); Float int_f = integrate (omega, f, iopt); .fi .PP The function can be replaced by any expression combining functions, class-functions and \fBfield(2)\fP\&. .PP The right-hand-side involved by the variational formulation .PP .nf space Xh (omega, 'P1'); test v (Xh); field lh = integrate (f*v); .fi .PP For a bilinear form: .PP .nf trial u (Xh); form m = integrate (u*v); form a = integrate (dot(grad(u),grad(v))); .fi .PP The expression can also combine functions, class-functions and \fBfield(2)\fP\&. .SH "IMPLEMENTATION" .PP This documentation has been generated from file main/lib/integrate\&.h .SH AUTHOR Pierre Saramito .SH COPYRIGHT Copyright (C) 2000-2018 Pierre Saramito GPLv3+: GNU GPL version 3 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.