Commit 7d7c79b0 authored by Roy Fabrice's avatar Roy Fabrice
Browse files

Merge branch 'fhi-and-syntax' of gitlab.obspm.fr:roy/pFoF_dev into fhi-and-syntax

parents 0990829c f564d768
......@@ -145,6 +145,7 @@ contains
integer(kind=hid_t) :: cube_file_id
integer(kind=hid_t) :: cells_group_id
integer :: icell
integer(HID_T) :: metadata_id
#ifdef DEBUG
write(ERROR_UNIT,'(a,i0)') 'Write_hdf5_cube begins on process', mpi_process%rank
......@@ -154,6 +155,10 @@ contains
filename = this%filename
call Hdf5_create_file(filename, cube_file_id)
groupname = 'metadata'
call Hdf5_open_group(cube_file_id, groupname, metadata_id)
call this%ramses_info%Write_hdf5(metadata_id,mpi_process)
groupname = 'cells'
call Hdf5_create_group(cube_file_id, groupname, cells_group_id)
call this%cells_array%Write(cells_group_id)
......
......@@ -59,6 +59,7 @@ module ramses_info_m
contains
procedure :: Print => Print_ramses_info
procedure :: Read => Read_ramses_info
procedure :: Write_hdf5 => Write_hdf5_ramses_info
end type ramses_info_t
contains
......@@ -206,4 +207,72 @@ contains
end subroutine Read_ramses_info
!------------------------------------------------------------------------------------------------------------------------------------
!> Write Ramses info as metadata in a HDF5 object
subroutine Write_hdf5_ramses_info(this, hdf5_id, mpi_process)
use fortran_hdf5_constants_m, only : H5_STR_LEN
use fortran_hdf5_manage_groups_m, only : Hdf5_close_group, Hdf5_create_group
use fortran_hdf5_write_attribute_m, only : Hdf5_write_attr
use hdf5, only : HID_T
use mpi_process_m, only : mpi_process_t
integer(HID_T), intent(in) :: hdf5_id
type(mpi_process_t), intent(in) :: mpi_process
class(ramses_info_t), intent(in) :: this !< info structure
character(len=H5_STR_LEN) :: groupname
character(len=H5_STR_LEN) :: aname
integer(kind=HID_T) :: gr_id
integer(kind=HID_T) :: gr_ramses_id
#ifdef DEBUG
write(OUTPUT_UNIT,*) 'ramses_info%Write begins on process ', mpi_process%rank
#endif
! Ramses Info Metadata
groupname = 'ramses_info'
call Hdf5_create_group(hdf5_id,groupname,gr_ramses_id)
aname = 'ncpu'
call Hdf5_write_attr(gr_ramses_id,aname,this%ncpu)
aname = 'ndim'
call Hdf5_write_attr(gr_ramses_id,aname,this%ndim)
aname = 'levelmin'
call Hdf5_write_attr(gr_ramses_id,aname,this%levelmin)
aname = 'levelmax'
call Hdf5_write_attr(gr_ramses_id,aname,this%levelmax)
aname = 'ngridmax'
call Hdf5_write_attr(gr_ramses_id,aname,this%ngridmax)
aname = 'nstep_coarse'
call Hdf5_write_attr(gr_ramses_id,aname,this%nstep_coarse)
aname = 'boxlen'
call Hdf5_write_attr(gr_ramses_id,aname,this%boxlen)
aname = 'time'
call Hdf5_write_attr(gr_ramses_id,aname,this%time)
aname = 'aexp'
call Hdf5_write_attr(gr_ramses_id,aname,this%aexp)
aname = 'h0'
call Hdf5_write_attr(gr_ramses_id,aname,this%h0)
aname = 'omega_m'
call Hdf5_write_attr(gr_ramses_id,aname,this%omega_m)
aname = 'omega_l'
call Hdf5_write_attr(gr_ramses_id,aname,this%omega_l)
aname = 'omega_k'
call Hdf5_write_attr(gr_ramses_id,aname,this%omega_k)
aname = 'omega_b'
call Hdf5_write_attr(gr_ramses_id,aname,this%omega_b)
aname = 'unit_l'
call Hdf5_write_attr(gr_ramses_id,aname,this%unit_l)
aname = 'unit_d'
call Hdf5_write_attr(gr_ramses_id,aname,this%unit_d)
aname = 'unit_t'
call Hdf5_write_attr(gr_ramses_id,aname,this%unit_t)
call Hdf5_close_group(gr_ramses_id)
#ifdef DEBUG
write(OUTPUT_UNIT,*) 'ramses_info%Write ends on process ', mpi_process%rank
#endif
end subroutine Write_hdf5_ramses_info
end module ramses_info_m
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment