NAG FL Interface
e01sbf (dim2_​scat_​eval)

1 Purpose

e01sbf evaluates at a given point the two-dimensional interpolant function computed by e01saf.

2 Specification

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

3 Description

e01sbf takes as input the arguments defining the interpolant Fx,y of a set of scattered data points xr,yr,fr, for r=1,2,,m, as computed by e01saf, and evaluates the interpolant at the point px,py.
If px,py is equal to xr,yr for some value of r, the returned value will be equal to fr.
If px,py is not equal to xr,yr for any r, the derivatives in grads will be used to compute the interpolant. A triangle is sought which contains the point px,py, and the vertices of the triangle along with the partial derivatives and fr values at the vertices are used to compute the value Fpx,py. If the point px,py lies outside the triangulation defined by the input arguments, the returned value is obtained by extrapolation. In this case, the interpolating function f is extended linearly beyond the triangulation boundary. The method is described in more detail in Renka and Cline (1984) and the code is derived from Renka (1984).
e01sbf must only be called after a call to e01saf.

4 References

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
2: xm Real (Kind=nag_wp) array Input
3: ym Real (Kind=nag_wp) array Input
4: fm Real (Kind=nag_wp) array Input
5: triang7×m Integer array Input
6: grads2m Real (Kind=nag_wp) array Input
On entry: m, x, y, f, triang and grads must be unchanged from the previous call of e01saf.
7: px Real (Kind=nag_wp) Input
8: py Real (Kind=nag_wp) Input
On entry: the point px,py at which the interpolant is to be evaluated.
9: pf Real (Kind=nag_wp) Output
On exit: the value of the interpolant evaluated at the point px,py.
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, m=value.
Constraint: m3.
ifail=2
On entry, triang does not contain a valid data point triangulation; triang may have been corrupted since the call to e01saf.
ifail=3
Warning – the evaluation point value,value lies outside the triangulation boundary. The returned value was computed by extrapolation.
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

Computational errors should be negligible in most practical situations.

8 Parallelism and Performance

e01sbf is not thread safe and should not be called from a multithreaded user program. Please see Section 1 in FL Interface Multithreading for more information on thread safety.
e01sbf is not threaded in any implementation.

9 Further Comments

The time taken for a call of e01sbf is approximately proportional to the number of data points, m.
The results returned by this routine are particularly suitable for applications such as graph plotting, producing a smooth surface from a number of scattered points.

10 Example

See Section 10 in e01saf.