NAG FL Interface
e01saf (dim2_scat)
1
Purpose
e01saf generates a two-dimensional surface interpolating a set of scattered data points, using the method of Renka and Cline.
2
Specification
Fortran Interface
Integer, Intent (In) |
:: |
m |
Integer, Intent (Inout) |
:: |
ifail |
Integer, Intent (Out) |
:: |
triang(7*m) |
Real (Kind=nag_wp), Intent (In) |
:: |
x(m), y(m), f(m) |
Real (Kind=nag_wp), Intent (Out) |
:: |
grads(2,m) |
|
C Header Interface
#include <nag.h>
void |
e01saf_ (const Integer *m, const double x[], const double y[], const double f[], Integer triang[], double grads[], Integer *ifail) |
|
C++ Header Interface
#include <nag.h> extern "C" {
void |
e01saf_ (const Integer &m, const double x[], const double y[], const double f[], Integer triang[], double grads[], Integer &ifail) |
}
|
The routine may be called by the names e01saf or nagf_interp_dim2_scat.
3
Description
e01saf constructs an interpolating surface
through a set of scattered data points , for , using a method due to Renka and Cline. In the plane, the data points must be distinct. The constructed surface is continuous and has continuous first derivatives.
The method involves firstly creating a triangulation with all the
data points as nodes, the triangulation being as nearly equiangular as possible (see
Cline and Renka (1984)). Then gradients in the
- and
-directions are estimated at node
, for
,
as the partial derivatives of a quadratic function of
and
which interpolates the data value
,
and which fits the data values at nearby nodes (those within a certain distance chosen by the algorithm) in a weighted least squares sense. The weights are chosen such that closer nodes have more influence than more distant nodes on derivative estimates at node
. The computed partial derivatives, with the
values, at the three nodes of each triangle define a piecewise polynomial surface of a certain form which is the interpolant on that triangle. See
Renka and Cline (1984) for more detailed information on the algorithm,
a development of that by
Lawson (1977). The code is derived from
Renka (1984).
The interpolant
can subsequently be evaluated at any point
inside or outside the domain of the data by a call to
e01sbf.
Points outside the domain are evaluated by extrapolation.
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 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 interpolation method Rocky Mountain J. Math. 14 223–237
5
Arguments
-
1:
– Integer
Input
-
On entry: , the number of data points.
Constraint:
.
-
2:
– Real (Kind=nag_wp) array
Input
-
3:
– Real (Kind=nag_wp) array
Input
-
4:
– Real (Kind=nag_wp) array
Input
-
On entry: the coordinates of the
th data point, for
. The data points are accepted in any order, but see
Section 9.
Constraint:
the nodes must not all be collinear, and each node must be unique.
-
5:
– Integer array
Output
-
On exit: a data structure defining the computed triangulation, in a form suitable for passing to
e01sbf.
-
6:
– Real (Kind=nag_wp) array
Output
-
On exit: the estimated partial derivatives at the nodes, in a form suitable for passing to
e01sbf. The derivatives at node
with respect to
and
are contained in
and
respectively, for
.
-
7:
– Integer
Input/Output
-
On entry:
ifail must be set to
,
. If you are unfamiliar with this argument you should refer to
Section 4 in the Introduction to the NAG Library FL Interface for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this argument, the recommended value is
.
When the value is used it is essential to test the value of ifail on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6
Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
Errors or warnings detected by the routine:
-
On entry, .
Constraint: .
-
All nodes are collinear. There is no unique solution.
-
On entry, , for , , .
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.
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.
Dynamic memory allocation failed.
See
Section 9 in the Introduction to the NAG Library FL Interface for further information.
7
Accuracy
On successful exit, the computational errors should be negligible in most situations but you should always check the computed surface for acceptability, by drawing contours for instance. The surface always interpolates the input data exactly.
8
Parallelism and Performance
e01saf is not threaded in any implementation.
The time taken for a call of
e01saf is approximately proportional to the number of data points,
. The routine is more efficient if, before entry, the values in
x,
y and
f are arranged so that the
x array is in ascending order.
10
Example
This example reads in a set of
data points and calls
e01saf
to construct an interpolating surface. It then calls
e01sbf
to evaluate the interpolant at a sample of points on a rectangular grid.
Note that this example is not typical of a realistic problem: the number of data points would normally be larger, and the interpolant would need to be evaluated on a finer grid to obtain an accurate plot, say.
10.1
Program Text
10.2
Program Data
10.3
Program Results