| [name,lociw,leniw,locw,lenw,ierr,iter,err]=dchkw(name,lociw,leniw,locw,lenw,ierr,iter,err); |
function [name,lociw,leniw,locw,lenw,ierr,iter,err]=dchkw(name,lociw,leniw,locw,lenw,ierr,iter,err);
%***BEGIN PROLOGUE DCHKW
%***SUBSIDIARY
%***PURPOSE SLAP WORK/IWORK Array Bounds Checker.
% This routine checks the work array lengths and interfaces
% to the SLATEC error handler if a problem is found.
%***LIBRARY SLATEC (SLAP)
%***CATEGORY R2
%***TYPE doubleprecision (SCHKW-S, DCHKW-D)
%***KEYWORDS ERROR CHECKING, SLAP, WORKSPACE CHECKING
%***AUTHOR Seager, Mark K., (LLNL)
% Lawrence Livermore National Laboratory
% PO BOX 808, L-60
% Livermore, CA 94550 (510) 423-3141
% seager@llnl.gov
%***DESCRIPTION
%
% *Usage:
% CHARACTER*(*) NAME
% INTEGER LOCIW, LENIW, LOCW, LENW, IERR, ITER
% doubleprecision ERR
%
% CALL DCHKW( NAME, LOCIW, LENIW, LOCW, LENW, IERR, ITER, ERR )
%
% *Arguments:
% NAME :IN Character*(*).
% Name of the calling routine. This is used in the output
% message, if an error is detected.
% LOCIW :IN Integer.
% Location of the first free element in the integer workspace
% array.
% LENIW :IN Integer.
% Length of the integer workspace array.
% LOCW :IN Integer.
% Location of the first free element in the doubleprecision
% workspace array.
% LENRW :IN Integer.
% Length of the doubleprecision workspace array.
% IERR :OUT Integer.
% Return error flag.
% IERR = 0 => All went well.
% IERR = 1 => Insufficient storage allocated for
% WORK or IWORK.
% ITER :OUT Integer.
% Set to zero on return.
% ERR :OUT doubleprecision.
% Set to the smallest positive magnitude if all went well.
% Set to a very large number if an error is detected.
%
%***REFERENCES (NONE)
%***ROUTINES CALLED D1MACH, XERMSG
%***REVISION HISTORY (YYMMDD)
% 880225 DATE WRITTEN
% 881213 Previous REVISION DATE
% 890915 Made changes requested at July 1989 CML Meeting. (MKS)
% 890922 Numerous changes to prologue to make closer to SLATEC
% standard. (FNF)
% 890929 Numerous changes to reduce SP/DP differences. (FNF)
% 900805 Changed XERRWV calls to calls to XERMSG. (RWC)
% 910411 Prologue converted to Version 4.0 format. (BAB)
% 910502 Corrected XERMSG calls to satisfy Section 6.2.2 of ANSI
% X3.9-1978. (FNF)
% 910506 Made subsidiary. (FNF)
% 920511 Added complete declaration section. (WRB)
% 921015 Added code to initialize ITER and ERR when IERR=0. (FNF)
%***end PROLOGUE DCHKW
% .. Scalar Arguments ..
% .. Local Scalars ..
persistent xern1 xern2 xernam ;
if isempty(xern1), xern1=repmat(' ',1,8); end;
if isempty(xern2), xern2=repmat(' ',1,8); end;
if isempty(xernam), xernam=repmat(' ',1,8); end;
% .. External Functions ..
% .. External Subroutines ..
%***FIRST EXECUTABLE STATEMENT DCHKW
%
% Check the Integer workspace situation.
%
ierr = 0;
iter = 0;
[err ]=d1mach(1);
if( lociw>leniw )
ierr = 1;
[err ]=d1mach(2);
xernam = name;
xern1=sprintf(['%8i'], lociw);
xern2=sprintf(['%8i'], leniw);
xermsg('SLATEC','DCHKW',['In ',[xernam,[', INTEGER work array too short. ',['IWORK needs ',[xern1,['; have allocated ',xern2]]]]]],1,1);
end;
%
% Check the doubleprecision workspace situation.
if( locw>lenw )
ierr = 1;
[err ]=d1mach(2);
xernam = name;
xern1=sprintf(['%8i'], locw);
xern2=sprintf(['%8i'], lenw);
xermsg('SLATEC','DCHKW',['In ',[xernam,[', doubleprecision work array too ',['short. RWORK needs ',[xern1,['; have allocated ',xern2]]]]]],1,1);
end;
%------------- LAST LINE OF DCHKW FOLLOWS ----------------------------
end
%DECK DCHUD
|
|