setUp Subroutine

public subroutine setUp(this)

Type Bound

Test_LatLonCorners

Arguments

Type IntentOptional Attributes Name
class(Test_LatLonCorners), intent(inout) :: this

Calls

proc~~setup~2~~CallsGraph proc~setup~2 Test_LatLonCorners%setUp ESMF_ConfigCreate ESMF_ConfigCreate proc~setup~2->ESMF_ConfigCreate ESMF_ConfigDestroy ESMF_ConfigDestroy proc~setup~2->ESMF_ConfigDestroy ESMF_ConfigLoadFile ESMF_ConfigLoadFile proc~setup~2->ESMF_ConfigLoadFile mpiassertequal mpiassertequal proc~setup~2->mpiassertequal none~barrier ESMF_TestCase%barrier proc~setup~2->none~barrier none~getlocalpet ESMF_TestCase%getLocalPET proc~setup~2->none~getlocalpet none~initialize~22 LatLonGridFactory%initialize proc~setup~2->none~initialize~22 none~make_grid AbstractGridFactory%make_grid proc~setup~2->none~make_grid ESMF_VMBarrier ESMF_VMBarrier none~barrier->ESMF_VMBarrier none~getvm ESMF_TestCase%getVM none~barrier->none~getvm ESMF_VMGet ESMF_VMGet none~getlocalpet->ESMF_VMGet none~getlocalpet->none~getvm none~initialize_from_esmf_distgrid~7 XYGridFactory%initialize_from_esmf_distGrid none~initialize~22->none~initialize_from_esmf_distgrid~7 make_new_grid make_new_grid none~make_grid->make_new_grid proc~mapl_return MAPL_Return none~make_grid->proc~mapl_return proc~mapl_verify MAPL_Verify none~make_grid->proc~mapl_verify ESMF_GridCompGet ESMF_GridCompGet none~getvm->ESMF_GridCompGet interface~mapl_assert MAPL_Assert none~initialize_from_esmf_distgrid~7->interface~mapl_assert at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception proc~mapl_verify->proc~mapl_throw_exception

Source Code

   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