rsave_2d_array_to_hdf5 Subroutine

private subroutine rsave_2d_array_to_hdf5(h5file_id, dset, rdata, attr)

Arguments

Type IntentOptional AttributesName
integer(kind=HID_T), intent(in) :: h5file_id
character(len=MAX_STRING_LENGTH), intent(in) :: dset
real(kind=rp), intent(in), DIMENSION(:,:):: rdata
character(len=MAX_STRING_LENGTH), intent(in), optional DIMENSION(:), ALLOCATABLE:: attr

Calls

proc~~rsave_2d_array_to_hdf5~~CallsGraph proc~rsave_2d_array_to_hdf5 rsave_2d_array_to_hdf5 h5screate_simple_f h5screate_simple_f proc~rsave_2d_array_to_hdf5->h5screate_simple_f h5sclose_f h5sclose_f proc~rsave_2d_array_to_hdf5->h5sclose_f h5dwrite_f h5dwrite_f proc~rsave_2d_array_to_hdf5->h5dwrite_f h5dclose_f h5dclose_f proc~rsave_2d_array_to_hdf5->h5dclose_f

Called by

proc~~rsave_2d_array_to_hdf5~~CalledByGraph proc~rsave_2d_array_to_hdf5 rsave_2d_array_to_hdf5 interface~save_2d_array_to_hdf5 save_2d_array_to_hdf5 interface~save_2d_array_to_hdf5->proc~rsave_2d_array_to_hdf5 proc~save_simulation_parameters save_simulation_parameters proc~save_simulation_parameters->proc~rsave_2d_array_to_hdf5 interface~save_array_to_hdf5 save_array_to_hdf5 interface~save_array_to_hdf5->proc~rsave_2d_array_to_hdf5 proc~save_simulation_outputs save_simulation_outputs proc~save_simulation_outputs->proc~rsave_2d_array_to_hdf5 proc~save_restart_variables save_restart_variables proc~save_restart_variables->proc~rsave_2d_array_to_hdf5 program~main main program~main->proc~save_simulation_parameters program~main->proc~save_simulation_outputs program~main->proc~save_restart_variables

Contents


Source Code

  subroutine rsave_2d_array_to_hdf5(h5file_id,dset,rdata,attr)
    INTEGER(HID_T), INTENT(IN) 														:: h5file_id
    CHARACTER(MAX_STRING_LENGTH), INTENT(IN) 										:: dset
    REAL(rp), DIMENSION(:,:), INTENT(IN) 											:: rdata
    CHARACTER(MAX_STRING_LENGTH), OPTIONAL, DIMENSION(:), ALLOCATABLE, INTENT(IN) 	:: attr
    CHARACTER(4) 																	:: aname = "Info"
    INTEGER(HID_T) 																	:: dset_id
    INTEGER(HID_T) 																	:: dspace_id
    INTEGER(HID_T) 																	:: aspace_id
    INTEGER(HID_T) 																	:: attr_id
    INTEGER(HID_T) 																	:: atype_id
    INTEGER(HSIZE_T), DIMENSION(:), ALLOCATABLE 									:: dims
    INTEGER(HSIZE_T), DIMENSION(:), ALLOCATABLE 									:: adims
    INTEGER 																		:: rank
    INTEGER 																		:: arank
    INTEGER(SIZE_T) 																:: attrlen
    INTEGER 																		:: h5error
    INTEGER 																		:: rr,dd

    rank = size(shape(rdata))
    ALLOCATE(dims(rank))
    dims = shape(rdata)

    ! * * * Write data to file * * *

    call h5screate_simple_f(rank,dims,dspace_id,h5error)
    call h5dcreate_f(h5file_id, TRIM(dset), KORC_HDF5_REAL, dspace_id, dset_id, h5error)

    if (rp .EQ. INT(rp_hdf5)) then
       call h5dwrite_f(dset_id, KORC_HDF5_REAL, rdata, dims, h5error)
    else
       call h5dwrite_f(dset_id, KORC_HDF5_REAL, REAL(rdata,4), dims, h5error)
    end if

    if (PRESENT(attr)) then
       ! * * * Write attribute of data to file * * *
    end if

    call h5sclose_f(dspace_id, h5error)
    call h5dclose_f(dset_id, h5error)
    ! * * * Write data to file * * *

    DEALLOCATE(dims)
  end subroutine rsave_2d_array_to_hdf5