CalculateConnection Subroutine

private subroutine CalculateConnection(centerCount, minIndexPTile, maxIndexPTile, connectionList, rc)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: centerCount
integer, pointer :: minIndexPTile(:,:)
integer, pointer :: maxIndexPTile(:,:)
type(ESMF_DistGridConnection), pointer :: connectionList(:)
integer, intent(out) :: rc

Calls

proc~~calculateconnection~~CallsGraph proc~calculateconnection CalculateConnection proc~esmf_distgridconnectionset ESMF_DistGridConnectionSet proc~calculateconnection->proc~esmf_distgridconnectionset proc~esmf_logfounderror ESMF_LogFoundError proc~calculateconnection->proc~esmf_logfounderror proc~esmf_distgridconnectionset->proc~esmf_logfounderror proc~esmf_distgridconnectionint ESMF_DistGridConnectionInt proc~esmf_distgridconnectionset->proc~esmf_distgridconnectionint esmf_breakpoint esmf_breakpoint proc~esmf_logfounderror->esmf_breakpoint proc~esmf_logrc2msg ESMF_LogRc2Msg proc~esmf_logfounderror->proc~esmf_logrc2msg proc~esmf_logwrite ESMF_LogWrite proc~esmf_logfounderror->proc~esmf_logwrite proc~esmf_distgridconnectionint->proc~esmf_logfounderror c_esmc_distgridconnection c_esmc_distgridconnection proc~esmf_distgridconnectionint->c_esmc_distgridconnection interface~esmf_interarraycreate ESMF_InterArrayCreate proc~esmf_distgridconnectionint->interface~esmf_interarraycreate proc~esmf_interarraydestroy ESMF_InterArrayDestroy proc~esmf_distgridconnectionint->proc~esmf_interarraydestroy c_esmc_loggeterrormsg c_esmc_loggeterrormsg proc~esmf_logrc2msg->c_esmc_loggeterrormsg c_esmc_vmwtime c_esmc_vmwtime proc~esmf_logwrite->c_esmc_vmwtime proc~esmf_logclose ESMF_LogClose proc~esmf_logwrite->proc~esmf_logclose proc~esmf_logflush ESMF_LogFlush proc~esmf_logwrite->proc~esmf_logflush proc~esmf_logopenfile ESMF_LogOpenFile proc~esmf_logwrite->proc~esmf_logopenfile proc~esmf_utiliounitflush ESMF_UtilIOUnitFlush proc~esmf_logwrite->proc~esmf_utiliounitflush proc~esmf_utilstring2array ESMF_UtilString2Array proc~esmf_logwrite->proc~esmf_utilstring2array proc~esmf_interarraycreateptr ESMF_InterArrayCreatePtr interface~esmf_interarraycreate->proc~esmf_interarraycreateptr proc~esmf_interarraycreatetrg ESMF_InterArrayCreateTrg interface~esmf_interarraycreate->proc~esmf_interarraycreatetrg proc~esmf_logfounddeallocerror ESMF_LogFoundDeallocError proc~esmf_interarraydestroy->proc~esmf_logfounddeallocerror proc~esmf_logclose->proc~esmf_logflush proc~esmf_logflush->proc~esmf_utiliounitflush proc~esmf_utilarray2string ESMF_UtilArray2String proc~esmf_logflush->proc~esmf_utilarray2string proc~esmf_logopenfile->proc~esmf_utiliounitflush proc~esmf_utiliounitget ESMF_UtilIOUnitGet proc~esmf_logopenfile->proc~esmf_utiliounitget

Called by

