Skip to content
Snippets Groups Projects
Commit 3039dc01 authored by WAUTELET Philippe's avatar WAUTELET Philippe
Browse files

Philippe 05/09/2019: IO: Z-split files: to prevent serialization between...

Philippe 05/09/2019: IO: Z-split files: to prevent serialization between files, nmnhversion is taken from the main file
parent 37f41d25
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,8 @@
! P. Wautelet 13/12/2018: extracted from mode_io.f90
! P. Wautelet 14/12/2018: added IO_Filename_construct
! P. Wautelet 05/03/2019: rename IO subroutines and modules
! P. Wautelet 05/09/2019: IO_Mnhversion_get: Z-split files: to prevent serialization between files,
! nmnhversion is taken from the main file
!-----------------------------------------------------------------
module mode_io_tools
......@@ -117,58 +119,59 @@ subroutine IO_Mnhversion_get(tpfile)
if ( trim(tpfile%cmode) /= 'READ' ) &
call print_msg(NVERB_FATAL,'IO','IO_Mnhversion_get',trim(tpfile%cname)// 'not opened in read mode')
imnhversion(:) = 0
!use tzfield because tfieldlist could be not initialised
tzfield%cmnhname = 'MNHVERSION'
tzfield%cstdname = ''
tzfield%clongname = 'MesoNH version'
tzfield%cunits = ''
tzfield%cdir = '--'
tzfield%ccomment = ''
tzfield%ngrid = 0
tzfield%ntype = TYPEINT
tzfield%ndims = 1
tzfield%ltimedep = .false.
call IO_Field_read(tpfile,tzfield,imnhversion,iresp)
if (iresp/=0) then
tzfield%cmnhname = 'MASDEV'
tzfield%clongname = 'MesoNH version (without bugfix)'
tzfield%ndims = 0
call IO_Field_read(tpfile,tzfield,imasdev,iresp)
if ( .not. associated( tpfile%tmainfile ) ) then
imnhversion(:) = 0
!use tzfield because tfieldlist could be not initialised
tzfield%cmnhname = 'MNHVERSION'
tzfield%cstdname = ''
tzfield%clongname = 'MesoNH version'
tzfield%cunits = ''
tzfield%cdir = '--'
tzfield%ccomment = ''
tzfield%ngrid = 0
tzfield%ntype = TYPEINT
tzfield%ndims = 1
tzfield%ltimedep = .false.
call IO_Field_read(tpfile,tzfield,imnhversion,iresp)
if (iresp/=0) then
call print_msg(NVERB_WARNING,'IO','IO_Mnhversion_get','unknown MASDEV version for '//trim(tpfile%cname))
else
if (imasdev<100) then
imnhversion(1)=imasdev/10
imnhversion(2)=mod(imasdev,10)
else !for example for mnh 4.10
imnhversion(1)=imasdev/100
imnhversion(2)=mod(imasdev,100)
tzfield%cmnhname = 'MASDEV'
tzfield%clongname = 'MesoNH version (without bugfix)'
tzfield%ndims = 0
call IO_Field_read(tpfile,tzfield,imasdev,iresp)
if (iresp/=0) then
call print_msg(NVERB_WARNING,'IO','IO_Mnhversion_get','unknown MASDEV version for '//trim(tpfile%cname))
else
if (imasdev<100) then
imnhversion(1)=imasdev/10
imnhversion(2)=mod(imasdev,10)
else !for example for mnh 4.10
imnhversion(1)=imasdev/100
imnhversion(2)=mod(imasdev,100)
end if
end if
!
tzfield%cmnhname = 'BUGFIX'
tzfield%clongname = 'MesoNH bugfix number'
call IO_Field_read(tpfile,tzfield,ibugfix,iresp)
if (iresp/=0) then
call print_msg(NVERB_WARNING,'IO','IO_Mnhversion_get','unknown BUGFIX version for '//trim(tpfile%cname))
else
imnhversion(3)=ibugfix
end if
end if
!
tzfield%cmnhname = 'BUGFIX'
tzfield%clongname = 'MesoNH bugfix number'
call IO_Field_read(tpfile,tzfield,ibugfix,iresp)
if (iresp/=0) then
call print_msg(NVERB_WARNING,'IO','IO_Mnhversion_get','unknown BUGFIX version for '//trim(tpfile%cname))
else
imnhversion(3)=ibugfix
end if
end if
!
write(ymnhversion_file,"( I0,'.',I0,'.',I0 )" ) imnhversion(1),imnhversion(2),imnhversion(3)
write(ymnhversion_curr,"( I0,'.',I0,'.',I0 )" ) nmnhversion(1),nmnhversion(2),nmnhversion(3)
!
if ( imnhversion(1)==0 .and. imnhversion(2)==0 .and. imnhversion(3)==0 ) then
call print_msg(NVERB_WARNING,'IO','IO_Mnhversion_get','file '//trim(tpfile%cname)//&
' was written with an unknown version of MesoNH')
write(ymnhversion_file,"( I0,'.',I0,'.',I0 )" ) imnhversion(1),imnhversion(2),imnhversion(3)
write(ymnhversion_curr,"( I0,'.',I0,'.',I0 )" ) nmnhversion(1),nmnhversion(2),nmnhversion(3)
!
if ( imnhversion(1)==0 .and. imnhversion(2)==0 .and. imnhversion(3)==0 ) then
call print_msg(NVERB_WARNING,'IO','IO_Mnhversion_get','file '//trim(tpfile%cname)//&
' was written with an unknown version of MesoNH')
else if ( imnhversion(1)< nmnhversion(1) .or. &
(imnhversion(1)==nmnhversion(1) .and. imnhversion(2)< nmnhversion(2)) .or. &
(imnhversion(1)==nmnhversion(1) .and. imnhversion(2)==nmnhversion(2) .and. imnhversion(3)<nmnhversion(3)) ) then
call print_msg(NVERB_WARNING,'IO','IO_Mnhversion_get','file '//trim(tpfile%cname)//&
' was written with an older version of MesoNH ('//trim(ymnhversion_file)//&
' instead of '//trim(ymnhversion_curr)//')')
(imnhversion(1)==nmnhversion(1) .and. imnhversion(2)< nmnhversion(2)) .or. &
(imnhversion(1)==nmnhversion(1) .and. imnhversion(2)==nmnhversion(2) .and. imnhversion(3)<nmnhversion(3)) ) then
call print_msg(NVERB_WARNING,'IO','IO_Mnhversion_get','file '//trim(tpfile%cname)//&
' was written with an older version of MesoNH ('//trim(ymnhversion_file)//&
' instead of '//trim(ymnhversion_curr)//')')
else if ( imnhversion(1)> nmnhversion(1) .or. &
(imnhversion(1)==nmnhversion(1) .and. imnhversion(2)> nmnhversion(2)) .or. &
(imnhversion(1)==nmnhversion(1) .and. imnhversion(2)==nmnhversion(2) .and. imnhversion(3)>nmnhversion(3)) ) then
......@@ -177,10 +180,15 @@ subroutine IO_Mnhversion_get(tpfile)
' instead of '//trim(ymnhversion_curr)//')')
else
call print_msg(NVERB_DEBUG,'IO','IO_Mnhversion_get','file '//trim(tpfile%cname)//&
' was written with the same version of MesoNH ('//trim(ymnhversion_curr)//')')
' was written with the same version of MesoNH ('//trim(ymnhversion_curr)//')')
end if
!
tpfile%nmnhversion(:) = imnhversion(:)
else ! associated( tpfile%tmainfile )
if ( .not. tpfile%tmainfile%lopened ) &
call Print_msg( NVERB_FATAL, 'IO', 'IO_Mnhversion_get', 'tmainfile should be opened' )
tpfile%nmnhversion(:) = tpfile%tmainfile%nmnhversion(:)
end if
end subroutine IO_Mnhversion_get
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment