hdf5_init Subroutine

private subroutine hdf5_init(me, cfg)

Type Bound

hdf5_t

Arguments

Type IntentOptional Attributes Name
class(hdf5_t), intent(inout) :: me
class(input_t), intent(in) :: cfg

Calls

proc~~hdf5_init~~CallsGraph proc~hdf5_init hdf5_t%hdf5_init h5dclose_f h5dclose_f proc~hdf5_init->h5dclose_f h5fcreate_f h5fcreate_f proc~hdf5_init->h5fcreate_f h5gclose_f h5gclose_f proc~hdf5_init->h5gclose_f h5gcreate_f h5gcreate_f proc~hdf5_init->h5gcreate_f h5ltset_attribute_string_f h5ltset_attribute_string_f proc~hdf5_init->h5ltset_attribute_string_f h5pclose_f h5pclose_f proc~hdf5_init->h5pclose_f h5pcreate_f h5pcreate_f proc~hdf5_init->h5pcreate_f h5pset_libver_bounds_f h5pset_libver_bounds_f proc~hdf5_init->h5pset_libver_bounds_f interface~h5fstart_swmr_write H5Fstart_swmr_write proc~hdf5_init->interface~h5fstart_swmr_write proc~attach_scale attach_scale proc~hdf5_init->proc~attach_scale proc~hdf5_data_create hdf5_data_create proc~hdf5_init->proc~hdf5_data_create proc~input_bin input_t%input_bin proc~hdf5_init->proc~input_bin proc~input_dbl input_t%input_dbl proc~hdf5_init->proc~input_dbl proc~input_str input_t%input_str proc~hdf5_init->proc~input_str proc~tbl_h5_create_dbl tbl_h5_create_dbl proc~hdf5_init->proc~tbl_h5_create_dbl proc~write_str_arr write_str_arr proc~hdf5_init->proc~write_str_arr h5dsattach_scale_f h5dsattach_scale_f proc~attach_scale->h5dsattach_scale_f h5dsset_label_f h5dsset_label_f proc~attach_scale->h5dsset_label_f h5dsset_scale_f h5dsset_scale_f proc~attach_scale->h5dsset_scale_f proc~hdf5_data_create->h5dclose_f proc~hdf5_data_create->proc~attach_scale proc~hdf5_data_create->proc~tbl_h5_create_dbl h5dopen_f h5dopen_f proc~hdf5_data_create->h5dopen_f h5ltmake_dataset_f h5ltmake_dataset_f proc~hdf5_data_create->h5ltmake_dataset_f interface~to_str to_str proc~hdf5_data_create->interface~to_str proc~write_atribute_int write_atribute_int proc~hdf5_data_create->proc~write_atribute_int proc~write_attribute_vstr1d write_attribute_vstr1d proc~hdf5_data_create->proc~write_attribute_vstr1d proc~write_vstr1d write_vstr1d proc~hdf5_data_create->proc~write_vstr1d proc~continue_if continue_if proc~input_bin->proc~continue_if proc~input_has_key input_t%input_has_key proc~input_bin->proc~input_has_key proc~input_node input_t%input_node proc~input_bin->proc~input_node proc~select_scalar select_scalar proc~input_bin->proc~select_scalar to_logical to_logical proc~input_bin->to_logical proc~input_dbl->proc~continue_if proc~get0d_hdf5 get0d_hdf5 proc~input_dbl->proc~get0d_hdf5 proc~input_dbl->proc~input_has_key proc~input_dbl->proc~input_node to_real to_real proc~input_dbl->to_real proc~input_str->proc~input_has_key proc~input_str->proc~input_node proc~input_str->proc~select_scalar proc~tbl_h5_create_dbl->h5pclose_f proc~tbl_h5_create_dbl->h5pcreate_f h5dcreate_f h5dcreate_f proc~tbl_h5_create_dbl->h5dcreate_f h5dwrite_f h5dwrite_f proc~tbl_h5_create_dbl->h5dwrite_f h5pset_chunk_f h5pset_chunk_f proc~tbl_h5_create_dbl->h5pset_chunk_f h5sclose_f h5sclose_f proc~tbl_h5_create_dbl->h5sclose_f h5screate_simple_f h5screate_simple_f proc~tbl_h5_create_dbl->h5screate_simple_f proc~write_str_arr->h5dclose_f proc~write_str_arr->h5dcreate_f proc~write_str_arr->h5dwrite_f proc~write_str_arr->h5sclose_f proc~write_str_arr->h5screate_simple_f h5tclose_f h5tclose_f proc~write_str_arr->h5tclose_f h5tcopy_f h5tcopy_f proc~write_str_arr->h5tcopy_f h5tset_cset_f h5tset_cset_f proc~write_str_arr->h5tset_cset_f h5tset_size_f h5tset_size_f proc~write_str_arr->h5tset_size_f proc~str_from_int str_from_int interface~to_str->proc~str_from_int proc~str_from_real str_from_real interface~to_str->proc~str_from_real proc~get0d_hdf5->h5dclose_f proc~get0d_hdf5->proc~input_str proc~get0d_hdf5->h5dopen_f proc~get0d_hdf5->proc~input_has_key h5close_f h5close_f proc~get0d_hdf5->h5close_f h5dread_f h5dread_f proc~get0d_hdf5->h5dread_f h5fclose_f h5fclose_f proc~get0d_hdf5->h5fclose_f h5fopen_f h5fopen_f proc~get0d_hdf5->h5fopen_f h5ltget_dataset_info_f h5ltget_dataset_info_f proc~get0d_hdf5->h5ltget_dataset_info_f h5open_f h5open_f proc~get0d_hdf5->h5open_f get get proc~input_has_key->get proc~select_dict select_dict proc~input_has_key->proc~select_dict proc~input_node->get proc~dictionary_traverse dictionary_traverse proc~input_node->proc~dictionary_traverse proc~input_node->proc~select_dict proc~write_atribute_int->h5sclose_f proc~write_atribute_int->h5screate_simple_f h5aclose_f h5aclose_f proc~write_atribute_int->h5aclose_f h5acreate_f h5acreate_f proc~write_atribute_int->h5acreate_f h5awrite_f h5awrite_f proc~write_atribute_int->h5awrite_f proc~write_attribute_vstr1d->h5sclose_f proc~write_attribute_vstr1d->h5screate_simple_f proc~write_attribute_vstr1d->h5tclose_f proc~write_attribute_vstr1d->h5tcopy_f proc~write_attribute_vstr1d->h5tset_size_f proc~write_attribute_vstr1d->h5aclose_f proc~write_attribute_vstr1d->h5acreate_f proc~write_attribute_vstr1d->h5awrite_f proc~write_vstr1d->h5dclose_f proc~write_vstr1d->h5dcreate_f proc~write_vstr1d->h5sclose_f proc~write_vstr1d->h5screate_simple_f proc~write_vstr1d->h5tclose_f proc~write_vstr1d->h5tcopy_f proc~write_vstr1d->h5tset_size_f h5dwrite_vl_f h5dwrite_vl_f proc~write_vstr1d->h5dwrite_vl_f proc~dictionary_traverse->proc~dictionary_traverse get_dictionary get_dictionary proc~dictionary_traverse->get_dictionary proc~abort_if abort_if proc~dictionary_traverse->proc~abort_if