proc~~calculateconnection~~CalledByGraph proc~calculateconnection CalculateConnection proc~esmf_gridcreatecubedsphereireg ESMF_GridCreateCubedSphereIReg proc~esmf_gridcreatecubedsphereireg->proc~calculateconnection proc~esmf_gridcreatecubedspherereg ESMF_GridCreateCubedSphereReg proc~esmf_gridcreatecubedspherereg->proc~calculateconnection interface~esmf_gridcreatecubedsphere ESMF_GridCreateCubedSphere interface~esmf_gridcreatecubedsphere->proc~esmf_gridcreatecubedsphereireg interface~esmf_gridcreatecubedsphere->proc~esmf_gridcreatecubedspherereg proc~createfields createFields proc~createfields->interface~esmf_gridcreatecubedsphere proc~f_esmf_gridcreatecubedsphere f_esmf_gridcreatecubedsphere proc~f_esmf_gridcreatecubedsphere->interface~esmf_gridcreatecubedsphere proc~iocomputestsetup IOCompUTestSetup proc~iocomputestsetup->interface~esmf_gridcreatecubedsphere proc~test_bilinear_regrid_csgrid test_bilinear_regrid_csgrid proc~test_bilinear_regrid_csgrid->interface~esmf_gridcreatecubedsphere proc~test_bilinear_regrid_csgrid_sph_rad test_bilinear_regrid_csgrid_sph_rad proc~test_bilinear_regrid_csgrid_sph_rad->interface~esmf_gridcreatecubedsphere proc~test_conserve_regrid_csgrid test_conserve_regrid_csgrid proc~test_conserve_regrid_csgrid->interface~esmf_gridcreatecubedsphere proc~test_csgridtogrid test_CSGridToGrid proc~test_csgridtogrid->interface~esmf_gridcreatecubedsphere proc~test_csgridtogrid_2nd test_CSGridToGrid_2nd proc~test_csgridtogrid_2nd->interface~esmf_gridcreatecubedsphere proc~test_csgridtogridwmasks test_CSGridToGridWMasks proc~test_csgridtogridwmasks->interface~esmf_gridcreatecubedsphere proc~test_mesh_dual_w_bilinear test_mesh_dual_w_bilinear proc~test_mesh_dual_w_bilinear->interface~esmf_gridcreatecubedsphere proc~test_nearest_regrid_csgrid test_nearest_regrid_csgrid proc~test_nearest_regrid_csgrid->interface~esmf_gridcreatecubedsphere proc~test_nearest_regrid_csmesh test_nearest_regrid_csmesh proc~test_nearest_regrid_csmesh->interface~esmf_gridcreatecubedsphere proc~test_patch_regrid_csgrid test_patch_regrid_csgrid proc~test_patch_regrid_csgrid->interface~esmf_gridcreatecubedsphere proc~test_sph_vec_blnr_csg_to_llg test_sph_vec_blnr_csG_to_llG proc~test_sph_vec_blnr_csg_to_llg->interface~esmf_gridcreatecubedsphere proc~test_sph_vec_blnr_csg_to_llg_p test_sph_vec_blnr_csG_to_llG_p proc~test_sph_vec_blnr_csg_to_llg_p->interface~esmf_gridcreatecubedsphere program~esmf_gridcreateex ESMF_GridCreateEx program~esmf_gridcreateex->interface~esmf_gridcreatecubedsphere program~esmf_gridcreateutest ESMF_GridCreateUTest program~esmf_gridcreateutest->interface~esmf_gridcreatecubedsphere program~esmf_io_multitileutest ESMF_IO_MultitileUTest program~esmf_io_multitileutest->proc~createfields program~esmf_iocomputest ESMF_IOCompUTest program~esmf_iocomputest->proc~iocomputestsetup program~esmf_xgridutest ESMF_XGridUTest program~esmf_xgridutest->proc~test_csgridtogrid_2nd

Source Code

subroutine CalculateConnection(centerCount, minIndexPTile, &
                    maxIndexPTile, connectionList, rc)

! !ARGUMENTS:
    integer,             intent(in)            :: centerCount
    integer, pointer                           :: minIndexPTile(:,:)
    integer, pointer                           :: maxIndexPTile(:,:)
    type(ESMF_DistGridConnection), pointer     :: connectionList(:)
    integer,            intent(out)            :: rc
