E02ZAF sorts two-dimensional data into rectangular panels.
SUBROUTINE E02ZAF ( |
PX, PY, LAMDA, MU, M, X, Y, POINT, NPOINT, ADRES, NADRES, IFAIL) |
INTEGER |
PX, PY, M, POINT(NPOINT), NPOINT, ADRES(NADRES), NADRES, IFAIL |
REAL (KIND=nag_wp) |
LAMDA(PX), MU(PY), X(M), Y(M) |
|
A set of
data points with rectangular Cartesian coordinates
are sorted into panels defined by lines parallel to the
and
axes. The intercepts of these lines on the
and
axes are given in
, for
and
, for
, respectively. The subroutine orders the data so that all points in a panel occur before data in succeeding panels, where the panels are numbered from bottom to top and then left to right, with the usual arrangement of axes, as shown in the diagram. Within a panel the points maintain their original order.
Figure 1
A data point lying exactly on one or more panel sides is taken to be in the highest-numbered panel adjacent to the point. The subroutine does not physically rearrange the data, but provides the array
POINT which contains a linked list for each panel, pointing to the data in that panel. The total number of panels is
.
None.
- 1: – INTEGERInput
- 2: – INTEGERInput
-
On entry:
PX and
PY must specify eight more than the number of intercepts on the
axis and
axis, respectively.
Constraint:
and .
- 3: – REAL (KIND=nag_wp) arrayInput
-
On entry: to must contain, in nondecreasing order, the intercepts on the axis of the sides of the panels parallel to the axis.
- 4: – REAL (KIND=nag_wp) arrayInput
-
On entry: to must contain, in nondecreasing order, the intercepts on the axis of the sides of the panels parallel to the axis.
- 5: – INTEGERInput
-
On entry: the number of data points.
- 6: – REAL (KIND=nag_wp) arrayInput
- 7: – REAL (KIND=nag_wp) arrayInput
-
On entry: the coordinates of the
th data point , for .
- 8: – INTEGER arrayOutput
-
On exit: for
,
is the index of the first point in panel
,
is the index of the second point in panel
and so on.
indicates that was the last point in the panel.
The coordinates of points in panel
can be accessed in turn by means of the following instructions:
IN = M + I
10 IN = POINT(IN)
IF (IN.EQ. 0) GOTO 20
XI = X(IN)
YI = Y(IN)
.
.
.
GOTO 10
20 ...
- 9: – INTEGERInput
-
On entry: the dimension of the array
POINT as declared in the (sub)program from which E02ZAF is called.
Constraint:
.
- 10: – INTEGER arrayWorkspace
- 11: – INTEGERInput
-
On entry: the value , the number of panels into which the plane is divided.
- 12: – INTEGERInput/Output
-
On entry:
IFAIL must be set to
,
. If you are unfamiliar with this parameter you should refer to
Section 3.3 in the Essential Introduction 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 parameter, 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).
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Not applicable.
Not applicable.
This subroutine was written to sort two-dimensional data in the manner required by routine
E02DAF. The first
parameters of E02ZAF are the same as the parameters in
E02DAF which have the same name.
This example reads in data points and the intercepts of the panel sides on the
and
axes; it calls E02ZAF to set up the index array
POINT; and finally it prints the data points in panel order.