MyGridCreate_ Function

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_~~CallsGraph proc~mygridcreate_ MyGridCreate_ ESMF_ConfigCreate ESMF_ConfigCreate proc~mygridcreate_->ESMF_ConfigCreate ESMF_ConfigGetAttribute ESMF_ConfigGetAttribute proc~mygridcreate_->ESMF_ConfigGetAttribute ESMF_ConfigLoadFile ESMF_ConfigLoadFile proc~mygridcreate_->ESMF_ConfigLoadFile ESMF_ConfigSetAttribute ESMF_ConfigSetAttribute proc~mygridcreate_->ESMF_ConfigSetAttribute ESMF_VMGet ESMF_VMGet proc~mygridcreate_->ESMF_VMGet ESMF_VMGetCurrent ESMF_VMGetCurrent proc~mygridcreate_->ESMF_VMGetCurrent mapl_gridcreate mapl_gridcreate proc~mygridcreate_->mapl_gridcreate mapl_set mapl_set proc~mygridcreate_->mapl_set proc~mapl_return MAPL_Return proc~mygridcreate_->proc~mapl_return proc~mapl_verify MAPL_Verify proc~mygridcreate_->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_~~CalledByGraph proc~mygridcreate_ MyGridCreate_ proc~test_main test_main proc~test_main->proc~mygridcreate_ program~utcfio utCFIO program~utcfio->proc~test_main

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, '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)
!    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_