!IEOP

    integer                                    :: i, j, conn
    integer                                    :: tileCount, tile
    integer                                    :: connectionCount
    integer                                    :: localrc

    rc=ESMF_SUCCESS

    tileCount = 6

    ! - initialize Min/Max
    ! The full cubed sphere has 6 tiles. For testing, tiles can be
    ! turned on incrementally from 1 all the way to 6. Anything greater than
    ! 6 is incorrect.
    tile=0
    if (tile==tileCount) goto 10
    !- tile 1
    tile=1
    minIndexPTile(1,tile)=1
    minIndexPTile(2,tile)=1
    maxIndexPTile(1,tile)=minIndexPTile(1,tile)+centerCount-1
    maxIndexPTile(2,tile)=minIndexPTile(2,tile)+centerCount-1
    if (tile==tileCount) goto 10
    !- tile 2
    tile=2
    minIndexPTile(1,tile)=maxIndexPTile(1,tile-1)+1
    minIndexPTile(2,tile)=minIndexPTile(2,tile-1)
    maxIndexPTile(1,tile)=minIndexPTile(1,tile)+centerCount-1
    maxIndexPTile(2,tile)=minIndexPTile(2,tile)+centerCount-1
    if (tile==tileCount) goto 10
    !- tile 3
    tile=3
    minIndexPTile(1,tile)=minIndexPTile(1,tile-1)
    minIndexPTile(2,tile)=maxIndexPTile(2,tile-1)+1
    maxIndexPTile(1,tile)=minIndexPTile(1,tile)+centerCount-1
    maxIndexPTile(2,tile)=minIndexPTile(2,tile)+centerCount-1
    if (tile==tileCount) goto 10
    !- tile 4
    tile=4
    minIndexPTile(1,tile)=maxIndexPTile(1,tile-1)+1
    minIndexPTile(2,tile)=minIndexPTile(2,tile-1)
    maxIndexPTile(1,tile)=minIndexPTile(1,tile)+centerCount-1
    maxIndexPTile(2,tile)=minIndexPTile(2,tile)+centerCount-1
    if (tile==tileCount) goto 10
    !- tile 5
    tile=5
    minIndexPTile(1,tile)=minIndexPTile(1,tile-1)
    minIndexPTile(2,tile)=maxIndexPTile(2,tile-1)+1
    maxIndexPTile(1,tile)=minIndexPTile(1,tile)+centerCount-1
    maxIndexPTile(2,tile)=minIndexPTile(2,tile)+centerCount-1
    if (tile==tileCount) goto 10
    !- tile 6
    tile=6
    minIndexPTile(1,tile)=maxIndexPTile(1,tile-1)+1
    minIndexPTile(2,tile)=minIndexPTile(2,tile-1)
    maxIndexPTile(1,tile)=minIndexPTile(1,tile)+centerCount-1
    maxIndexPTile(2,tile)=minIndexPTile(2,tile)+centerCount-1
    if (tile==tileCount) goto 10

