1 |
C $Header: /u/gcmpack/MITgcm/eesupp/src/exch_3d_rx.template,v 1.1 2006/08/23 15:18:46 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PACKAGES_CONFIG.h" |
5 |
#include "CPP_EEOPTIONS.h" |
6 |
|
7 |
CBOP |
8 |
C !ROUTINE: EXCH_3D_RX |
9 |
|
10 |
C !INTERFACE: |
11 |
SUBROUTINE EXCH_3D_RX( |
12 |
U phi, |
13 |
I myNz, myThid ) |
14 |
|
15 |
C !DESCRIPTION: |
16 |
C *==========================================================* |
17 |
C | SUBROUTINE EXCH_3D_RX |
18 |
C | o Handle exchanges for _RX, three-dim scalar arrays. |
19 |
C *==========================================================* |
20 |
C | Invoke appropriate exchange routine depending on type |
21 |
C | of grid (cube or globally indexed) to be operated on. |
22 |
C *==========================================================* |
23 |
|
24 |
C !USES: |
25 |
IMPLICIT NONE |
26 |
C === Global data === |
27 |
#include "SIZE.h" |
28 |
#include "EEPARAMS.h" |
29 |
c#include "EESUPPORT.h" |
30 |
c#include "EXCH.h" |
31 |
|
32 |
C !INPUT/OUTPUT PARAMETERS: |
33 |
C === Routine arguments === |
34 |
C phi :: Array with overlap regions are to be exchanged |
35 |
C myNz :: 3rd dimension of array to exchange |
36 |
C myThid :: My thread id. |
37 |
INTEGER myNz |
38 |
_RX phi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:myNz,nSx,nSy) |
39 |
INTEGER myThid |
40 |
|
41 |
C !LOCAL VARIABLES: |
42 |
#ifndef ALLOW_EXCH2 |
43 |
C == Local variables == |
44 |
C OL[wens] :: Overlap extents in west, east, north, south. |
45 |
C exchWidth[XY] :: Extent of regions that will be exchanged. |
46 |
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY |
47 |
#endif |
48 |
CEOP |
49 |
|
50 |
#ifdef ALLOW_EXCH2 |
51 |
CALL EXCH2_3D_RX( phi, myNz, myThid ) |
52 |
RETURN |
53 |
#else /* ALLOW_EXCH2 */ |
54 |
|
55 |
OLw = OLx |
56 |
OLe = OLx |
57 |
OLn = OLy |
58 |
OLs = OLy |
59 |
exchWidthX = OLx |
60 |
exchWidthY = OLy |
61 |
C ** NOTE ** The exchange routine we use here does not |
62 |
C require the preceeding and following barriers. |
63 |
C However, the slow, simple exchange interface |
64 |
C that is calling it here is meant to ensure |
65 |
C that threads are synchronised before exchanges |
66 |
C begine. |
67 |
IF (useCubedSphereExchange) THEN |
68 |
CALL EXCH_RX_CUBE( phi, |
69 |
I OLw, OLe, OLs, OLn, myNz, |
70 |
I exchWidthX, exchWidthY, |
71 |
I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
72 |
ELSE |
73 |
CALL EXCH_RX( phi, |
74 |
I OLw, OLe, OLs, OLn, myNz, |
75 |
I exchWidthX, exchWidthY, |
76 |
I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
77 |
ENDIF |
78 |
|
79 |
RETURN |
80 |
#endif /* ALLOW_EXCH2 */ |
81 |
END |