Changeset 5754 for LMDZ6/trunk/libf/misc


Ignore:
Timestamp:
Jul 2, 2025, 4:26:06 PM (7 days ago)
Author:
dcugnet
Message:

Make the ioipsl_getin_p routine more flexible: optional default value
and optional flag to print or not the effective value of the key
=> get rid of the get_in routine

Location:
LMDZ6/trunk/libf/misc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/trunk/libf/misc/readTracFiles_mod.f90

    r5748 r5754  
    11MODULE readTracFiles_mod
    22
    3   USE strings_mod,    ONLY: msg, find, get_in, dispTable, strHead,  strReduce,  strFind, strStack, strIdx, &
     3  USE ioipsl_getin_p_mod, ONLY : getin_p
     4  USE strings_mod,    ONLY: msg, find, dispTable, strHead,  strReduce,  strFind, strStack, strIdx, &
    45             removeComment, cat,       maxlen, checkList, strParse, strReplace, strTail, strCount, reduceExpr, &
    56             num2str, str2int, str2real, str2bool
     
    11631164
    11641165  !--- GET THE isoCheck ENTRY FROM THE *.DEF FILES (MIGHT BE CHANGED TO A CLASS-DEPENDANT KEYWORD)
    1165   CALL get_in('ok_iso_verif', isot(strIdx(isot%parent, 'H2O'))%check, .FALSE.)
     1166  CALL getin_p('ok_iso_verif', isot(strIdx(isot%parent, 'H2O'))%check, .FALSE.)
    11661167
    11671168  lerr = dispIsotopes()
     
    13071308
    13081309  !--- GET THE isoCheck ENTRY FROM THE *.DEF FILES (MIGHT BE CHANGED TO A CLASS-DEPENDANT KEYWORD)
    1309   CALL get_in('ok_iso_verif', isoCheck, .TRUE.)
     1310  CALL getin_p('ok_iso_verif', isoCheck, .TRUE.)
    13101311
    13111312  !=== CHECK CONSISTENCY
  • LMDZ6/trunk/libf/misc/strings_mod.f90

    r5753 r5754  
    66
    77  PRIVATE
    8   PUBLIC :: maxlen, init_printout, msg, get_in, lunout, prt_level, maxTableWidth
     8  PUBLIC :: maxlen, init_printout, msg, lunout, prt_level, maxTableWidth
    99  PUBLIC :: strLower, strHead, strStack,  strCount, strReduce,  strClean, strIdx
    1010  PUBLIC :: strUpper, strTail, strStackm, strParse, strReplace, strFind, find, duplicate, cat
     
    1313  PUBLIC :: reduceExpr, addQuotes, checkList, removeComment
    1414
    15   INTERFACE get_in;     MODULE PROCEDURE getin_s,  getin_i,  getin_r,  getin_l;  END INTERFACE get_in
    1615  INTERFACE num2str;    MODULE PROCEDURE bool2str, int2str, real2str, dble2str;  END INTERFACE num2str
    1716  INTERFACE  msg;       MODULE PROCEDURE        msg_1,                    msg_m; END INTERFACE  msg
     
    5049  prt_level = prt_level_
    5150END SUBROUTINE init_printout
    52 !==============================================================================================================================
    53 
    54 
    55 !==============================================================================================================================
    56 !=== Same as getin ; additional last argument: the default value.
    57 !==============================================================================================================================
    58 SUBROUTINE getin_s(nam, val, def)
    59   USE ioipsl, ONLY: getin
    60   IMPLICIT NONE
    61   CHARACTER(LEN=*), INTENT(IN)    :: nam
    62   CHARACTER(LEN=*), INTENT(INOUT) :: val
    63   CHARACTER(LEN=*), INTENT(IN)    :: def
    64   val = def; CALL getin(nam, val)
    65   IF(val/=def) WRITE(lunout,*)TRIM(nam)//' = '//TRIM(val)
    66 END SUBROUTINE getin_s
    67 !==============================================================================================================================
    68 SUBROUTINE getin_i(nam, val, def)
    69   USE ioipsl, ONLY: getin
    70   IMPLICIT NONE
    71   CHARACTER(LEN=*), INTENT(IN)    :: nam
    72   INTEGER,          INTENT(INOUT) :: val
    73   INTEGER,          INTENT(IN)    :: def
    74   val = def; CALL getin(nam, val)
    75   IF(val/=def) WRITE(lunout,*)TRIM(nam)//' = '//TRIM(num2str(val))
    76 END SUBROUTINE getin_i
    77 !==============================================================================================================================
    78 SUBROUTINE getin_r(nam, val, def)
    79   USE ioipsl, ONLY: getin
    80   IMPLICIT NONE
    81   CHARACTER(LEN=*), INTENT(IN)    :: nam
    82   REAL,             INTENT(INOUT) :: val
    83   REAL,             INTENT(IN)    :: def
    84   val = def; CALL getin(nam, val)
    85   IF(val/=def) WRITE(lunout,*)TRIM(nam)//' = '//TRIM(num2str(val))
    86 END SUBROUTINE getin_r
    87 !==============================================================================================================================
    88 SUBROUTINE getin_l(nam, val, def)
    89   USE ioipsl, ONLY: getin
    90   IMPLICIT NONE
    91   CHARACTER(LEN=*), INTENT(IN)    :: nam
    92   LOGICAL,          INTENT(INOUT) :: val
    93   LOGICAL,          INTENT(IN)    :: def
    94   val = def; CALL getin(nam, val)
    95   IF(val.NEQV.def) WRITE(lunout,*)TRIM(nam)//' = '//TRIM(num2str(val))
    96 END SUBROUTINE getin_l
    9751!==============================================================================================================================
    9852
Note: See TracChangeset for help on using the changeset viewer.