diff --git a/src/LIB/SURCOUCHE/src/modd_io.f90 b/src/LIB/SURCOUCHE/src/modd_io.f90 index 62a02bf94ee83faaff7ed36a2c3666a0d7e82e9a..0970816a79d818c1150ed40ec0e0a9bbe20e5db2 100644 --- a/src/LIB/SURCOUCHE/src/modd_io.f90 +++ b/src/LIB/SURCOUCHE/src/modd_io.f90 @@ -7,6 +7,7 @@ ! Philippe Wautelet: 05/2016-04/2018: new data structures and calls for I/O ! Philippe Wautelet: 10/01/2019: use NEWUNIT argument of OPEN (removed ISTDOUT, ISTDERR, added NNULLUNIT, CNULLFILE) ! Philippe Wautelet: 21/01/2019: add LIO_ALLOW_NO_BACKUP and LIO_NO_WRITE to modd_io_ll to allow to disable writes (for bench purposes) +! P. Wautelet 12/03/2019: add TMAINFILE field in TFILEDATA !----------------------------------------------------------------- MODULE MODD_IO_ll @@ -117,6 +118,7 @@ TYPE TFILEDATA TYPE(TFILEDATA),POINTER :: TDADFILE => NULL() !Corresponding dad file TYPE(TFILEDATA),POINTER :: TDESFILE => NULL() !Corresponding .des file TYPE(TFILEDATA),POINTER :: TDATAFILE => NULL() !Corresponding data file (if .des file) + TYPE(TFILEDATA),POINTER :: TMAINFILE => NULL() !Corresponding main file if the file is an sub-file TYPE(TFILEDATA),POINTER :: TFILE_PREV => NULL() TYPE(TFILEDATA),POINTER :: TFILE_NEXT => NULL() END TYPE TFILEDATA diff --git a/src/LIB/SURCOUCHE/src/mode_fm.f90 b/src/LIB/SURCOUCHE/src/mode_fm.f90 index 02265538caf83cd8da4c91da4ec9c7bf87bf3cac..55f00cfea079cc749795fa10e9adcebecf1f475b 100644 --- a/src/LIB/SURCOUCHE/src/mode_fm.f90 +++ b/src/LIB/SURCOUCHE/src/mode_fm.f90 @@ -174,7 +174,7 @@ use mode_io_file_nc4, only: io_create_file_nc4, io_open_file_nc4 #endif use mode_io_file_lfi, only: io_create_file_lfi, io_open_file_lfi -TYPE(TFILEDATA), INTENT(INOUT) :: TPFILE ! File structure +TYPE(TFILEDATA), pointer, INTENT(INOUT) :: TPFILE ! File structure INTEGER, INTENT(OUT) :: KRESP ! return-code LOGICAL, INTENT(IN), OPTIONAL :: OPARALLELIO CHARACTER(LEN=*),INTENT(IN), OPTIONAL :: HPROGRAM_ORIG !To emulate a file coming from this program diff --git a/src/LIB/SURCOUCHE/src/mode_io.f90 b/src/LIB/SURCOUCHE/src/mode_io.f90 index 430fe98de8f8718f65fc861d89273bd737872218..fbe696adac68b505c23df4453927862d90856944 100644 --- a/src/LIB/SURCOUCHE/src/mode_io.f90 +++ b/src/LIB/SURCOUCHE/src/mode_io.f90 @@ -168,7 +168,7 @@ CONTAINS USE MODE_IO_MANAGE_STRUCT, ONLY: IO_FILE_ADD2LIST, IO_FILE_FIND_BYNAME use mode_io_tools, only: io_rank - TYPE(TFILEDATA), INTENT(INOUT) :: TPFILE + TYPE(TFILEDATA), pointer, INTENT(INOUT) :: TPFILE CHARACTER(len=*),INTENT(IN), OPTIONAL :: MODE CHARACTER(len=*),INTENT(IN), OPTIONAL :: STATUS CHARACTER(len=*),INTENT(IN), OPTIONAL :: ACCESS @@ -604,6 +604,8 @@ CONTAINS KLFINPRAR=TPFILE%NLFINPRAR,KLFITYPE=TPFILE%NLFITYPE,KLFIVERB=TPFILE%NLFIVERB, & HFORMAT=TPFILE%CFORMAT) END IF + + TZSPLITFILE%TMAINFILE => TPFILE END IF IF (ALLOCATED(TPFILE%CDIRNAME)) THEN diff --git a/src/LIB/SURCOUCHE/src/mode_io_manage_struct.f90 b/src/LIB/SURCOUCHE/src/mode_io_manage_struct.f90 index 8745773f089fa8ce4b2f61cc5e3890d78cf10d55..19776416c9a8ce3d726060babcb064fc16d0ea0f 100644 --- a/src/LIB/SURCOUCHE/src/mode_io_manage_struct.f90 +++ b/src/LIB/SURCOUCHE/src/mode_io_manage_struct.f90 @@ -11,6 +11,7 @@ ! Philippe Wautelet: 05/2016-04/2018: new data structures and calls for I/O ! Philippe Wautelet: 21/01/2019: add LIO_ALLOW_NO_BACKUP and LIO_NO_WRITE to modd_io_ll ! to allow to disable writes (for bench purposes) +! P. Wautelet 12/03/2019: add TMAINFILE field in TFILEDATA !----------------------------------------------------------------- MODULE MODE_IO_MANAGE_STRUCT ! @@ -618,6 +619,7 @@ SUBROUTINE POPULATE_STRUCT(TPFILE_FIRST,TPFILE_LAST,KSTEPS,HFILETYPE,TPBAKOUTN) ELSE CALL PRINT_MSG(NVERB_FATAL,'IO','POPULATE_STRUCT','unknown backup/output fileformat') ENDIF + TPBAKOUTN(IPOS)%TFILE%TFILES_IOZ(JI)%TFILE%TMAINFILE => TPBAKOUTN(IPOS)%TFILE END DO END IF ! diff --git a/src/LIB/SURCOUCHE/src/mode_io_tools.f90 b/src/LIB/SURCOUCHE/src/mode_io_tools.f90 index 9e8dd1fc85b8dd0412cc535af1afa88752598c2b..5eae7007aa6cabc22f67e7ecbf5739942d5f1963 100644 --- a/src/LIB/SURCOUCHE/src/mode_io_tools.f90 +++ b/src/LIB/SURCOUCHE/src/mode_io_tools.f90 @@ -6,6 +6,8 @@ ! Modifications: ! P. Wautelet : 13/12/2018 : extracted from mode_io.f90 ! P. Wautelet : 14/12/2018 : added io_construct_filename +! P. Wautelet 05/09/2019: io_get_mnhversion: Z-split files: to prevent serialization between files, +! nmnhversion is taken from the main file !----------------------------------------------------------------- module mode_io_tools @@ -118,6 +120,7 @@ contains if ( trim(tpfile%cmode) /= 'READ' ) & call print_msg(NVERB_FATAL,'IO','io_get_mnhversion',trim(tpfile%cname)// 'not opened in read mode') + if ( .not. associated( tpfile%tmainfile ) ) then imnhversion(:) = 0 !use tzfield because tfieldlist could be not initialised tzfield%cmnhname = 'MNHVERSION' @@ -182,6 +185,11 @@ contains end if ! tpfile%nmnhversion(:) = imnhversion(:) + else ! associated( tpfile%tmainfile ) + if ( .not. tpfile%tmainfile%lopened ) & + call Print_msg( NVERB_FATAL, 'IO', 'io_get_mnhversion', 'tmainfile should be opened' ) + tpfile%nmnhversion(:) = tpfile%tmainfile%nmnhversion(:) + end if end subroutine io_get_mnhversion