-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathErrPack.f
98 lines (68 loc) · 2.74 KB
/
ErrPack.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
c RCS version control information:
c $Header: ErrPack.f,v 2.1 2000/03/27 21:40:49 laszlo Exp $
c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE ErrMsg( MESSAG, FATAL )
c Print out a warning or error message; abort if error
LOGICAL FATAL, MsgLim
CHARACTER*(*) MESSAG
INTEGER MaxMsg, NumMsg
SAVE MaxMsg, NumMsg, MsgLim
DATA NumMsg / 0 /, MaxMsg / 100 /, MsgLim / .FALSE. /
IF ( FATAL ) THEN
WRITE ( *, '(/,2A,/)' ) ' ******* ERROR >>>>>> ', MESSAG
STOP
END IF
NumMsg = NumMsg + 1
IF( MsgLim ) RETURN
IF ( NumMsg.LE.MaxMsg ) THEN
WRITE ( *, '(/,2A,/)' ) ' ******* WARNING >>>>>> ', MESSAG
ELSE
WRITE ( *,99 )
MsgLim = .True.
ENDIF
RETURN
99 FORMAT( //,' >>>>>> TOO MANY WARNING MESSAGES -- ',
& 'They will no longer be printed <<<<<<<', // )
END
LOGICAL FUNCTION WrtBad ( VarNam )
c Write names of erroneous variables and return 'TRUE'
c INPUT : VarNam = Name of erroneous variable to be written
c ( CHARACTER, any length )
CHARACTER*(*) VarNam
INTEGER MaxMsg, NumMsg
SAVE NumMsg, MaxMsg
DATA NumMsg / 0 /, MaxMsg / 50 /
WrtBad = .TRUE.
NumMsg = NumMsg + 1
WRITE ( *, '(3A)' ) ' **** Input variable ', VarNam,
& ' in error ****'
IF ( NumMsg.EQ.MaxMsg )
& CALL ErrMsg ( 'Too many input errors. Aborting...', .TRUE. )
RETURN
END
LOGICAL FUNCTION WrtDim ( DimNam, MinVal )
c Write name of too-small symbolic dimension and
c the value it should be increased to; return 'TRUE'
c INPUT : DimNam = Name of symbolic dimension which is too small
c ( CHARACTER, any length )
c Minval = Value to which that dimension should be
c increased (at least)
CHARACTER*(*) DimNam
INTEGER MinVal
WRITE ( *, '(/,3A,I7)' ) ' **** Symbolic dimension ', DimNam,
& ' should be increased to at least ', MinVal
WrtDim = .TRUE.
RETURN
END
LOGICAL FUNCTION TstBad( VarNam, RelErr )
c Write name (VarNam) of variable failing self-test and its
c percent error from the correct value; return 'FALSE'.
CHARACTER*(*) VarNam
REAL RelErr
TstBad = .FALSE.
WRITE( *, '(/,3A,1P,E11.2,A)' )
& ' Output variable ', VarNam,' differed by ', 100.*RelErr,
& ' per cent from correct value. Self-test failed.'
RETURN
END