IO: Remove useless comments from initialize_io().

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
Grzegorz Kowal 2021-11-23 16:46:41 -03:00
parent d564f2dc5f
commit aeb71db1d3

View File

@ -36,12 +36,8 @@ module io
#endif /* HDF5 */
use timers, only : set_timer, start_timer, stop_timer
! module variables are not implicit by default
!
implicit none
! subroutine interfaces
!
interface read_snapshot_parameter
module procedure read_snapshot_parameter_string
module procedure read_snapshot_parameter_integer
@ -69,9 +65,7 @@ module io
end interface
#endif /* HDF5 */
! timer indices
!
integer , save :: iio
integer, save :: iio
! MODULE PARAMETERS:
! =================
@ -211,19 +205,16 @@ module io
integer, dimension(1) :: cd_values = 3
#endif /* HDF5 */
#ifdef HDF5
character(len=*), parameter :: loc = 'IO::initialize_io()'
#endif /* HDF5 */
!-------------------------------------------------------------------------------
!
call set_timer('SNAPSHOTS I/O' , iio)
status = 0
! get module parameters
!
call set_timer('SNAPSHOTS I/O', iio)
call get_parameter("restart_path" , respath)
call get_parameter("restart_number" , nrest )
call get_parameter("restart_interval" , hrest )
@ -232,14 +223,10 @@ module io
call get_parameter("include_ghosts" , ghosts )
call get_parameter("generate_xdmf" , xdmf )
! add slash at the end of respath if not present
!
if (index(respath, '/', back = .true.) /= len(trim(respath))) then
write(respath,"(a)") trim(adjustl(respath)) // '/'
end if
! check the snapshot format
!
call get_parameter("snapshot_format", sformat)
select case(sformat)
#ifdef HDF5
@ -250,8 +237,6 @@ module io
snapshot_format = snapshot_xml
end select
! check the restart snapshot format
!
call get_parameter("restart_format", sformat)
select case(sformat)
#ifdef HDF5
@ -262,8 +247,6 @@ module io
restart_format = snapshot_xml
end select
! check the last available restart snapshot
!
if (nrest == 0) then
test = .true.
nrest = 0
@ -273,9 +256,9 @@ module io
case(snapshot_hdf5)
do while (test)
nrest = nrest + 1
write(dname, "(a,'r',i6.6,'_',i5.5,'.h5')") &
write(dname, "(a,'r',i6.6,'_',i5.5,'.h5')") &
trim(respath), nrest, nproc
inquire(file = dname, exist = test)
inquire(file=dname, exist=test)
end do
#endif /* HDF5 */
case default
@ -283,9 +266,9 @@ module io
nrest = nrest + 1
write(dname, "(a,'restart-',i5.5)") trim(respath), nrest
#ifdef __INTEL_COMPILER
inquire(directory = dname, exist = test)
inquire(directory=dname, exist=test)
#else /* __INTEL_COMPILER */
inquire(file = dname, exist = test)
inquire(file=dname, exist=test)
#endif /* __INTEL_COMPILER */
end do
end select
@ -293,16 +276,12 @@ module io
nrest = nrest - 1
end if
! get the compression format and level for XML+binary files
!
call get_parameter("compression_format", cformat)
call get_parameter("compression_level" , clevel)
call set_compression(cformat, clevel, suffix)
if (get_compression() > 0) &
binary_file_suffix = ".bin" // trim(adjustl(suffix))
! get the hash type
!
call get_parameter("digest_type", dtype)
select case(dtype)
#ifdef XXHASH
@ -317,8 +296,6 @@ module io
if (status == 0) then
! check if the snapshots should be stored at precise moments
!
select case(trim(precise))
case ("off", "OFF", "n", "N", "false", "FALSE", "no", "NO")
precise_snapshots = .false.
@ -327,8 +304,6 @@ module io
end select
#ifdef HDF5
! check if the XDMF files should be generated too
!
select case(trim(xdmf))
case ("off", "OFF", "n", "N", "false", "FALSE", "no", "NO")
with_xdmf = .false.
@ -336,24 +311,17 @@ module io
with_xdmf = .true.
end select
! initialize the HDF5 Fortran interface
!
call h5open_f(status)
if (status < 0) then
call print_message(loc, &
"Cannot initialize the HDF5 Fortran interface!")
if (status /= 0) then
call print_message(loc, &
"Cannot initialize the HDF5 Fortran interface!")
else
! prepare the property object for compression
!
call h5pcreate_f(H5P_DATASET_CREATE_F, prp_id, status)
if (status < 0) then
call print_message(loc, &
"Cannot create the compression property for datasets!")
call print_message(loc, &
"Cannot create the compression property for datasets!")
else
! detect available compression formats
!
cmpstatus = .false.
if (.not. cmpstatus) then
call h5zfilter_avail_f(H5Z_ZSTANDARD, cmpstatus, status)
@ -364,18 +332,14 @@ module io
if (cmpstatus) compression = H5Z_DEFLATE
end if
! get the compression_level
!
call get_parameter("compression_level", hclevel)
! initialize the compressor
!
if (status == 0) then
select case(compression)
case(H5Z_ZSTANDARD)
hclevel = max(1, min(20, hclevel))
cd_values(:) = hclevel
call h5pset_filter_f(prp_id, H5Z_ZSTANDARD, H5Z_FLAG_OPTIONAL_F, &
call h5pset_filter_f(prp_id, H5Z_ZSTANDARD, H5Z_FLAG_OPTIONAL_F, &
cd_nelmts, cd_values, status)
case(H5Z_DEFLATE)
hclevel = max(1, min(9, hclevel))