---
name: "interpolate"
section: "3rheolef"
platform: "linux"
package: "librheolef-dev"
version: "7.2-4"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/interpolate/3rheolef"
---

# interpolate(3rheolef)

function or expression interpolation (rheolef-7.2)

## NAME

interpolate - function or expression interpolation (rheolef-7.2)

## DESCRIPTION

The `interpolation` function implements the usual Lagrange interpolation of a function or a class-function on a finite element **space(2)**.

## SYNOPSIS

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

 Example The following code compute the Lagrange interpolation `pi_h_u` the function `u(x)`:

```
   Float u(const point& x) { return exp(x[0]*x[1]); }
   ...
   geo omega('square');
   space Xh (omega, 'P1');
   field pi_h_u = interpolate (Xh, u);
```

## EXPRESSIONS

It is possible to interpolate an expression involving a combination of functions, class-functions and fields:

```
    field vh = interpolate (Xh, sqrt(uh) + 2*max(0.,uh));
```

## REINTERPOLATION

The reinterpolation of a field on another mesh or on another finite element space is also possible:

```
    geo omega2 ('square2');
    space X2h (omega2, 'P1');
    field uh2 = interpolate (X2h, pi_h_u);
```

 Such a reinterpolation is very frequent in mesh adaptive loops.

## IMPLEMENTATION

This documentation has been generated from file main/lib/interpolate.h

The implementation of expressions bases on the `expression template` and `SFINAE` C++ idioms.

## AUTHOR

Pierre  Saramito  \<Pierre.Saramito@imag.fr\>

## 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.
