NAG Library Function Document

1Purpose

nag_2d_triang_eval (e01skc) evaluates at a given point the two-dimensional interpolant function computed by nag_2d_triang_interp (e01sjc).

2Specification

 #include #include
 void nag_2d_triang_eval (Integer m, const double x[], const double y[], const double f[], const Integer triang[], const double grads[], double px, double py, double *pf, NagError *fail)

3Description

nag_2d_triang_eval (e01skc) takes as input the arguments defining the interpolant $F\left(x,y\right)$ of a set of scattered data points $\left({x}_{r},{y}_{r},{f}_{r}\right)$, for $\mathit{r}=1,2,\dots ,m$, as computed by nag_2d_shep_interp (e01sgc), and evaluates the interpolant at the point $\left(px,py\right)$.
If $\left(px,py\right)$ is equal to $\left({x}_{r},{y}_{r}\right)$ for some value of $r$, the returned value will be equal to ${f}_{r}$.
If $\left(px,py\right)$ is not equal to $\left({x}_{r},{y}_{r}\right)$ for any $r$, the derivatives in grads will be used to compute the interpolant. A triangle is sought which contains the point $\left(px,py\right)$, and the vertices of the triangle along with the partial derivatives and ${f}_{r}$ values at the vertices are used to compute the value $F\left(px,py\right)$. If the point $\left(px,py\right)$ lies outside the triangulation defined by the input arguments, the returned value is obtained by extrapolation. In this case, the interpolating function ${\mathbf{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).
nag_2d_triang_eval (e01skc) must only be called after a call to nag_2d_shep_interp (e01sgc).
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 ${C}^{1}$ interpolation method Rocky Mountain J. Math. 14 223–237

5Arguments

1:    $\mathbf{m}$IntegerInput
2:    $\mathbf{x}\left[{\mathbf{m}}\right]$const doubleInput
3:    $\mathbf{y}\left[{\mathbf{m}}\right]$const doubleInput
4:    $\mathbf{f}\left[{\mathbf{m}}\right]$const doubleInput
5:    $\mathbf{triang}\left[7×{\mathbf{m}}\right]$const IntegerInput
6:    $\mathbf{grads}\left[2×{\mathbf{m}}\right]$const doubleInput
On entry: m, x, y, f, triang and grads must be unchanged from the previous call of nag_2d_triang_interp (e01sjc).
7:    $\mathbf{px}$doubleInput
8:    $\mathbf{py}$doubleInput
On entry: the point $\left(px,py\right)$ at which the interpolant is to be evaluated.
9:    $\mathbf{pf}$double *Output
On exit: the value of the interpolant evaluated at the point $\left(px,py\right)$.
10:  $\mathbf{fail}$NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_INT
On entry, ${\mathbf{m}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{m}}\ge 3$.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
NE_TRIANG_INVALID
On entry, triang does not contain a valid data point triangulation; triang may have been corrupted since the call to nag_2d_triang_interp (e01sjc).
NW_VALUE_EXTRAPOLATED
Warning – the evaluation point $\left(〈\mathit{\text{value}}〉,〈\mathit{\text{value}}〉\right)$ lies outside the triangulation boundary. The returned value was computed by extrapolation.

7Accuracy

Computational errors should be negligible in most practical situations.

8Parallelism and Performance

nag_2d_triang_eval (e01skc) is not threaded in any implementation.

The time taken for a call of nag_2d_triang_eval (e01skc) is approximately proportional to the number of data points, $m$.