NAG FL Interface
e01ebf (dim2_​triang_​bary_​eval)

1 Purpose

e01ebf performs barycentric interpolation, at a given set of points, using a set of function values on a scattered grid and a triangulation of that grid computed by e01eaf.

2 Specification

Fortran Interface
Subroutine e01ebf ( m, n, x, y, f, triang, px, py, pf, ifail)
Integer, Intent (In) :: m, n, triang(7*n)
Integer, Intent (Inout) :: ifail
Real (Kind=nag_wp), Intent (In) :: x(n), y(n), f(n), px(m), py(m)
Real (Kind=nag_wp), Intent (Out) :: pf(m)
C Header Interface
#include <nag.h>
void  e01ebf_ (const Integer *m, const Integer *n, const double x[], const double y[], const double f[], const Integer triang[], const double px[], const double py[], double pf[], Integer *ifail)
The routine may be called by the names e01ebf or nagf_interp_dim2_triang_bary_eval.

3 Description

e01ebf takes as input a set of scattered data points xr,yr,fr , for r=1,2,,n, and a Thiessen triangulation of the xr,yr computed by e01eaf, and interpolates at a set of points pxi,pyi , for i=1,2,,m.
If the ith interpolation point pxi,pyi is equal to xr,yr for some value of r, the returned value will be equal to fr; otherwise a barycentric transformation will be used to calculate the interpolant.
For each point pxi,pyi , a triangle is sought which contains the point; the vertices of the triangle and fr values at the vertices are then used to compute the value F pxi,pyi .
If any interpolation point lies outside the triangulation defined by the input arguments, the returned value is the value provided, fs, at the closest node xs,ys .
e01ebf must only be called after a call to e01eaf.

4 References

Cline A K and Renka R L (1984) A storage-efficient method for construction of a Thiessen triangulation Rocky Mountain J. Math. 14 119–139
Lawson C L (1977) Software for C1 surface interpolation Mathematical Software III (ed J R Rice) 161–194 Academic Press
Renka R L (1984) Algorithm 624: triangulation and interpolation of arbitrarily distributed points in the plane ACM Trans. Math. Software 10 440–442
Renka R L and Cline A K (1984) A triangle-based C1 interpolation method Rocky Mountain J. Math. 14 223–237

5 Arguments

1: m Integer Input
On entry: m, the number of points to interpolate.
Constraint: m1.
2: n Integer Input
On entry: n, the number of data points. n must be unchanged from the previous call of e01eaf.
Constraint: n3.
3: xn Real (Kind=nag_wp) array Input
4: yn Real (Kind=nag_wp) array Input
On entry: the coordinates of the rth data point, xr,yr, for r=1,2,,n. x and y must be unchanged from the previous call of e01eaf.
5: fn Real (Kind=nag_wp) array Input
On entry: the function values fr at xr,yr, for r=1,2,,n.
6: triang7×n Integer array Input
On entry: the triangulation computed by the previous call of e01eaf. See Section 9 in e01eaf for details of how the triangulation used is encoded in triang.
7: pxm Real (Kind=nag_wp) array Input
8: pym Real (Kind=nag_wp) array Input
On entry: the coordinates pxi,pyi, for i=1,2,,m, at which interpolated function values are sought.
9: pfm Real (Kind=nag_wp) array Output
On exit: the interpolated values Fpxi,pyi, for i=1,2,,m.
10: ifail Integer Input/Output
On entry: ifail must be set to 0, -1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of -1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value -1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value 0 is recommended. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6 Error Indicators and Warnings

If on entry ifail=0 or -1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
ifail=1
On entry, n=value.
Constraint: n3.
ifail=2
On entry, m=value.
Constraint: m1.
ifail=3
On entry, the triangulation information held in the array triang does not specify a valid triangulation of the data points. triang has been corrupted since the call to e01eaf.
ifail=4
At least one evaluation point lies outside the nodal triangulation. For each such point the value returned in pf is that corresponding to a node on the closest boundary line segment.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

Not applicable.

8 Parallelism and Performance

e01ebf is not threaded in any implementation.

9 Further Comments

The time taken for a call of e01ebf is approximately proportional to the number of interpolation points, m.

10 Example

See Section 10 in e01eaf.