ioipsl.f90 2.94 KB
Newer Older
1 2 3 4 5 6
MODULE ioipsl
  
  IMPLICIT NONE

  PUBLIC ::  ipslerr, ipslerr_p
  
7
  INTEGER, SAVE :: numout=6
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
  INTEGER :: ipslout=6, ilv_cur=0, ilv_max=0
  LOGICAL :: ioipsl_debug=.FALSE., lact_mode=.TRUE.
  
CONTAINS
  !
  SUBROUTINE ipslerr (plev,pcname,pstr1,pstr2,pstr3)
!---------------------------------------------------------------------
!! The "ipslerr" routine
!! allows to handle the messages to the user.
!!
!! INPUT
!!
!! plev   : Category of message to be reported to the user
!!          1 = Note to the user
!!          2 = Warning to the user
!!          3 = Fatal error
!! pcname : Name of subroutine which has called ipslerr
!! pstr1   
!! pstr2  : Strings containing the explanations to the user
!! pstr3
!---------------------------------------------------------------------
    IMPLICIT NONE
!-
    INTEGER :: plev
    CHARACTER(LEN=*) :: pcname,pstr1,pstr2,pstr3
!-
    CHARACTER(LEN=30),DIMENSION(3) :: pemsg = &
         &  (/ "NOTE TO THE USER FROM ROUTINE ", &
         &     "WARNING FROM ROUTINE          ", &
         &     "FATAL ERROR FROM ROUTINE      " /)
!---------------------------------------------------------------------
    IF ( (plev >= 1).AND.(plev <= 3) ) THEN
       ilv_cur = plev
       ilv_max = MAX(ilv_max,plev)
       WRITE(ipslout,'(/,A," ",A)') TRIM(pemsg(plev)),TRIM(pcname)
       WRITE(ipslout,'(3(" --> ",A,/))') TRIM(pstr1),TRIM(pstr2),TRIM(pstr3)
    ENDIF
    IF ( (plev == 3).AND.lact_mode) THEN
       WRITE(ipslout,'("Fatal error from IOIPSL. STOP in ipslerr with code")')
       STOP 1
    ENDIF
!---------------------
  END SUBROUTINE ipslerr
!
  SUBROUTINE ipslerr_p (plev,pcname,pstr1,pstr2,pstr3)
!---------------------------------------------------------------------
!! The "ipslerr" routine
!! allows to handle the messages to the user.
!!
!! INPUT
!!
!! plev   : Category of message to be reported to the user
!!          1 = Note to the user
!!          2 = Warning to the user
!!          3 = Fatal error
!! pcname : Name of subroutine which has called ipslerr
!! pstr1   
!! pstr2  : Strings containing the explanations to the user
!! pstr3
!---------------------------------------------------------------------
    IMPLICIT NONE
!-
    INTEGER :: plev
    CHARACTER(LEN=*) :: pcname,pstr1,pstr2,pstr3
!-
    CHARACTER(LEN=30),DIMENSION(3) :: pemsg = &
         &  (/ "NOTE TO THE USER FROM ROUTINE ", &
         &     "WARNING FROM ROUTINE          ", &
         &     "FATAL ERROR FROM ROUTINE      " /)
!---------------------------------------------------------------------
    IF ( (plev >= 1).AND.(plev <= 3) ) THEN
       ilv_cur = plev
       ilv_max = MAX(ilv_max,plev)
       WRITE(ipslout,'(/,A," ",A)') TRIM(pemsg(plev)),TRIM(pcname)
       WRITE(ipslout,'(3(" --> ",A,/))') TRIM(pstr1),TRIM(pstr2),TRIM(pstr3)
    ENDIF
    IF ( (plev == 3).AND.lact_mode) THEN
       WRITE(ipslout,'("Fatal error from IOIPSL. STOP in ipslerr with code")')
       STOP 1
    ENDIF
!---------------------
  END SUBROUTINE ipslerr_p
END MODULE ioipsl