subroutine setUp(this)
class (Test_LatLonCorners), intent(inout) :: this
integer :: status
type (ESMF_Config) :: config
integer :: unit
if (this%getLocalPET() == 0) then
select type (p => this%testParameter)
type is (GridCase)
call write_config(resource_file, p)
end select
end if
call this%barrier()
config = ESMF_ConfigCreate(rc=status)
@mpiAssertEqual(ESMF_SUCCESS, 0)
call ESMF_ConfigLoadFile(config, resource_file, rc=status)
@mpiAssertEqual(ESMF_SUCCESS, 0)
call this%barrier()
if (this%getLocalPET() == 0) then
open (newunit=unit, file=resource_file)
close(unit, status='delete')
end if
call this%factory%initialize(config, rc=status)
@mpiAssertEqual(ESMF_SUCCESS, 0)
call ESMF_ConfigDestroy(config, rc=status)
@mpiAssertEqual(ESMF_SUCCESS, 0)
this%grid = this%factory%make_grid()
contains
subroutine write_config(file_name, param)
character(len=*), intent(in) :: file_name
type (GridCase), intent(in) :: param
integer :: unit
open(newunit=unit, file=file_name, form='formatted', status='unknown')
if (param%default_decomposition) then
write(unit,*)'NX: ', param%nx
write(unit,*)'NY: ', param%ny
write(unit,*)'IM_WORLD: ', param%im_world
write(unit,*)'JM_WORLD: ', param%jm_world
else
write(unit,*)'IMS: ', param%ims
write(unit,*)'JMS: ', param%jms
end if
write(unit,*)"POLE: '", param%pole, "'"
if (param%pole == 'XY') then
write(unit,*)'LAT_RANGE: ', param%lat_range%min, param%lat_range%max
end if
write(unit,*)"DATELINE: '", param%dateline, "'"
if (param%dateline == 'XY') then
write(unit,*)'LON_RANGE: ', param%lon_range%min, param%lon_range%max
end if
close(unit)
end subroutine write_config
end subroutine setUp