f_esmf_xgridcreate Subroutine

subroutine f_esmf_xgridcreate(xgrid, num_sideAGrid, sideAGrid, num_sideAMesh, sideAMesh, num_sideBGrid, sideBGrid, num_sideBMesh, sideBMesh, num_sideAGridPriority, sideAGridPriority, num_sideAMeshPriority, sideAMeshPriority, num_sideBGridPriority, sideBGridPriority, num_sideBMeshPriority, sideBMeshPriority, num_sideAMaskValues, sideAMaskValues, num_sideBMaskValues, sideBMaskValues, storeOverlay, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_XGrid) :: xgrid
integer, intent(in) :: num_sideAGrid
type(ESMF_Pointer) :: sideAGrid(num_sideAGrid)
integer, intent(in) :: num_sideAMesh
type(ESMF_Pointer) :: sideAMesh(num_sideAMesh)
integer, intent(in) :: num_sideBGrid
type(ESMF_Pointer) :: sideBGrid(num_sideBGrid)
integer, intent(in) :: num_sideBMesh
type(ESMF_Pointer) :: sideBMesh(num_sideBMesh)
integer, intent(in) :: num_sideAGridPriority
integer :: sideAGridPriority(num_sideAGridPriority)
integer, intent(in) :: num_sideAMeshPriority
integer :: sideAMeshPriority(num_sideAMeshPriority)
integer, intent(in) :: num_sideBGridPriority
integer :: sideBGridPriority(num_sideBGridPriority)
integer, intent(in) :: num_sideBMeshPriority
integer :: sideBMeshPriority(num_sideBMeshPriority)
integer, intent(in) :: num_sideAMaskValues
integer(kind=ESMF_KIND_I4), intent(in) :: sideAMaskValues(num_sideAMaskValues)
integer, intent(in) :: num_sideBMaskValues
integer(kind=ESMF_KIND_I4), intent(in) :: sideBMaskValues(num_sideBMaskValues)
integer, intent(in) :: storeOverlay
integer, intent(out) :: rc

Source Code

  subroutine f_esmf_xgridcreate(xgrid, &
       num_sideAGrid, sideAGrid, &
       num_sideAMesh, sideAMesh, &
       num_sideBGrid, sideBGrid, &
       num_sideBMesh, sideBMesh, &
       num_sideAGridPriority, sideAGridPriority, &
       num_sideAMeshPriority, sideAMeshPriority, &
       num_sideBGridPriority, sideBGridPriority, &
       num_sideBMeshPriority, sideBMeshPriority, &
       num_sideAMaskValues, sideAMaskValues, &
       num_sideBMaskValues, sideBMaskValues, &
       storeOverlay, &
!       name, &  DON'T WORRY ABOUT NAME RIGHT NOW
       rc)

    use ESMF_XGridMod
    use ESMF_XGridCreateMod
    use ESMF_XGridGeomBaseMod
    use ESMF_UtilTypesMod
    use ESMF_BaseMod
    use ESMF_LogErrMod
    use ESMF_GridMod
    use ESMF_MeshMod

    implicit none

    ! Arguments
    type(ESMF_XGrid)               :: xgrid
    integer, intent(in)            :: num_sideAGrid
    type(ESMF_Pointer)             :: sideAGrid(num_sideAGrid)
    integer, intent(in)            :: num_sideAMesh
    type(ESMF_Pointer)             :: sideAMesh(num_sideAMesh)
    integer, intent(in)            :: num_sideBGrid
    type(ESMF_Pointer)             :: sideBGrid(num_sideBGrid)
    integer, intent(in)            :: num_sideBMesh
    type(ESMF_Pointer)             :: sideBMesh(num_sideBMesh)

    integer, intent(in) :: num_sideAGridPriority
    integer             :: sideAGridPriority(num_sideAGridPriority)
    integer, intent(in) :: num_sideAMeshPriority
    integer             :: sideAMeshPriority(num_sideAMeshPriority)
    integer, intent(in) :: num_sideBGridPriority
    integer             :: sideBGridPriority(num_sideBGridPriority)
    integer, intent(in) :: num_sideBMeshPriority
    integer             :: sideBMeshPriority(num_sideBMeshPriority)

    integer, intent(in)            :: num_sideAMaskValues
    integer(ESMF_KIND_I4),intent(in) :: sideAMaskValues(num_sideAMaskValues)
    integer, intent(in)            :: num_sideBMaskValues
    integer(ESMF_KIND_I4),intent(in) :: sideBMaskValues(num_sideBMaskValues)

    integer, intent(in) :: storeOverlay
!    character(len=*),intent(in)    :: name    DON'T WORRY ABOUT NAME RIGHT NOW
    integer, intent(out)           :: rc              

    ! Local variables
    type(ESMF_Grid),allocatable :: localSideAGrid(:)
    type(ESMF_Mesh),allocatable :: localSideAMesh(:)
    type(ESMF_Grid),allocatable :: localSideBGrid(:)
    type(ESMF_Mesh),allocatable :: localSideBMesh(:)
    logical :: localStoreOverlay
    integer :: localrc
    integer :: i

    ! initialize return code; assume routine not implemented
    rc = ESMF_RC_NOT_IMPL
    localrc = ESMF_RC_NOT_IMPL

    !! Create ESMF acceptable versions of class arrays !!

    ! sideAGrid
    allocate(localSideAGrid(num_sideAGrid))
    do i=1,num_sideAGrid
       localSideAGrid(i)%this=sideAGrid(i)
       ESMF_INIT_SET_CREATED(localSideAGrid(i))
    enddo

    ! sideAMesh
    allocate(localSideAMesh(num_sideAMesh))
    do i=1,num_sideAMesh
       localSideAMesh(i)=ESMF_MeshCreate(sideAMesh(i), rc=localrc)
       if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
            ESMF_CONTEXT, rcToReturn=rc)) return
    enddo

    ! sideBGrid
    allocate(localSideBGrid(num_sideBGrid))
    do i=1,num_sideBGrid
       localSideBGrid(i)%this=sideBGrid(i)
       ESMF_INIT_SET_CREATED(localSideBGrid(i))
    enddo

    ! sideBMesh
    allocate(localSideBMesh(num_sideBMesh))
    do i=1,num_sideBMesh
       localSideBMesh(i)=ESMF_MeshCreate(sideBMesh(i), rc=localrc)
       if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
            ESMF_CONTEXT, rcToReturn=rc)) return
    enddo


    ! Translate storeOverlay
    localStoreOverlay=.false.
    if (storeOverlay .ne. 0) localStoreOverlay=.true.


    ! Call into ESMF public interface
    xgrid=ESMF_XGridCreate(&
         sideAGrid=localSideAGrid, &
         sideAMesh=localSideAMesh, &
         sideBGrid=localSideBGrid, &
         sideBMesh=localSideBMesh, &
         sideAGridPriority=sideAGridPriority, & 
         sideAMeshPriority=sideAMeshPriority, &
         sideBGridPriority=sideBGridPriority, &
         sideBMeshPriority=sideBMeshPriority, &
         sideAMaskValues=sideAMaskValues, &
         sideBMaskValues=sideBMaskValues, &
         storeOverlay=localstoreOverlay, &
         ! name, &  DON'T WORRY ABOUT NAME RIGHT NOW
         rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
         ESMF_CONTEXT, rcToReturn=rc)) return
    
    ! Deallocate
    deallocate(localSideAGrid)
    deallocate(localSideAMesh)
    deallocate(localSideBGrid)
    deallocate(localSideBMesh)

    ! return success
    rc = ESMF_SUCCESS
  
  end subroutine f_esmf_xgridcreate