Source Code

subroutine hdf5_init(me,cfg)
    class(hdf5_t),  intent(inout) :: me
    class(input_t), intent(in)    :: cfg
    
    integer(hid_t) :: group_id, prop_id, var_id
    real(dp)       :: data_global(2)
    integer        :: i, err

    me%write_results = cfg%bin('active',.true.)
    me%write_results2D = cfg%bin('active2D',.true.)    

    if(.not.me%write_results) return
    print*,'Writing of results ACTIVE'

    me%min_save_time = cfg%dbl('minimum_time',0.0_dp)
    me%time_btw_2D_writes = cfg%dbl('time_between_2D_writes',3600.0_dp)
    
    ! Create hdf file and 'reims' group
    call H5Pcreate_f(H5P_FILE_ACCESS_F, prop_id, err)
    call H5Pset_libver_bounds_f(prop_id, H5F_LIBVER_LATEST_F, H5F_LIBVER_LATEST_F, err)
    call H5Fcreate_f(cfg%str('file'), H5F_ACC_TRUNC_F, me%file_id, err, H5P_DEFAULT_F, prop_id)
    call h5pclose_f(prop_id, err)
    call h5gcreate_f(me%file_id, 'reims', group_id, err)

    call h5ltset_attribute_string_f(me%file_id,'reims','type','reims'//char(0),err)
    call tbl_h5_create_dbl(me%time,group_id,'t',0.)

    data_global = 0.0_dp
    call tbl_h5_create_dbl(me%global,group_id,'global',data_global)
    call write_str_arr(group_id,'global_var',['dt','dt2'],var_id)
    call attach_scale(var_id,       me%global%dset, 1, 'var', 'var')
    call attach_scale(me%time%dset, me%global%dset, 2, 't',   't')
    call h5dclose_f(var_id,err)

    do i = 1, size(me%tbl_dsc)
        call hdf5_data_create(me%tables(i), group_id, me%time%dset, &
            me%tbl_dsc(i)%name, me%tbl_dsc(i)%vars, me%tbl_dsc(i)%comps)
    enddo
    call h5gclose_f(group_id, err)
    err = H5Fstart_swmr_write(me%file_id)

end subroutine hdf5_init