1 |
C $Header$ |
C $Header$ |
2 |
C $Name$ |
C $Name$ |
3 |
|
|
4 |
|
#include "PACKAGES_CONFIG.h" |
5 |
#include "CPP_EEOPTIONS.h" |
#include "CPP_EEOPTIONS.h" |
6 |
|
#ifdef ALLOW_EXCH2 |
7 |
|
#include "W2_OPTIONS.h" |
8 |
|
#endif |
9 |
|
|
10 |
|
CBOP |
11 |
|
C !ROUTINE: EXCH_UV_XY_RX |
12 |
|
|
13 |
|
C !INTERFACE: |
14 |
SUBROUTINE EXCH_UV_XY_RX( |
SUBROUTINE EXCH_UV_XY_RX( |
15 |
U Uphi, Vphi, withSigns, |
U uPhi, vPhi, |
16 |
I myThid ) |
I withSigns, myThid ) |
17 |
C /==========================================================\ |
|
18 |
C | SUBROUTINE EXCH_UV_XY_RX | |
C !DESCRIPTION: |
19 |
C | o Handle exchanges for _RX, two-dimensional arrays. | |
C *==========================================================* |
20 |
C |==========================================================| |
C | SUBROUTINE EXCH_UV_XY_RX |
21 |
C | Do true shared-memory data transfers and "messaging" | |
C | o Handle exchanges for _RX, 2-dimensional vector arrays. |
22 |
C | tranfers for blocking case of data transfers. | |
C *==========================================================* |
23 |
C | Applications call this routine using | |
C | Vector arrays need to be rotated and interchaged for |
24 |
C | CALL EXCH..( x, myThid ) | |
C | exchange operations on some grids. This driver routine |
25 |
C | where x is a two-dimensional array with overlaps. | |
C | branches to support this. |
26 |
C | This routine does true-shared-memory copies for blocks | |
C *==========================================================* |
27 |
C | within a thread. It will also do MPI meesaging between | |
|
28 |
C | different processes. | |
C !USES: |
|
C | Note: | |
|
|
C | ===== | |
|
|
C | This routine is a default mode interface to the more | |
|
|
C | general exchange routine. Under default mode the | |
|
|
C | exchange is for an edge width of OLx, and OLy and | |
|
|
C | updates corner points as well as edges ( slightly more | |
|
|
C | synchronisation required). | |
|
|
C \==========================================================/ |
|
29 |
IMPLICIT NONE |
IMPLICIT NONE |
30 |
|
|
31 |
C === Global data === |
C === Global data === |
32 |
#include "SIZE.h" |
#include "SIZE.h" |
33 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
|
#include "EESUPPORT.h" |
|
34 |
|
|
35 |
|
C !INPUT/OUTPUT PARAMETERS: |
36 |
C === Routine arguments === |
C === Routine arguments === |
37 |
C phi - Array with overlap regions are to be exchanged |
C uPhi :: 2 components of a vector field with overlap regions |
38 |
C Note - The interface to EXCH_RL assumes that |
C vPhi :: to be exchanged |
39 |
C the standard Fortran 77 sequence association rules |
C withSigns :: Flag controlling whether vector is signed. |
40 |
C apply. |
C myThid :: my Thread Id. number |
41 |
C myThid - My thread id. |
_RX uPhi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
42 |
_RX Uphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
_RX vPhi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
|
_RX Vphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
|
43 |
LOGICAL withSigns |
LOGICAL withSigns |
44 |
INTEGER myThid |
INTEGER myThid |
|
CEndOfInterface |
|
45 |
|
|
46 |
|
C !LOCAL VARIABLES: |
47 |
|
#ifndef ALLOW_EXCH2 |
48 |
C == Local variables == |
C == Local variables == |
49 |
C OL[wens] - Overlap extents in west, east, north, south. |
C OL[wens] :: Overlap extents in west, east, north, south. |
50 |
C exchWidth[XY] - Extent of regions that will be exchanged. |
C exchWidth[XY] :: Extent of regions that will be exchanged. |
51 |
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY, myNz |
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY, myNz |
52 |
|
#endif |
53 |
|
CEOP |
54 |
|
|
55 |
|
#ifdef ALLOW_EXCH2 |
56 |
|
#ifdef W2_USE_R1_ONLY |
57 |
|
CALL EXCH2_UV_CGRID_3D_RX( |
58 |
|
U uPhi, vPhi, |
59 |
|
I withSigns, 1, myThid ) |
60 |
|
#else |
61 |
|
CALL EXCH2_UV_3D_RX( |
62 |
|
U uPhi, vPhi, |
63 |
|
I withSigns, 1, myThid ) |
64 |
|
#endif |
65 |
|
#else /* ALLOW_EXCH2 */ |
66 |
|
|
67 |
OLw = OLx |
OLw = OLx |
68 |
OLe = OLx |
OLe = OLx |
71 |
exchWidthX = OLx |
exchWidthX = OLx |
72 |
exchWidthY = OLy |
exchWidthY = OLy |
73 |
myNz = 1 |
myNz = 1 |
|
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. |
|
|
_BARRIER |
|
74 |
IF (useCubedSphereExchange) THEN |
IF (useCubedSphereExchange) THEN |
75 |
CALL EXCH_UV_RX_CUBE( Uphi, Vphi, withSigns, |
CALL EXCH1_UV_RX_CUBE( uPhi, vPhi, withSigns, |
76 |
I OLw, OLe, OLs, OLn, myNz, |
I OLw, OLe, OLs, OLn, myNz, |
77 |
I exchWidthX, exchWidthY, |
I exchWidthX, exchWidthY, |
78 |
I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
I EXCH_UPDATE_CORNERS, myThid ) |
79 |
ELSE |
ELSE |
80 |
c CALL EXCH_RX( Uphi, |
#ifdef DISCONNECTED_TILES |
81 |
c I OLw, OLe, OLs, OLn, myNz, |
CALL EXCH0_RX( uPhi, |
82 |
c I exchWidthX, exchWidthY, |
I OLw, OLe, OLs, OLn, myNz, |
83 |
c I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
I exchWidthX, exchWidthY, |
84 |
c CALL EXCH_RX( Vphi, |
I EXCH_UPDATE_CORNERS, myThid ) |
85 |
c I OLw, OLe, OLs, OLn, myNz, |
CALL EXCH0_RX( vPhi, |
86 |
c I exchWidthX, exchWidthY, |
I OLw, OLe, OLs, OLn, myNz, |
87 |
c I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
I exchWidthX, exchWidthY, |
88 |
c_jmc: for JAM compatibility, replace the 2 CALLs above by the 2 CPP_MACROs: |
I EXCH_UPDATE_CORNERS, myThid ) |
89 |
_EXCH_XY_RX( Uphi, myThid ) |
#else /* DISCONNECTED_TILES */ |
90 |
_EXCH_XY_RX( Vphi, myThid ) |
CALL EXCH1_RX( uPhi, |
91 |
|
I OLw, OLe, OLs, OLn, myNz, |
92 |
|
I exchWidthX, exchWidthY, |
93 |
|
I EXCH_UPDATE_CORNERS, myThid ) |
94 |
|
CALL EXCH1_RX( vPhi, |
95 |
|
I OLw, OLe, OLs, OLn, myNz, |
96 |
|
I exchWidthX, exchWidthY, |
97 |
|
I EXCH_UPDATE_CORNERS, myThid ) |
98 |
|
#endif /* DISCONNECTED_TILES */ |
99 |
ENDIF |
ENDIF |
100 |
_BARRIER |
|
101 |
|
#endif /* ALLOW_EXCH2 */ |
102 |
|
|
103 |
RETURN |
RETURN |
104 |
END |
END |
105 |
|
|
106 |
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
107 |
|
|
108 |
|
CEH3 ;;; Local Variables: *** |
109 |
|
CEH3 ;;; mode:fortran *** |
110 |
|
CEH3 ;;; End: *** |