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)

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 parameters 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 xx- and yy-direction respectively (including the boundary points).
Constraint: nx and ny4ny4.
3:     lrow(nrows) – int64int32nag_int array
nrows, the dimension of the array, must satisfy the constraint 4nrowsny4nrowsny.
lrow(i)lrowi, for i = 1,2,,nrowsi=1,2,,nrows, contains the base grid index of the first grid point in base grid row ii.
Constraints:
  • 1lrow(i)npts1lrowinpts, for i = 1,2,,nrowsi=1,2,,nrows;
  • lrow(i1) < lrow(i)lrowi-1<lrowi, for i = 2,3,,nrowsi=2,3,,nrows.
4:     irow(nrows) – int64int32nag_int array
nrows, the dimension of the array, must satisfy the constraint 4nrowsny4nrowsny.
irow(i)irowi, for i = 1,2,,nrowsi=1,2,,nrows, contains the virtual grid row number that corresponds to base grid row ii.
Constraints:
  • 0irow(i)ny0irowiny, for i = 1,2,,nrowsi=1,2,,nrows;
  • irow(i1) < irow(i)irowi-1<irowi, for i = 2,3,,nrowsi=2,3,,nrows.
5:     icol(npts) – int64int32nag_int array
npts, the dimension of the array, must satisfy the constraint nptsnx × nynptsnx×ny.
icol(i)icoli, for i = 1,2,,nptsi=1,2,,npts, contains the virtual grid column number that contains base grid point ii.
Constraint: 0icol(i)nx0icolinx, for i = 1,2,,nptsi=1,2,,npts.
6:     llbnd(nbnds) – int64int32nag_int array
nbnds, the dimension of the array, must satisfy the constraint nbnds8nbnds8.
llbnd(i)llbndi, for i = 1,2,,nbndsi=1,2,,nbnds, contains the element of lbnd corresponding to the start of the iith boundary (or corner).
Constraints:
  • 1llbnd(i)nbpts1llbndinbpts, for i = 1,2,,nbndsi=1,2,,nbnds;
  • llbnd(i1) < llbnd(i)llbndi-1<llbndi, for i = 2,3,,nbndsi=2,3,,nbnds.
7:     ilbnd(nbnds) – int64int32nag_int array
nbnds, the dimension of the array, must satisfy the constraint nbnds8nbnds8.
ilbnd(i)ilbndi, for i = 1,2,,nbndsi=1,2,,nbnds, contains the type of the iith boundary (or corner), as defined in nag_pde_2d_gen_order2_rectilinear (d03rb).
Constraint: ilbnd(i)ilbndi must be equal to one of the following: 11, 22, 33, 44, 1212, 2323, 3434, 4141, 2121, 3232, 4343 or 1414, for i = 1,2,,nbndsi=1,2,,nbnds.
8:     lbnd(nbpts) – int64int32nag_int array
nbpts, the dimension of the array, must satisfy the constraint 12nbpts < npts12nbpts<npts.
lbnd(i)lbndi, for i = 1,2,,nbptsi=1,2,,nbpts, contains the grid index of the iith boundary point.
Constraint: 1lbnd(i)npts1lbndinpts, for i = 1,2,,nbptsi=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 × nynptsnx×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: 4nrowsny4nrowsny.
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: nbnds8nbnds8.
4:     nbpts – int64int32nag_int scalar
Default: The dimension of the array lbnd.
The total number of boundary points in the base grid.
Constraint: 12nbpts < npts12nbpts<npts.

Input Parameters Omitted from the MATLAB Interface

iwk leniwk

Output Parameters

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

Error Indicators and Warnings

Errors or warnings detected by the function:
  ifail = 1ifail=1