10  continue

    ! - connectionList
    ! The full cubed sphere has 12 conections. For testing, connections can be
    ! turned on incrementally from 0 all the way to 12. Anything greater than
    ! 12 is incorrect.
    connectionCount = 12  ! between 0 ... and ... 12.

    ! Connections are either defined on the basis of centers or corners, they
    ! are NOT the same! Our current strategy is to define connections for
    ! centers, and add corners with padding and no connections. This way we
    ! can regrid center data bilinear and conservatively. We cannot handle
    ! regridding for data on corner stagger, plus we have degeneracies in that
    ! case of exlusive elements. However, we believe that the current
    ! application of this is for only data on center stagger.

    conn=0
    if (conn==connectionCount) goto 20

    conn=conn+1
    call ESMF_DistGridConnectionSet(connection=connectionList(conn), &
      tileIndexA=1, tileIndexB=2, positionVector=(/0, 0/), rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return
    if (conn==connectionCount) goto 20

    conn=conn+1
    call ESMF_DistGridConnectionSet(connection=connectionList(conn), &
      tileIndexA=2, tileIndexB=3, positionVector=(/0, 0/), rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return
    if (conn==connectionCount) goto 20

    conn=conn+1
    call ESMF_DistGridConnectionSet(connection=connectionList(conn), &
      tileIndexA=3, tileIndexB=4, positionVector=(/0, 0/), rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return
    if (conn==connectionCount) goto 20

    conn=conn+1
    call ESMF_DistGridConnectionSet(connection=connectionList(conn), &
      tileIndexA=4, tileIndexB=5, positionVector=(/0, 0/), rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return
    if (conn==connectionCount) goto 20

    conn=conn+1
    call ESMF_DistGridConnectionSet(connection=connectionList(conn), &
      tileIndexA=5, tileIndexB=6, positionVector=(/0, 0/), rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return
    if (conn==connectionCount) goto 20

    conn=conn+1
    call ESMF_DistGridConnectionSet(connection=connectionList(conn), &
      tileIndexA=1, tileIndexB=6, &
      positionVector=(/ &     ! only shift
      minIndexPTile(1,6)-minIndexPTile(1,1),  &
      maxIndexPTile(2,6)-minIndexPTile(2,1)+1/), &
      rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return
    if (conn==connectionCount) goto 20

    conn=conn+1
    call ESMF_DistGridConnectionSet(connection=connectionList(conn), &
      tileIndexA=1, tileIndexB=3, orientationVector=(/2, -1/), &  ! 270 deg rot
      positionVector=(/minIndexPTile(1,3)-1-maxIndexPTile(2,1), &
                       maxIndexPTile(2,3)+minIndexPTile(1,1)/), &
      rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return
    if (conn==connectionCount) goto 20

    conn=conn+1
    call ESMF_DistGridConnectionSet(connection=connectionList(conn), &
      tileIndexA=2, tileIndexB=4, orientationVector=(/-2, 1/), &  ! 90 deg rot
      positionVector=(/minIndexPTile(1,4)+maxIndexPTile(2,2),     &
                       minIndexPTile(2,4)-maxIndexPTile(1,2)-1/), &
      rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return
    if (conn==connectionCount) goto 20

    conn=conn+1
    call ESMF_DistGridConnectionSet(connection=connectionList(conn), &
      tileIndexA=3, tileIndexB=5, orientationVector=(/2, -1/), &  ! 270 deg rot
      positionVector=(/minIndexPTile(1,5)-1-maxIndexPTile(2,3), &
                       maxIndexPTile(2,5)+minIndexPTile(1,3)/), &
      rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return
    if (conn==connectionCount) goto 20

    conn=conn+1
    call ESMF_DistGridConnectionSet(connection=connectionList(conn), &
      tileIndexA=4, tileIndexB=6, orientationVector=(/-2, 1/), &  ! 90 deg rot
      positionVector=(/minIndexPTile(1,6)+maxIndexPTile(2,4),     &
                       minIndexPTile(2,6)-maxIndexPTile(1,4)-1/), &
      rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return
    if (conn==connectionCount) goto 20

    conn=conn+1
    call ESMF_DistGridConnectionSet(connection=connectionList(conn), &
      tileIndexA=5, tileIndexB=1, orientationVector=(/2, -1/), &  ! 270 deg rot
      positionVector=(/minIndexPTile(1,1)-1-maxIndexPTile(2,5), &
                       maxIndexPTile(2,1)+minIndexPTile(1,5)/), &
      rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return
    if (conn==connectionCount) goto 20

    conn=conn+1
    call ESMF_DistGridConnectionSet(connection=connectionList(conn), &
      tileIndexA=6, tileIndexB=2, orientationVector=(/-2, 1/), &  ! 90 deg rot
      positionVector=(/minIndexPTile(1,2)+maxIndexPTile(2,6),     &
                       minIndexPTile(2,2)-maxIndexPTile(1,6)-1/), &
      rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return
    if (conn==connectionCount) goto 20

20  continue

    return

end subroutine CalculateConnection