# NAG Library Routine Document

## 1Purpose

d03ryf is designed to be used in conjunction with d03rbf. It can be called from the inidom to check the user-specified initial grid data and to obtain a simple graphical representation of the initial grid.

## 2Specification

Fortran Interface
 Subroutine d03ryf ( nx, ny, npts, lrow, irow, icol, lbnd, iwk,
 Integer, Intent (In) :: nx, ny, npts, nrows, nbnds, nbpts, lrow(nrows), irow(nrows), icol(npts), llbnd(nbnds), ilbnd(nbnds), lbnd(nbpts), leniwk Integer, Intent (Inout) :: ifail Integer, Intent (Out) :: iwk(leniwk) Character (*), Intent (Out) :: pgrid(ny)
#include nagmk26.h
 void d03ryf_ (const Integer *nx, const Integer *ny, const Integer *npts, const Integer *nrows, const Integer *nbnds, const Integer *nbpts, const Integer lrow[], const Integer irow[], const Integer icol[], const Integer llbnd[], const Integer ilbnd[], const Integer lbnd[], Integer iwk[], const Integer *leniwk, char pgrid[], Integer *ifail, const Charlen length_pgrid)

## 3Description

d03ryf outputs a character array which can be printed to provide a simple graphical representation of the virtual and base grids supplied to d03rbf. It must be called only from within the inidom after all output arguments of inidom (other than ierr) have been set. d03ryf also checks the validity of the grid data specified in inidom.
You are strongly advised to call d03ryf during the initial call of d03rbf (at least) and to print the resulting character array in order to check that the base grid is exactly as required.
d03ryf writes a representation of each point in the virtual and base grids to the character array pgrid as follows:
 – internal base grid points are written as two dots (..); – boundary base grid points are written as the ilbnd value (i.e., the type) of the boundary; – points external to the base grid are written as XX.
As an example, consider a rectangular domain with a rectangular hole in which the virtual domain extends by one base grid point beyond the actual domain in all directions. The output when each row of pgrid is printed consecutively is as follows:
``` XX XX XX XX XX XX XX XX XX XX XX XX XX XX
XX 23  3  3  3  3  3  3  3  3  3  3 34 XX
XX  2 .. .. .. .. .. .. .. .. .. ..  4 XX
XX  2 .. .. .. .. .. .. .. .. .. ..  4 XX
XX  2 .. .. 14  1  1  1  1 21 .. ..  4 XX
XX  2 .. ..  4 XX XX XX XX  2 .. ..  4 XX
XX  2 .. ..  4 XX XX XX XX  2 .. ..  4 XX
XX  2 .. ..  4 XX XX XX XX  2 .. ..  4 XX
XX  2 .. ..  4 XX XX XX XX  2 .. ..  4 XX
XX  2 .. ..  4 XX XX XX XX  2 .. ..  4 XX
XX  2 .. .. 43  3  3  3  3 32 .. ..  4 XX
XX  2 .. .. .. .. .. .. .. .. .. ..  4 XX
XX  2 .. .. .. .. .. .. .. .. .. ..  4 XX
XX 12  1  1  1  1  1  1  1  1  1  1 41 XX
XX XX XX XX XX XX XX XX XX XX XX XX XX XX```

None.

## 5Arguments

1:     $\mathbf{nx}$ – IntegerInput
2:     $\mathbf{ny}$ – IntegerInput
On entry: the number of virtual grid points in the $x$- and $y$-direction respectively (including the boundary points).
Constraint: nx and ${\mathbf{ny}}\ge 4$.
3:     $\mathbf{npts}$ – IntegerInput
On entry: the total number of points in the base grid.
Constraint: ${\mathbf{npts}}\le {\mathbf{nx}}×{\mathbf{ny}}$.
4:     $\mathbf{nrows}$ – IntegerInput
On entry: the total number of rows of the virtual grid that contain base grid points.
Constraint: $4\le {\mathbf{nrows}}\le {\mathbf{ny}}$.
5:     $\mathbf{nbnds}$ – IntegerInput
On entry: the total number of physical boundaries and corners in the base grid.
Constraint: ${\mathbf{nbnds}}\ge 8$.
6:     $\mathbf{nbpts}$ – IntegerInput
On entry: the total number of boundary points in the base grid.
Constraint: $12\le {\mathbf{nbpts}}<{\mathbf{npts}}$.
7:     $\mathbf{lrow}\left({\mathbf{nrows}}\right)$ – Integer arrayInput
On entry: ${\mathbf{lrow}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{nrows}}$, contains the base grid index of the first grid point in base grid row $\mathit{i}$.
Constraints:
• $1\le {\mathbf{lrow}}\left(\mathit{i}\right)\le {\mathbf{npts}}$, for $\mathit{i}=1,2,\dots ,{\mathbf{nrows}}$;
• ${\mathbf{lrow}}\left(\mathit{i}-1\right)<{\mathbf{lrow}}\left(\mathit{i}\right)$, for $\mathit{i}=2,3,\dots ,{\mathbf{nrows}}$.
8:     $\mathbf{irow}\left({\mathbf{nrows}}\right)$ – Integer arrayInput
On entry: ${\mathbf{irow}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{nrows}}$, contains the virtual grid row number that corresponds to base grid row $\mathit{i}$.
Constraints:
• $0\le {\mathbf{irow}}\left(\mathit{i}\right)\le {\mathbf{ny}}$, for $\mathit{i}=1,2,\dots ,{\mathbf{nrows}}$;
• ${\mathbf{irow}}\left(\mathit{i}-1\right)<{\mathbf{irow}}\left(\mathit{i}\right)$, for $\mathit{i}=2,3,\dots ,{\mathbf{nrows}}$.
9:     $\mathbf{icol}\left({\mathbf{npts}}\right)$ – Integer arrayInput
On entry: ${\mathbf{icol}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{npts}}$, contains the virtual grid column number that contains base grid point $\mathit{i}$.
Constraint: $0\le {\mathbf{icol}}\left(\mathit{i}\right)\le {\mathbf{nx}}$, for $\mathit{i}=1,2,\dots ,{\mathbf{npts}}$.
10:   $\mathbf{llbnd}\left({\mathbf{nbnds}}\right)$ – Integer arrayInput
On entry: ${\mathbf{llbnd}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{nbnds}}$, contains the element of lbnd corresponding to the start of the $\mathit{i}$th boundary (or corner).
Constraints:
• $1\le {\mathbf{llbnd}}\left(\mathit{i}\right)\le {\mathbf{nbpts}}$, for $\mathit{i}=1,2,\dots ,{\mathbf{nbnds}}$;
• ${\mathbf{llbnd}}\left(\mathit{i}-1\right)<{\mathbf{llbnd}}\left(\mathit{i}\right)$, for $\mathit{i}=2,3,\dots ,{\mathbf{nbnds}}$.
11:   $\mathbf{ilbnd}\left({\mathbf{nbnds}}\right)$ – Integer arrayInput
On entry: ${\mathbf{ilbnd}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{nbnds}}$, contains the type of the $\mathit{i}$th boundary (or corner), as defined in d03rbf.
Constraint: ${\mathbf{ilbnd}}\left(\mathit{i}\right)$ must be equal to one of the following: $1$, $2$, $3$, $4$, $12$, $23$, $34$, $41$, $21$, $32$, $43$ or $14$, for $\mathit{i}=1,2,\dots ,{\mathbf{nbnds}}$.
12:   $\mathbf{lbnd}\left({\mathbf{nbpts}}\right)$ – Integer arrayInput
On entry: ${\mathbf{lbnd}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{nbpts}}$, contains the grid index of the $\mathit{i}$th boundary point.
Constraint: $1\le {\mathbf{lbnd}}\left(\mathit{i}\right)\le {\mathbf{npts}}$, for $\mathit{i}=1,2,\dots ,{\mathbf{nbpts}}$.
13:   $\mathbf{iwk}\left({\mathbf{leniwk}}\right)$ – Integer arrayWorkspace
14:   $\mathbf{leniwk}$ – IntegerInput
On entry: the dimension of the array iwk as declared in the (sub)program from which d03ryf is called.
Constraint: ${\mathbf{leniwk}}\ge {\mathbf{nx}}×{\mathbf{ny}}+1$.
15:   $\mathbf{pgrid}\left({\mathbf{ny}}\right)$ – Character(*) arrayOutput
On exit: ${\mathbf{pgrid}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{ny}}$, contains a graphical representation of row ${\mathbf{ny}}-\mathit{i}+1$ of the virtual grid (see Section 3).
Constraint: $\mathrm{len}\left({\mathbf{pgrid}}\left(1\right)\right)\ge 3×{\mathbf{nx}}$.
16:   $\mathbf{ifail}$ – IntegerInput/Output
On entry: ifail must be set to $0$, $-1\text{​ or ​}1$. If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value $-1\text{​ or ​}1$ is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, if you are not familiar with this argument, the recommended value is $0$. When the value $-\mathbf{1}\text{​ or ​}\mathbf{1}$ is used it is essential to test the value of ifail on exit.
On exit: ${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6Error Indicators and Warnings

If on entry ${\mathbf{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:
${\mathbf{ifail}}=1$
 On entry, nx or ${\mathbf{ny}}<4$, or ${\mathbf{npts}}>{\mathbf{nx}}×{\mathbf{ny}}$, or ${\mathbf{nrows}}<4$, or ${\mathbf{nrows}}>{\mathbf{ny}}$, or ${\mathbf{nbnds}}<8$, or ${\mathbf{nbpts}}<12$, or ${\mathbf{nbpts}}\ge {\mathbf{npts}}$, or ${\mathbf{lrow}}\left(i\right)<1$, for some $i=1,2,\dots ,{\mathbf{nrows}}$, or ${\mathbf{lrow}}\left(i\right)>{\mathbf{npts}}$, for some $i=1,2,\dots ,{\mathbf{nrows}}$, or ${\mathbf{lrow}}\left(i\right)\le {\mathbf{lrow}}\left(i-1\right)$, for some $i=2,3,\dots ,{\mathbf{nrows}}$, or ${\mathbf{irow}}\left(i\right)<0$, for some $i=1,2,\dots ,{\mathbf{nrows}}$, or ${\mathbf{irow}}\left(i\right)>{\mathbf{ny}}$, for some $i=1,2,\dots ,{\mathbf{nrows}}$, or ${\mathbf{irow}}\left(i\right)\le {\mathbf{irow}}\left(i-1\right)$, for some $i=2,3,\dots ,{\mathbf{nrows}}$, or ${\mathbf{icol}}\left(i\right)<0$, for some $i=1,2,\dots ,{\mathbf{npts}}$, or ${\mathbf{icol}}\left(i\right)>{\mathbf{nx}}$, for some $i=1,2,\dots ,{\mathbf{npts}}$, or ${\mathbf{llbnd}}\left(i\right)<1$, for some $i=1,2,\dots ,{\mathbf{nbnds}}$, or ${\mathbf{llbnd}}\left(i\right)>{\mathbf{nbpts}}$, for some $i=1,2,\dots ,{\mathbf{nbnds}}$, or ${\mathbf{llbnd}}\left(i\right)\le {\mathbf{llbnd}}\left(i-1\right)$, for some $i=2,3,\dots ,{\mathbf{nbpts}}$, or ${\mathbf{ilbnd}}\left(i\right)\ne 1$, $2$, $3$, $4$, $12$, $23$, $34$, $41$, $21$, $32$, $43$ or $14$, for some $i=1,2,\dots ,{\mathbf{nbnds}}$, or ${\mathbf{lbnd}}\left(i\right)<1$, for some $i=1,2,\dots ,{\mathbf{nbpts}}$, or ${\mathbf{lbnd}}\left(i\right)>{\mathbf{npts}}$, for some $i=1,2,\dots ,{\mathbf{nbpts}}$, or ${\mathbf{leniwk}}<{\mathbf{nx}}×{\mathbf{ny}}+1$, or $\mathrm{len}\left({\mathbf{pgrid}}\left(1\right)\right)<3×{\mathbf{nx}}$.
${\mathbf{ifail}}=-99$
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

Not applicable.

## 8Parallelism and Performance

d03ryf is not threaded in any implementation.