FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
logical, | intent(in), | optional | :: | stop | ||
logical, | intent(in), | optional | :: | dbl |
subroutine hdf_init (stop, dbl)
use constants, only: kind_rs, kind_rd, pi
# if (defined HDF && FCOMPILER != _GFORTRAN_)
use hdf5, only: H5T_NATIVE_REAL, H5T_NATIVE_DOUBLE, h5open_f
# endif
! use mp, only: proc0
implicit none
logical, intent (in), optional :: stop
logical, intent (in), optional :: dbl
# ifdef HDF
integer :: ier
if (initialized) return
call h5open_f (ier)
stop_private = .false.
if (present(stop)) stop_private = stop
! find and set code precision
if ( (kind(pi)==kind_rs) .or. (kind_rs==kind_rd) ) then
hdf_mem_real = H5T_NATIVE_REAL
! if (proc0) print *, '# hdf_init: code is single precision'
else if (kind(pi)==kind_rd) then
hdf_mem_real = H5T_NATIVE_DOUBLE
! if (proc0) print *, '# hdf_init: code is double precision'
else
write (*,*) 'ERROR: precision mismatch in hdf_init'
end if
! set file precision
hdf_file_real = H5T_NATIVE_REAL
if (present(dbl)) then
if (dbl .and. hdf_mem_real == H5T_NATIVE_DOUBLE) &
hdf_file_real = H5T_NATIVE_DOUBLE
end if
initialized = .true.
# endif
end subroutine hdf_init