subroutine test_retrieve_multi() type (ESMF_Grid), target :: g_A, g_B, g_C type (RegridderSpec) :: regridder_spec type (RegridderFactorySpec) :: spec_AB, spec_BC, spec_CB type (RegridderFactoryRegistry) :: registry class (AbstractRegridderFactory), pointer :: factory class (AbstractRegridder), allocatable :: regridder g_A = ESMF_GridEmptyCreate() g_B = ESMF_GridEmptyCreate() g_C = ESMF_GridEmptyCreate() call ESMF_AttributeSet(g_A, name='GridType', value='A') call ESMF_AttributeSet(g_B, name='GridType', value='B') call ESMF_AttributeSet(g_C, name='GridType', value='C') regridder_spec = RegridderSpec(g_A, g_B) spec_AB = RegridderFactorySpec(regridder_spec) call registry%insert(spec_AB, MockRegridderFactory('A to B')) regridder_spec = RegridderSpec(g_B, g_C) spec_BC = RegridderFactorySpec(regridder_spec) call registry%insert(spec_BC, MockRegridderFactory('B to C')) regridder_spec = RegridderSpec(g_C, g_B) spec_CB = RegridderFactorySpec(regridder_spec) call registry%insert(spec_CB, MockRegridderFactory('C to B')) factory => registry%at(spec_AB) @assertTrue(associated(factory)) regridder_spec = RegridderSpec(g_C, g_A) allocate(regridder, source=factory%make_regridder(regridder_spec)) select type (regridder) type is (MockRegridder) @assertEqual('A to B::C -> A', regridder%get_name()) class default call throw('incorrect type of regridder returned') end select deallocate(regridder) factory => registry%at(spec_BC) @assertTrue(associated(factory)) allocate(regridder, source=factory%make_regridder(regridder_spec)) select type (regridder) type is (MockRegridder) @assertEqual('B to C::C -> A', regridder%get_name()) class default call throw('incorrect type of regridder returned') end select deallocate(regridder) factory => registry%at(spec_CB) @assertTrue(associated(factory)) allocate(regridder, source=factory%make_regridder(regridder_spec)) select type (regridder) type is (MockRegridder) @assertEqual('C to B::C -> A', regridder%get_name()) class default call throw('incorrect type of regridder returned') end select deallocate(regridder) end subroutine test_retrieve_multi