test_retrieve_exists Subroutine

public subroutine test_retrieve_exists()

Arguments

None

Calls

proc~~test_retrieve_exists~2~~CallsGraph proc~test_retrieve_exists~2 test_retrieve_exists ESMF_GridEmptyCreate ESMF_GridEmptyCreate proc~test_retrieve_exists~2->ESMF_GridEmptyCreate ESMF_InfoGetFromHost ESMF_InfoGetFromHost proc~test_retrieve_exists~2->ESMF_InfoGetFromHost ESMF_InfoSet ESMF_InfoSet proc~test_retrieve_exists~2->ESMF_InfoSet assertequal assertequal proc~test_retrieve_exists~2->assertequal assertfalse assertfalse proc~test_retrieve_exists~2->assertfalse asserttrue asserttrue proc~test_retrieve_exists~2->asserttrue at at proc~test_retrieve_exists~2->at get_name get_name proc~test_retrieve_exists~2->get_name insert insert proc~test_retrieve_exists~2->insert make_regridder make_regridder proc~test_retrieve_exists~2->make_regridder mockregridderfactory mockregridderfactory proc~test_retrieve_exists~2->mockregridderfactory regridderfactoryspec regridderfactoryspec proc~test_retrieve_exists~2->regridderfactoryspec regridderspec regridderspec proc~test_retrieve_exists~2->regridderspec throw throw proc~test_retrieve_exists~2->throw

Source Code

   subroutine test_retrieve_exists()
      type (ESMF_Grid), target :: g1_in, g1_out
      type (RegridderSpec) :: regridder_spec
      type (RegridderFactorySpec) :: factory_spec
      type (RegridderFactoryRegistry) :: registry

      class (AbstractRegridderFactory), pointer :: factory
      class (AbstractRegridder), allocatable :: regridder
      type (ESMF_Info) :: infohin,infohout


      g1_in = ESMF_GridEmptyCreate()
      g1_out = ESMF_GridEmptyCreate()

      call ESMF_InfoGetFromHost(g1_in,infohin)
      call ESMF_InfoSet(infohin,'GridType','A')
      call ESMF_InfoGetFromHost(g1_out,infohout)
      call ESMF_InfoSet(infohout,'GridType','B')

      regridder_spec = RegridderSpec(g1_in, g1_out)
      factory_spec = RegridderFactorySpec(regridder_spec)

      factory => registry%at(factory_spec)
      @assertFalse(associated(factory))

      call registry%insert(factory_spec, MockRegridderFactory('A to B'))
      factory => registry%at(factory_spec)
      @assertTrue(associated(factory))

      allocate(regridder, source=factory%make_regridder(regridder_spec))
      select type (regridder)
      type is (MockRegridder)
         @assertEqual('A to B::A -> B', regridder%get_name())
      class default
         call throw('incorrect type of regridder returned')
      end select
      
   end subroutine test_retrieve_exists