subroutine set_parameters_by_config(this,config_file)
class(test_support), intent(inout) :: this
character(len=*), intent(in) :: config_file
type(ESMF_Config) :: config
logical :: is_present
integer :: comm_size, status,error_code,rc
config = ESMF_ConfigCreate()
this%extra_info = .false.
this%write_barrier = .false.
this%do_writes = .true.
call ESMF_ConfigLoadFile(config,config_file)
call ESMF_ConfigGetAttribute(config,this%nx,label="NX:")
call ESMF_ConfigGetAttribute(config,this%ny,label="NY:")
call ESMF_ConfigGetAttribute(config,this%im_world,label="IM_WORLD:")
call ESMF_ConfigGetAttribute(config,this%lm,label="LM:")
call ESMF_ConfigGetAttribute(config,this%num_writers,label="NUM_WRITERS:")
call ESMF_ConfigGetAttribute(config,this%num_arrays,label="NUM_ARRAYS:")
this%do_chunking = get_logical_key(config,"CHUNK:",.true.)
this%gather_3d = get_logical_key(config,"GATHER_3D:",.false.)
this%split_file = get_logical_key(config,"SPLIT_FILE:",.false.)
this%extra_info = get_logical_key(config,"EXTRA_INFO:",.false.)
this%write_barrier = get_logical_key(config,"WRITE_BARRIER:",.false.)
this%do_writes = get_logical_key(config,"DO_WRITES:",.true.)
this%netcdf_writes = get_logical_key(config,"NETCDF_WRITES:",.true.)
this%n_trials = get_integer_key(config,"NTRIALS:",3)
this%random = get_logical_key(config,"RANDOM_DATA:",.true.)
this%write_counter = 0
this%write_3d_time = 0
this%write_2d_time = 0
this%create_file_time = 0
this%close_file_time = 0
this%data_volume = 0.d0
this%time_writing = 0.d0
this%mpi_time = 0.0
call MPI_COMM_SIZE(MPI_COMM_WORLD,comm_size,status)
_VERIFY(status)
if (comm_size /= (this%nx*this%ny*6)) then
call MPI_Abort(mpi_comm_world,error_code,status)
_VERIFY(status)
endif
contains
function get_logical_key(config,label,default_val) result(val)
logical :: val
type(ESMF_Config), intent(Inout) :: config
character(len=*), intent(in) :: label
logical, intent(in) :: default_val
logical :: is_present
call ESMF_ConfigFindlabel(config,label,isPresent=is_present)
if (is_present) then
call ESMF_ConfigGetAttribute(config,val,label=label)
else
val = default_val
end if
end function
function get_integer_key(config,label,default_val) result(val)
integer :: val
type(ESMF_Config), intent(Inout) :: config
character(len=*), intent(in) :: label
integer, intent(in) :: default_val
logical :: is_present
call ESMF_ConfigFindlabel(config,label,isPresent=is_present)
if (is_present) then
call ESMF_ConfigGetAttribute(config,val,label=label)
else
val = default_val
end if
end function
end subroutine set_parameters_by_config