Changeset 4454 for LMDZ6/trunk/libf/misc
- Timestamp:
- Mar 7, 2023, 4:17:13 PM (21 months ago)
- Location:
- LMDZ6/trunk/libf/misc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/trunk/libf/misc/readTracFiles_mod.f90
r4403 r4454 1 1 MODULE readTracFiles_mod 2 2 3 USE strings_mod, ONLY: msg, find, get_in, str2int, dispTable, testFile, strReduce, strFind, strStack, strHead,&4 test, removeComment, cat, fmsg, maxlen, int2str, checkList, strParse, strReplace, strTail, strCount, strIdx,reduceExpr3 USE strings_mod, ONLY: msg, find, get_in, str2int, dispTable, strHead, strReduce, strFind, strStack, strIdx, & 4 test, removeComment, cat, fmsg, maxlen, int2str, checkList, strParse, strReplace, strTail, strCount, reduceExpr 5 5 6 6 IMPLICIT NONE … … 292 292 CHARACTER(LEN=maxlen), ALLOCATABLE :: trac_files(:), sections(:) 293 293 LOGICAL, ALLOCATABLE :: ll(:) 294 LOGICAL :: lD 294 LOGICAL :: lD, lFound 295 295 INTEGER :: is, nsec 296 296 lD = .FALSE.; IF(PRESENT(lDisp)) lD = lDisp … … 301 301 IF(test(strParse(type_trac, '|', sections, n=nsec), lerr)) RETURN !--- Parse "type_trac" list 302 302 IF(PRESENT(sects)) sects = sections 303 ALLOCATE(trac_files(nsec)); DO is=1, nsec; trac_files(is) = 'tracer_'//TRIM(sections(is))//'.def'; END DO 303 ALLOCATE(trac_files(nsec), ll(nsec)) 304 DO is=1, nsec 305 trac_files(is) = 'tracer_'//TRIM(sections(is))//'.def' 306 INQUIRE(FILE=TRIM(trac_files(is)), EXIST=ll(is)) 307 END DO 304 308 IF(PRESENT(tracf)) tracf = trac_files 305 ll = .NOT.testFile(trac_files)306 309 fType = 0 307 I F(.NOT.testFile('traceur.def')) fType = 1!--- OLD STYLE FILE308 I F(.NOT.testFile('tracer.def')) fType = 2!--- NEW STYLE ; SINGLE FILE, SEVERAL SECTIONS309 IF(ALL(ll)) fType = 3!--- NEW STYLE ; SEVERAL FILES, SINGLE SECTION USED310 INQUIRE(FILE='traceur.def', EXIST=lFound); IF(lFound) fType = 1 !--- OLD STYLE FILE 311 INQUIRE(FILE='tracer.def', EXIST=lFound); IF(lFound) fType = 2 !--- NEW STYLE ; SINGLE FILE, SEVERAL SECTIONS 312 IF(ALL(ll)) fType = 3 !--- NEW STYLE ; SEVERAL FILES, SINGLE SECTION USED 310 313 IF(.NOT.lD) RETURN !--- NO CHECKING/DISPLAY NEEDED: JUST GET type_trac,fType 311 314 IF(ANY(ll) .AND. fType/=3) THEN !--- MISSING FILES … … 1032 1035 CHARACTER(LEN=*), INTENT(IN) :: fnam !--- Input file name 1033 1036 TYPE(isot_type), TARGET, INTENT(INOUT) :: isot(:) !--- Isotopes descriptors (field %parent must be defined!) 1037 LOGICAL :: lFound 1034 1038 INTEGER :: is, iis, it, idb, ndb, nb0 1035 1039 CHARACTER(LEN=maxlen), ALLOCATABLE :: vals(:) … … 1040 1044 1041 1045 !--- THE INPUT FILE MUST BE PRESENT 1042 IF(test(fmsg('Missing isotopes parameters file "'//TRIM(fnam)//'"', modname, testFile(fnam)),lerr)) RETURN 1046 INQUIRE(FILE=TRIM(fnam), EXIST=lFound); lerr = .NOT.lFound 1047 IF(fmsg('Missing isotopes parameters file "'//TRIM(fnam)//'"', modname, lerr)) RETURN 1043 1048 1044 1049 !--- READ THE FILE SECTIONS, ONE EACH PARENT TRACER -
LMDZ6/trunk/libf/misc/strings_mod.F90
r4403 r4454 10 10 PUBLIC :: is_numeric, bool2str, int2str, real2str, dble2str 11 11 PUBLIC :: reduceExpr, str2bool, str2int, str2real, str2dble 12 PUBLIC :: addQuotes, testFile,checkList, removeComment, test12 PUBLIC :: addQuotes, checkList, removeComment, test 13 13 14 14 INTERFACE get_in; MODULE PROCEDURE getin_s, getin_i, getin_r, getin_l; END INTERFACE get_in … … 29 29 INTERFACE reduceExpr; MODULE PROCEDURE reduceExpr_1, reduceExpr_m; END INTERFACE reduceExpr 30 30 INTERFACE addQuotes; MODULE PROCEDURE addQuotes_1, addQuotes_m; END INTERFACE addQuotes 31 INTERFACE testFile; MODULE PROCEDURE testFile_1, testFile_m; END INTERFACE testFile32 31 33 32 INTEGER, PARAMETER :: maxlen = 256 !--- Standard maximum length for strings … … 1452 1451 1453 1452 !============================================================================================================================== 1454 !=== TEST WHETHER A FILE IS PRESENT OR NOT ====================================================================================1455 !==============================================================================================================================1456 LOGICAL FUNCTION testFile_1(fname) RESULT(out)1457 CHARACTER(LEN=*), INTENT(IN) :: fname1458 !------------------------------------------------------------------------------------------------------------------------------1459 INTEGER :: ierr1460 OPEN(90, FILE=fname, FORM='formatted', STATUS='old', IOSTAT=ierr); CLOSE(99)1461 out = ierr/=01462 END FUNCTION testFile_11463 !==============================================================================================================================1464 FUNCTION testFile_m(fname) RESULT(out)1465 LOGICAL, ALLOCATABLE :: out(:)1466 CHARACTER(LEN=*), INTENT(IN) :: fname(:)1467 INTEGER :: k1468 !------------------------------------------------------------------------------------------------------------------------------1469 out = [(testFile_1(fname(k)), k=1, SIZE(fname))]1470 END FUNCTION testFile_m1471 !==============================================================================================================================1472 1473 1474 !==============================================================================================================================1475 1453 !=== DISPLAY "<message>: the following <items> are <reason>" FOLLOWED BY THE LIST OF <str> FOR WHICH <lerr>==T. =============== 1476 1454 !==============================================================================================================================
Note: See TracChangeset
for help on using the changeset viewer.