subroutine test_do_not_reuse_geom(this)
class(ESMF_TestMethod), intent(inout) :: this
type(GeomManager), target :: geom_manager
type(ESMF_HConfig) :: hconfig
integer :: status
class(GeomSpec), allocatable :: spec
type(MaplGeom), pointer :: mapl_geom_a, mapl_geom_b
type(ESMF_Geom) :: geom_a, geom_b
type(ESMF_Info) :: infoh
logical :: is_present
! geom a
hconfig = ESMF_HConfigCreate(content="{class: latlon, im_world: 12, jm_world: 13, pole: PC, dateline: DC, nx: 1, ny: 1}", &
rc=status)
@assert_that(status, is(0))
geom_manager = GeomManager()
allocate(spec, source=geom_manager%make_geom_spec(hconfig, rc=status))
@assert_that(status, is(0))
call ESMF_HConfigDestroy(hconfig, rc=status)
@assert_that(status, is(0))
mapl_geom_a => geom_manager%get_mapl_geom(spec, rc=status)
@assert_that(status, is(0))
geom_a = mapl_geom_a%get_geom()
call ESMF_InfoGetFromHost(geom_a, infoh, rc=status)
@assert_that(status, is(0))
call ESMF_InfoSet(infoh, 'GeomManager was here', .true., rc=status)
@assert_that(status, is(0))
! geom b
hconfig = ESMF_HConfigCreate(content="{class: latlon, im_world: 10, jm_world: 13, pole: PC, dateline: DC, nx: 1, ny: 1}", &
rc=status)
@assert_that(status, is(0))
deallocate(spec)
allocate(spec, source=geom_manager%make_geom_spec(hconfig, rc=status))
@assert_that(status, is(0))
call ESMF_HConfigDestroy(hconfig, rc=status)
@assert_that(status, is(0))
mapl_geom_b => geom_manager%get_mapl_geom(spec, rc=status)
@assert_that(status, is(0))
geom_b = mapl_geom_b%get_geom()
call ESMF_InfoGetFromHost(geom_b, infoh, rc=status)
@assert_that(status, is(0))
! New grid so should not have the key set on the other.
is_present = ESMF_InfoIsPresent(infoh, 'GeomManager was here', rc=status)
@assert_that(status, is(0))
@assertFalse(is_present)
end subroutine test_do_not_reuse_geom