C $Header: /home/ubuntu/mnt/e9_copy/MITgcm/pkg/exch2/exch2_3d_rx.template,v 1.2 2006/11/18 01:09:00 heimbach Exp $ C $Name: $ #include "CPP_EEOPTIONS.h" #include "W2_OPTIONS.h" CBOP C !ROUTINE: EXCH2_3D_RX C !INTERFACE: SUBROUTINE EXCH2_3D_RX( U phi, I myNz, myThid ) C !DESCRIPTION: C *==========================================================* C | SUBROUTINE EXCH2_3D_RX C | o Handle exchanges for _RX, three-dim scalar arrays. C *==========================================================* C | Invoke appropriate exchange routine depending on type C | of grid (cube or globally indexed) to be operated on. C *==========================================================* C !USES: IMPLICIT NONE C === Global data === #include "SIZE.h" #include "EEPARAMS.h" #include "EESUPPORT.h" #include "W2_EXCH2_TOPOLOGY.h" #include "W2_EXCH2_PARAMS.h" C !INPUT/OUTPUT PARAMETERS: C === Routine arguments === C phi :: Array with overlap regions are to be exchanged C myNz :: 3rd dimension of array to exchange C myThid :: My thread id. INTEGER myNz _RX phi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNz,nSx,nSy) INTEGER myThid C !LOCAL VARIABLES: C == Local variables == C OL[wens] :: Overlap extents in west, east, north, south. C exchWidth[XY] :: Extent of regions that will be exchanged. INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY #ifdef W2_FILL_NULL_REGIONS INTEGER bi, bj, myTile, i, j, k #endif CEOP OLw = OLx OLe = OLx OLn = OLy OLs = OLy exchWidthX = OLx exchWidthY = OLy C ** NOTE ** The exchange routine we use here does not C require the preceeding and following barriers. C However, the slow, simple exchange interface C that is calling it here is meant to ensure C that threads are synchronised before exchanges C begine. IF (useCubedSphereExchange) THEN CALL EXCH2_RX1_CUBE( phi, 'T ', I OLw, OLe, OLs, OLn, myNz, I exchWidthX, exchWidthY, I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) #ifdef W2_FILL_NULL_REGIONS DO bj=myByLo(myThid),myByHi(myThid) DO bi=myBxLo(myThid),myBxHi(myThid) myTile = W2_myTileList(bi) C South-east corner IF ( exch2_isEedge(myTile) .EQ. 1 .AND. & exch2_isSedge(myTile) .EQ. 1 ) THEN DO j=1-OLy,0 DO i=sNx+1,sNx+OLx DO k=1,myNz phi(i,j,k,bi,bj)=e2FillValue_RX ENDDO ENDDO ENDDO ENDIF C North-east corner IF ( exch2_isEedge(myTile) .EQ. 1 .AND. & exch2_isNedge(myTile) .EQ. 1 ) THEN DO j=sNy+1,sNy+OLy DO i=sNx+1,sNx+OLx DO k=1,myNz phi(i,j,k,bi,bj)=e2FillValue_RX ENDDO ENDDO ENDDO ENDIF C South-west corner IF ( exch2_isWedge(myTile) .EQ. 1 .AND. & exch2_isSedge(myTile) .EQ. 1 ) THEN DO j=1-OLy,0 DO i=1-OLx,0 DO k=1,myNz phi(i,j,k,bi,bj)=e2FillValue_RX ENDDO ENDDO ENDDO ENDIF C North-west corner IF ( exch2_isWedge(myTile) .EQ. 1 .AND. & exch2_isNedge(myTile) .EQ. 1 ) THEN DO j=sNy+1,sNy+OLy DO i=1-OLx,0 DO k=1,myNz phi(i,j,k,bi,bj)=e2FillValue_RX ENDDO ENDDO ENDDO ENDIF ENDDO ENDDO #endif /* W2_FILL_NULL_REGIONS */ CALL EXCH2_RX1_CUBE( phi, 'T ', I OLw, OLe, OLs, OLn, myNz, I exchWidthX, exchWidthY, I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) #ifdef W2_FILL_NULL_REGIONS DO bj=myByLo(myThid),myByHi(myThid) DO bi=myBxLo(myThid),myBxHi(myThid) myTile = W2_myTileList(bi) C South-east corner IF ( exch2_isEedge(myTile) .EQ. 1 .AND. & exch2_isSedge(myTile) .EQ. 1 ) THEN DO j=1-OLy,0 DO i=sNx+1,sNx+OLx DO k=1,myNz phi(i,j,k,bi,bj)=e2FillValue_RX ENDDO ENDDO ENDDO ENDIF C North-east corner IF ( exch2_isEedge(myTile) .EQ. 1 .AND. & exch2_isNedge(myTile) .EQ. 1 ) THEN DO j=sNy+1,sNy+OLy DO i=sNx+1,sNx+OLx DO k=1,myNz phi(i,j,k,bi,bj)=e2FillValue_RX ENDDO ENDDO ENDDO ENDIF C South-west corner IF ( exch2_isWedge(myTile) .EQ. 1 .AND. & exch2_isSedge(myTile) .EQ. 1 ) THEN DO j=1-OLy,0 DO i=1-OLx,0 DO k=1,myNz phi(i,j,k,bi,bj)=e2FillValue_RX ENDDO ENDDO ENDDO ENDIF C North-west corner IF ( exch2_isWedge(myTile) .EQ. 1 .AND. & exch2_isNedge(myTile) .EQ. 1 ) THEN DO j=sNy+1,sNy+OLy DO i=1-OLx,0 DO k=1,myNz phi(i,j,k,bi,bj)=e2FillValue_RX ENDDO ENDDO ENDDO ENDIF ENDDO ENDDO #endif /* W2_FILL_NULL_REGIONS */ ELSE #ifndef AUTODIFF_EXCH2 CALL EXCH_RX( phi, I OLw, OLe, OLs, OLn, myNz, I exchWidthX, exchWidthY, I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) #endif ENDIF RETURN END C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| CEH3 ;;; Local Variables: *** CEH3 ;;; mode:fortran *** CEH3 ;;; End: ***