hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_pde_2d_gen_order2_checkgrid (d03ry)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_pde_2d_gen_order2_checkgrid (d03ry) is designed to be used in conjunction with nag_pde_2d_gen_order2_rectilinear (d03rb). 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.

Syntax

[pgrid, ifail] = d03ry(nx, ny, lrow, irow, icol, llbnd, ilbnd, lbnd, 'npts', npts, 'nrows', nrows, 'nbnds', nbnds, 'nbpts', nbpts)
[pgrid, ifail] = nag_pde_2d_gen_order2_checkgrid(nx, ny, lrow, irow, icol, llbnd, ilbnd, lbnd, 'npts', npts, 'nrows', nrows, 'nbnds', nbnds, 'nbpts', nbpts)

Description

nag_pde_2d_gen_order2_checkgrid (d03ry) outputs a character array which can be printed to provide a simple graphical representation of the virtual and base grids supplied to nag_pde_2d_gen_order2_rectilinear (d03rb). It must be called only from within the inidom after all output arguments of inidom (other than ierr) have been set. nag_pde_2d_gen_order2_checkgrid (d03ry) also checks the validity of the grid data specified in inidom.
You are strongly advised to call nag_pde_2d_gen_order2_checkgrid (d03ry) during the initial call of nag_pde_2d_gen_order2_rectilinear (d03rb) (at least) and to print the resulting character array in order to check that the base grid is exactly as required.
nag_pde_2d_gen_order2_checkgrid (d03ry) 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

References

None.

Parameters

Compulsory Input Parameters

1:     nx int64int32nag_int scalar
2:     ny int64int32nag_int scalar
The number of virtual grid points in the x- and y-direction respectively (including the boundary points).
Constraint: nx and ny4.
3:     lrownrows int64int32nag_int array
lrowi, for i=1,2,,nrows, contains the base grid index of the first grid point in base grid row i.
Constraints:
  • 1lrowinpts, for i=1,2,,nrows;
  • lrowi-1<lrowi, for i=2,3,,nrows.
4:     irownrows int64int32nag_int array
irowi, for i=1,2,,nrows, contains the virtual grid row number that corresponds to base grid row i.
Constraints:
  • 0irowiny, for i=1,2,,nrows;
  • irowi-1<irowi, for i=2,3,,nrows.
5:     icolnpts int64int32nag_int array
icoli, for i=1,2,,npts, contains the virtual grid column number that contains base grid point i.
Constraint: 0icolinx, for i=1,2,,npts.
6:     llbndnbnds int64int32nag_int array
llbndi, for i=1,2,,nbnds, contains the element of lbnd corresponding to the start of the ith boundary (or corner).
Constraints:
  • 1llbndinbpts, for i=1,2,,nbnds;
  • llbndi-1<llbndi, for i=2,3,,nbnds.
7:     ilbndnbnds int64int32nag_int array
ilbndi, for i=1,2,,nbnds, contains the type of the ith boundary (or corner), as defined in nag_pde_2d_gen_order2_rectilinear (d03rb).
Constraint: ilbndi must be equal to one of the following: 1, 2, 3, 4, 12, 23, 34, 41, 21, 32, 43 or 14, for i=1,2,,nbnds.
8:     lbndnbpts int64int32nag_int array
lbndi, for i=1,2,,nbpts, contains the grid index of the ith boundary point.
Constraint: 1lbndinpts, for i=1,2,,nbpts.

Optional Input Parameters

1:     npts int64int32nag_int scalar
Default: the dimension of the array icol.
The total number of points in the base grid.
Constraint: nptsnx×ny.
2:     nrows int64int32nag_int scalar
Default: the dimension of the arrays lrow, irow. (An error is raised if these dimensions are not equal.)
The total number of rows of the virtual grid that contain base grid points.
Constraint: 4nrowsny.
3:     nbnds int64int32nag_int scalar
Default: the dimension of the arrays llbnd, ilbnd. (An error is raised if these dimensions are not equal.)
The total number of physical boundaries and corners in the base grid.
Constraint: nbnds8.
4:     nbpts int64int32nag_int scalar
Default: the dimension of the array lbnd.
The total number of boundary points in the base grid.
Constraint: 12nbpts<npts.