On entry,nx or ny < 4ny<4,
ornpts > nx × nynpts>nx×ny,
ornrows < 4nrows<4,
ornrows > nynrows>ny,
ornbnds < 8nbnds<8,
ornbpts < 12nbpts<12,
ornbptsnptsnbptsnpts,
orlrow(i) < 1lrowi<1, for some i = 1,2,,nrowsi=1,2,,nrows,
orlrow(i) > nptslrowi>npts, for some i = 1,2,,nrowsi=1,2,,nrows,
orlrow(i)lrow(i1)lrowilrowi-1, for some i = 2,3,,nrowsi=2,3,,nrows,
orirow(i) < 0irowi<0, for some i = 1,2,,nrowsi=1,2,,nrows,
orirow(i) > nyirowi>ny, for some i = 1,2,,nrowsi=1,2,,nrows,
orirow(i)irow(i1)irowiirowi-1, for some i = 2,3,,nrowsi=2,3,,nrows,
oricol(i) < 0icoli<0, for some i = 1,2,,nptsi=1,2,,npts,
oricol(i) > nxicoli>nx, for some i = 1,2,,nptsi=1,2,,npts,
orllbnd(i) < 1llbndi<1, for some i = 1,2,,nbndsi=1,2,,nbnds,
orllbnd(i) > nbptsllbndi>nbpts, for some i = 1,2,,nbndsi=1,2,,nbnds,
orllbnd(i)llbnd(i1)llbndillbndi-1, for some i = 2,3,,nbptsi=2,3,,nbpts,
orilbnd(i)1ilbndi1, 22, 33, 44, 1212, 2323, 3434, 4141, 2121, 3232, 4343 or 1414, for some i = 1,2,,nbndsi=1,2,,nbnds,
orlbnd(i) < 1lbndi<1, for some i = 1,2,,nbptsi=1,2,,nbpts,
orlbnd(i) > nptslbndi>npts, for some i = 1,2,,nbptsi=1,2,,nbpts,
orleniwk < nx × ny + 1leniwk<nx×ny+1,
orLEN(pgrid(1)) < 3 × nxLEN(pgrid1)<3×nx.

Accuracy

Not applicable.

Further Comments

None.

Example

function nag_pde_2d_gen_order2_checkgrid_example
nx = int64(11);
ny = int64(11);
lrow = [int64(1);4;15;26;37;46;57;68;79;88;97];
irow = [int64(0);1;2;3;4;5;6;7;8;9;10];
icol = [int64(0);1;2;0;1;2;3;4;5;6;7;8;9;10;0;1;2;3;4;5;6;7;8;9;10; ...
     0;1;2;3;4;5;6;7;8;9;10;0;1;2;3;4;5;8;9;10;0;1;2;3;4;5;6;7;8;9; ...
     10;0;1;2;3;4;5;6;7;8;9;10;0;1;2;3;4;5;6;7;8;9;10;0;1;2;3;4;5;6; ...
     7;8;0;1;2;3;4;5;6;7;8;0;1;2;3;4;5;6;7;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;26;37;46;57;68;79;88;98;99;100;101;102;103;104; ...
     96;86;85;84;83;82;70;59;48;39;28;17;6;8;9;10;11;12;13;18;29;40; ...
     49;60;72;73;74;75;76;77;67;56;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] = nag_pde_2d_gen_order2_checkgrid(nx, ny, lrow, irow, icol, llbnd, ilbnd, lbnd)
 

pgrid = 

    ' 23  3  3  3  3  3  3  3 34 XX 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'


ifail =

                    0


function d03ry_example
nx = int64(11);
ny = int64(11);
lrow = [int64(1);4;15;26;37;46;57;68;79;88;97];
irow = [int64(0);1;2;3;4;5;6;7;8;9;10];
icol = [int64(0);1;2;0;1;2;3;4;5;6;7;8;9;10;0;1;2;3;4;5;6;7;8;9;10; ...
     0;1;2;3;4;5;6;7;8;9;10;0;1;2;3;4;5;8;9;10;0;1;2;3;4;5;6;7;8;9; ...
     10;0;1;2;3;4;5;6;7;8;9;10;0;1;2;3;4;5;6;7;8;9;10;0;1;2;3;4;5;6; ...
     7;8;0;1;2;3;4;5;6;7;8;0;1;2;3;4;5;6;7;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;26;37;46;57;68;79;88;98;99;100;101;102;103;104; ...
     96;86;85;84;83;82;70;59;48;39;28;17;6;8;9;10;11;12;13;18;29;40; ...
     49;60;72;73;74;75;76;77;67;56;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)
 

pgrid = 

    ' 23  3  3  3  3  3  3  3 34 XX 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'


ifail =

                    0



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–2013