`expression`

involved by interpolate and integrate

# Synopsis

    template <class Expression>
    field interpolate (const space& Xh, const Expression& expr);

    template <class Expression>
    Result integrate (const Expression& expr);

# Description

The expressions involved by `interpolate` and `integrate` functions base on several predefined operators and functions that are reviewed here. Let `phi`, `psi` be two scalar-valued `field` or `test` objects. Similarly, let `u`, `v` be two vector-valued objects and `sigma` and `tau` be two tensor-valued objects. In the following table, the indexes i and j are summed from 0 to d-1 where d is the dimension of the physical geometry, as described by the `geo` class.

    c++ code                | mathematics
    ------------------------+----------------------------------------------
    dot(u,v)                | u.v = sum_i u_i v_i
    ddot(sigma,tau)         | sigma:tau = sum_ij sigma_ij tau_ij
    tr(sigma)               | sum_i sigma_ii
    trans(sigma)            | sigma^T the transpose
    sqr(phi), norm2(phi)    | phi^2
    norm2(u)                | sum_i u_i^2
    norm2(sigma)            | sum_ij sigma_ij^2
    abs(phi), norm(phi)     | absolute value
    norm(u)                 | sqrt(norm2(u))
    norm(sigma)             | sqrt(norm2(sigma))
    ------------------------+----------------------------------------------
    grad(phi)               | (d phi/d x_i)_i
    grad(u)                 | (d u_i/d x_j)_ij
    D(u)                    | (grad(u) + grad(u)^T)/2
    div(u)                  | sum_i d u_i/d x_i = tr(D(u))
    curl(phi)               | (d phi/d x_1, - d phi/d x_0) when d=2
    curl(u)                 | grad^u when d=3
    ------------------------+----------------------------------------------
    normal()                | n, the outward unit normal
    grad_s(phi)             | P*grad(phi) where P = I - n otimes n
    grad_s(u)               | grad(u)*P
    Ds(u)                   | P*D(u)*P
    div_s(u)                | tr(Ds(u))
    ------------------------+----------------------------------------------
    grad_h(phi)             | grad(phi|K) broken gradient, piecewise
    div_h(u)                | div(u|K)
    Dh(u)                   | D(u|K)
    ------------------------+----------------------------------------------
    jump(phi)               | [phi] = phi|K0 - phi|K1
                            |         on an oriented side S = dK0 inter dK1
    average(phi)            | {phi} = (phi|K0 + phi|K1)/2
    inner(phi)              | phi|K0
    outer(phi)              | phi|K1
    h_local()               | meas(K)^(1/d)
    penalty()               | max(meas(dK0)/meas(K0), meas(dK1)/meas(K1))
    ------------------------+----------------------------------------------
    sin, cos, tan, acos,    | standard math function extended to field
    asin, atan, cosh, sinh, | and test functions
    tanh, log, log10, floor |
    ceil                    |
    pow(phi,psi)            |
    atan2(phi,psi)          | atan(psi/phi)
    fmod(phi,psi)           | phi - floor(phi/psi+0.5)*psi
    min(phi,psi)            |
    max(phi,psi)            |
    ------------------------+----------------------------------------------
    compose(f,phi)          | f(phi), for a given function f
    compose(f,phi1,..,phin) | f(phi0,...,phin)
    compose(phi,X)          | phi(X) for a characteristic X

See also `compose` and `characteristic` for details.

# Implementation

The practical implementation of expressions involved by `interpolate` and `integrate` functions bases on two very classical C++ idioms: the expression template and the Substitution failure is not an error (SFINAE). These C++ idioms are described in the following book:

D. Vandevoorde and N. M. Josuttis, C++ templates: the complete guide, Addison-Wesley, 2002