Output Parameters

1:     pgridny – cell array of strings
pgridi, for i=1,2,,ny, contains a graphical representation of row ny-i+1 of the virtual grid (see Description).
2:     ifail int64int32nag_int scalar
ifail=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Errors or warnings detected by the function:
   ifail=1
On entry,nx or ny<4,
ornpts>nx×ny,
ornrows<4,
ornrows>ny,
ornbnds<8,
ornbpts<12,
ornbptsnpts,
orlrowi<1, for some i=1,2,,nrows,
orlrowi>npts, for some i=1,2,,nrows,
orlrowilrowi-1, for some i=2,3,,nrows,
orirowi<0, for some i=1,2,,nrows,
orirowi>ny, for some i=1,2,,nrows,
orirowiirowi-1, for some i=2,3,,nrows,
oricoli<0, for some i=1,2,,npts,
oricoli>nx, for some i=1,2,,npts,
orllbndi<1, for some i=1,2,,nbnds,
orllbndi>nbpts, for some i=1,2,,nbnds,
orllbndillbndi-1, for some i=2,3,,nbpts,
orilbndi1, 2, 3, 4, 12, 23, 34, 41, 21, 32, 43 or 14, for some i=1,2,,nbnds,
orlbndi<1, for some i=1,2,,nbpts,
orlbndi>npts, for some i=1,2,,nbpts,
orleniwk<nx×ny+1,
orLENpgrid1<3×nx.
   ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
   ifail=-399
Your licence key may have expired or may not have been installed correctly.
   ifail=-999
Dynamic memory allocation failed.

Accuracy

Not applicable.

Further Comments

None.

Example

See Example in nag_pde_2d_gen_order2_rectilinear (d03rb).
function d03ry_example


fprintf('d03ry example results\n\n');

nx = int64(11);
ny = int64(11);
lrow = int64([1, 4, 15:11:37, 46:11:79, 88, 97]);
irow = int64([0:10]);
icol = int64([0:2, 0:10, 0:10, 0:10, 0:5, 8:10, ...
                0:10, 0:10, 0:10, 0:8, 0:9, 0:8]);
llbnd = int64([1, 2,11,18,19,24,31,37,42,48,53,55,56,58,59,60,61,62, ...
                 63,64,65,66,67,68,69,70,71,72]);
ilbnd = int64([1, 2, 3, 4, 1, 4, 1, 2, 3, 4, 3, 4, 1, 2,12,23,34,41, ...
                 14,41,12,23,34,41,43,14,21,32]);
lbnd  = int64([2, 4, 15:11:37, 46:11:79, 88, 98:104, ...
                96, 86:-1:82, 70:-11:48, 39:-11:6, 8:13, ...
                18:11:40, 49, 60, 72:77, 67:-11:45, 36, 25, ...
                33, 32, 42, 52, 53, 43, 1, 97, 105, 87, 81, ...
                3, 7, 71, 78, 14, 31, 51, 54, 34]);

[pgrid, ifail] = d03ry(nx, ny, lrow, irow, icol, llbnd, ilbnd, lbnd);

disp('Textual representation of grid:');
disp(pgrid);


d03ry example results

Textual representation of grid:
    '  3  3  3  3  3  3  3 34 .. 23 XX'
    '  2 .. .. .. .. .. .. ..  4 XX XX'
    '  2 .. 14  1  1  1  1  1 41 XX XX'
    '  2 ..  4 23  3  3  3  3  3  3 34'
    '  2 ..  4  2 .. .. .. .. .. ..  4'
    '  2 ..  4  2 .. 14  1  1 21 ..  4'
    '  2 ..  4  2 ..  4 XX XX  2 ..  4'
    '  2 ..  4  2 .. 43  3  3 32 ..  4'
    '  2 ..  4  2 .. .. .. .. .. ..  4'
    '  2 ..  4 12  1  1  1  1  1  1 41'
    ' 12  1 41 XX XX XX XX XX XX XX XX'


PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015