MyGridCreate_ Function

public function MyGridCreate_(VM, rc) result(grid)

Arguments

Type IntentOptional Attributes Name
type(ESMF_VM), intent(inout) :: VM
integer, intent(out), optional :: rc

Return Value type(ESMF_Grid)


Calls

proc~~mygridcreate_~2~~CallsGraph proc~mygridcreate_~2 MyGridCreate_ ESMF_ConfigCreate ESMF_ConfigCreate proc~mygridcreate_~2->ESMF_ConfigCreate ESMF_ConfigGetAttribute ESMF_ConfigGetAttribute proc~mygridcreate_~2->ESMF_ConfigGetAttribute ESMF_ConfigLoadFile ESMF_ConfigLoadFile proc~mygridcreate_~2->ESMF_ConfigLoadFile ESMF_ConfigSetAttribute ESMF_ConfigSetAttribute proc~mygridcreate_~2->ESMF_ConfigSetAttribute ESMF_VMGet ESMF_VMGet proc~mygridcreate_~2->ESMF_VMGet ESMF_VMGetCurrent ESMF_VMGetCurrent proc~mygridcreate_~2->ESMF_VMGetCurrent mapl_gridcreate mapl_gridcreate proc~mygridcreate_~2->mapl_gridcreate mapl_set mapl_set proc~mygridcreate_~2->mapl_set proc~mapl_return MAPL_Return proc~mygridcreate_~2->proc~mapl_return proc~mapl_verify MAPL_Verify proc~mygridcreate_~2->proc~mapl_verify 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

Called by

proc~~mygridcreate_~2~~CalledByGraph proc~mygridcreate_~2 MyGridCreate_ proc~test_main~2 test_main proc~test_main~2->proc~mygridcreate_~2

Source Code

  function MyGridCreate_ ( vm, rc) result(grid)
    
    type (ESMF_VM),    intent(INOUT) :: VM
    integer, optional, intent(OUT)   :: rc
    type (ESMF_Grid)                 :: grid

! Local vars
    integer                                 :: status
    character(len=ESMF_MAXSTR), parameter   :: IAm='MyGridCreate'

    type(MAPL_MetaComp)          :: mapl
    type(ESMF_Config)            :: config
!    type(ESMF_VM)                :: vm
    character(len=ESMF_MAXSTR)   :: gridname
    integer                      :: ndes, nx, ny

! fake MAPL
    config = ESMF_ConfigCreate (rc=STATUS )
    _VERIFY(STATUS)

   call ESMF_ConfigLoadFile(config, 'tmp_CAP.rc', rc=STATUS )
   _VERIFY(STATUS)
    
! We will set-up a somewhat realistic resource "file"

    call ESMF_VmGetCurrent(VM, rc=status)
    _VERIFY(STATUS)
    call ESMF_VmGet(VM, petCount=ndes, rc=status)
    _VERIFY(STATUS)

    nx = ndes
    ny = 1
    call ESMF_ConfigSetAttribute(config, value=nx, Label='NX:', rc=status)
    _VERIFY(STATUS)
    call ESMF_ConfigSetAttribute(config, value=ny, Label='NY:', rc=status)
    _VERIFY(STATUS)
!C$    call ESMF_ConfigSetAttribute(config, value=gridname, Label='GRIDNAME:', rc = status )
    call ESMF_ConfigGetAttribute(config, value=gridname, Label='GRIDNAME:', rc = status )
    _VERIFY(STATUS)
    call ESMF_ConfigSetAttribute(config, value=KM_WORLD, Label='LM:', rc = status )
!    _VERIFY(STATUS)

    call ESMF_ConfigGetAttribute(config, value=nx, Label='NX:', rc=status)
    _VERIFY(STATUS)
    call ESMF_ConfigGetAttribute(config, value=ny, Label='NY:', rc=status)
    _VERIFY(STATUS)
    print *,'GRIDNAME=',trim(gridname)
    print *,'NX=',nx
    print *,'NX=',nY

!  CAP's MAPL MetaComp
!---------------------

    call MAPL_Set (mapl, name='CAP', cf=CONFIG,    rc=STATUS )
    _VERIFY(STATUS)

! grid create
    call MAPL_GridCreate(MAPLOBJ=mapl, ESMFGRID=grid, rc=status)
    _RETURN(STATUS)

  end function MyGridCreate_