1 |
heimbach |
1.1 |
C /==========================================================\ |
2 |
|
|
C | SUBROUTINEs adexch_z_xy_rs adexch_z_xyz_rs | |
3 |
|
|
C | adexch_z_xy_rl adexch_z_xyz_rl | |
4 |
|
|
C | o adjoint routines to exchange routines | |
5 |
|
|
C |==========================================================| |
6 |
|
|
C | These routines essentially are calling the original | |
7 |
|
|
C | routines in reverse mode. | |
8 |
|
|
C | These are regular adjoint routines with no innermost | |
9 |
|
|
C | dimension added. | |
10 |
|
|
C | Calls to these routines will be generated automatically | |
11 |
|
|
C | by TAMC if correct flow directives are given | |
12 |
|
|
C | tamc -reverse .... | |
13 |
|
|
C | | |
14 |
|
|
C | written and tested by Ralf Giering, Jan. 14th 1999 | |
15 |
|
|
C | added new S/R's for _xz_ , _yz_ heimbach@mit.edu May-01 | |
16 |
|
|
C \==========================================================/ |
17 |
|
|
|
18 |
|
|
#include "CPP_EEOPTIONS.h" |
19 |
|
|
|
20 |
|
|
CStartOfInterface |
21 |
|
|
SUBROUTINE adexch_z_xy_rs( |
22 |
|
|
I myThid |
23 |
|
|
U , adphi |
24 |
|
|
& ) |
25 |
|
|
C /==========================================================\ |
26 |
|
|
C | SUBROUTINE ADEXCH_Z_XY_RS adjoint of EXCH_Z_XY_RS | |
27 |
|
|
C | o Handle exchanges for real*4, two-dimensional arrays. | |
28 |
|
|
C |==========================================================| |
29 |
|
|
C === Global data === |
30 |
|
|
implicit none |
31 |
|
|
#include "SIZE.h" |
32 |
|
|
#include "EEPARAMS.h" |
33 |
|
|
#include "EESUPPORT.h" |
34 |
|
|
|
35 |
|
|
C === Routine arguments === |
36 |
|
|
C phi - Array who's overlap regions are to be exchanged |
37 |
|
|
C myThid - My thread id. |
38 |
|
|
_RS adphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
39 |
|
|
INTEGER myThid |
40 |
|
|
CEndOfInterface |
41 |
|
|
C == Local variables == |
42 |
|
|
C OL[wens] - Overlap extents in west, east, north, south. |
43 |
|
|
C exchWidth[XY] - Extent of regions that will be exchanged. |
44 |
|
|
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY |
45 |
|
|
INTEGER mysNx, mysNy, myNz |
46 |
|
|
|
47 |
|
|
OLw = OLx |
48 |
|
|
OLe = OLx |
49 |
|
|
OLn = OLy |
50 |
|
|
OLs = OLy |
51 |
|
|
exchWidthX = OLx |
52 |
|
|
exchWidthY = OLy |
53 |
|
|
mysNx = sNx |
54 |
|
|
mysNy = sNy |
55 |
|
|
myNz = 1 |
56 |
|
|
C ** NOTE ** The exchange routine we use here does not |
57 |
|
|
C require the preceeding and following barriers. |
58 |
|
|
C However, the slow, simple exchange interface |
59 |
|
|
C that is calling it here is meant to ensure |
60 |
|
|
C that threads are synchronised before exchanges |
61 |
|
|
C begine. |
62 |
|
|
IF (useCubedSphereExchange) THEN |
63 |
|
|
CALL EXCH_Z_RS_CUBE( adphi, |
64 |
|
|
I OLw, OLe, OLs, OLn, myNz, |
65 |
|
|
I exchWidthX, exchWidthY, |
66 |
|
|
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
67 |
|
|
ELSE |
68 |
|
|
CALL EXCH_RS( adphi, |
69 |
|
|
I OLw, OLe, OLs, OLn, myNz, |
70 |
|
|
I exchWidthX, exchWidthY, |
71 |
|
|
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
72 |
|
|
ENDIF |
73 |
|
|
|
74 |
|
|
RETURN |
75 |
|
|
END |
76 |
|
|
|
77 |
|
|
|
78 |
|
|
CStartOfInterface |
79 |
|
|
SUBROUTINE adexch_z_xy_rl( |
80 |
|
|
I myThid |
81 |
|
|
U , adphi |
82 |
|
|
& ) |
83 |
|
|
C /==========================================================\ |
84 |
|
|
C | SUBROUTINE ADEXCH_Z_XY_RL adjoint of EXCH_Z_XY_RL | |
85 |
|
|
C | o Handle exchanges for real*8, two-dimensional arrays. | |
86 |
|
|
C |==========================================================| |
87 |
|
|
C === Global data === |
88 |
|
|
#include "SIZE.h" |
89 |
|
|
#include "EEPARAMS.h" |
90 |
|
|
#include "EESUPPORT.h" |
91 |
|
|
|
92 |
|
|
C === Routine arguments === |
93 |
|
|
C phi - Array who's overlap regions are to be exchanged |
94 |
|
|
C myThid - My thread id. |
95 |
|
|
_RL adphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
96 |
|
|
INTEGER myThid |
97 |
|
|
CEndOfInterface |
98 |
|
|
C == Local variables == |
99 |
|
|
C OL[wens] - Overlap extents in west, east, north, south. |
100 |
|
|
C exchWidth[XY] - Extent of regions that will be exchanged. |
101 |
|
|
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY |
102 |
|
|
INTEGER mysNx, mysNy, myNz |
103 |
|
|
|
104 |
|
|
OLw = OLx |
105 |
|
|
OLe = OLx |
106 |
|
|
OLn = OLy |
107 |
|
|
OLs = OLy |
108 |
|
|
exchWidthX = OLx |
109 |
|
|
exchWidthY = OLy |
110 |
|
|
mysNx = sNx |
111 |
|
|
mysNy = sNy |
112 |
|
|
myNz = 1 |
113 |
|
|
C ** NOTE ** The exchange routine we use here does not |
114 |
|
|
C require the preceeding and following barriers. |
115 |
|
|
C However, the slow, simple exchange interface |
116 |
|
|
C that is calling it here is meant to ensure |
117 |
|
|
C that threads are synchronised before exchanges |
118 |
|
|
C begine. |
119 |
|
|
IF (useCubedSphereExchange) THEN |
120 |
|
|
CALL EXCH_Z_RL_CUBE( adphi, |
121 |
|
|
I OLw, OLe, OLs, OLn, myNz, |
122 |
|
|
I exchWidthX, exchWidthY, |
123 |
|
|
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
124 |
|
|
ELSE |
125 |
|
|
CALL EXCH_RL( adphi, |
126 |
|
|
I OLw, OLe, OLs, OLn, myNz, |
127 |
|
|
I exchWidthX, exchWidthY, |
128 |
|
|
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
129 |
|
|
ENDIF |
130 |
|
|
|
131 |
|
|
RETURN |
132 |
|
|
END |
133 |
|
|
|
134 |
|
|
|
135 |
|
|
CStartOfInterface |
136 |
|
|
SUBROUTINE adexch_z_xyz_rs( |
137 |
|
|
I myThid |
138 |
|
|
U , adphi |
139 |
|
|
& ) |
140 |
|
|
C /==========================================================\ |
141 |
|
|
C | SUBROUTINE ADEXCH_Z_XYZ_RS adjoint of EXCH_Z_XYZ_RS | |
142 |
|
|
C | o Handle exchanges for real*4, two-dimensional arrays. | |
143 |
|
|
C |==========================================================| |
144 |
|
|
C === Global data === |
145 |
|
|
#include "SIZE.h" |
146 |
|
|
#include "EEPARAMS.h" |
147 |
|
|
#include "EESUPPORT.h" |
148 |
|
|
|
149 |
|
|
C === Routine arguments === |
150 |
|
|
C phi - Array who's overlap regions are to be exchanged |
151 |
|
|
C myThid - My thread id. |
152 |
|
|
_RS adphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nr,nSx,nSy) |
153 |
|
|
INTEGER myThid |
154 |
|
|
CEndOfInterface |
155 |
|
|
C == Local variables == |
156 |
|
|
C OL[wens] - Overlap extents in west, east, north, south. |
157 |
|
|
C exchWidth[XYZ] - Extent of regions that will be exchanged. |
158 |
|
|
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY |
159 |
|
|
INTEGER mysNx, mysNy, myNz |
160 |
|
|
|
161 |
|
|
OLw = OLx |
162 |
|
|
OLe = OLx |
163 |
|
|
OLn = OLy |
164 |
|
|
OLs = OLy |
165 |
|
|
exchWidthX = OLx |
166 |
|
|
exchWidthY = OLy |
167 |
|
|
mysNx = sNx |
168 |
|
|
mysNy = sNy |
169 |
|
|
myNz = Nr |
170 |
|
|
C ** NOTE ** The exchange routine we use here does not |
171 |
|
|
C require the preceeding and following barriers. |
172 |
|
|
C However, the slow, simple exchange interface |
173 |
|
|
C that is calling it here is meant to ensure |
174 |
|
|
C that threads are synchronised before exchanges |
175 |
|
|
C begine. |
176 |
|
|
IF (useCubedSphereExchange) THEN |
177 |
|
|
CALL EXCH_Z_RS_CUBE( adphi, |
178 |
|
|
I OLw, OLe, OLs, OLn, myNz, |
179 |
|
|
I exchWidthX, exchWidthY, |
180 |
|
|
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
181 |
|
|
ELSE |
182 |
|
|
CALL EXCH_RS( adphi, |
183 |
|
|
I OLw, OLe, OLs, OLn, myNz, |
184 |
|
|
I exchWidthX, exchWidthY, |
185 |
|
|
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
186 |
|
|
ENDIF |
187 |
|
|
|
188 |
|
|
RETURN |
189 |
|
|
END |
190 |
|
|
|
191 |
|
|
|
192 |
|
|
CStartOfInterface |
193 |
|
|
SUBROUTINE adexch_z_xyz_rl( |
194 |
|
|
I myThid |
195 |
|
|
U , adphi |
196 |
|
|
& ) |
197 |
|
|
C /==========================================================\ |
198 |
|
|
C | SUBROUTINE ADEXCH_Z_XYZ_RL adjoint of EXCH_Z_XYZ_RL | |
199 |
|
|
C | o Handle exchanges for real*8, two-dimensional arrays. | |
200 |
|
|
C |==========================================================| |
201 |
|
|
C === Global data === |
202 |
|
|
#include "SIZE.h" |
203 |
|
|
#include "EEPARAMS.h" |
204 |
|
|
#include "EESUPPORT.h" |
205 |
|
|
|
206 |
|
|
C === Routine arguments === |
207 |
|
|
C phi - Array who's overlap regions are to be exchanged |
208 |
|
|
C myThid - My thread id. |
209 |
|
|
_RL adphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nr,nSx,nSy) |
210 |
|
|
INTEGER myThid |
211 |
|
|
CEndOfInterface |
212 |
|
|
C == Local variables == |
213 |
|
|
C OL[wens] - Overlap extents in west, east, north, south. |
214 |
|
|
C exchWidth[XYZ] - Extent of regions that will be exchanged. |
215 |
|
|
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY |
216 |
|
|
INTEGER mysNx, mysNy, myNz |
217 |
|
|
|
218 |
|
|
OLw = OLx |
219 |
|
|
OLe = OLx |
220 |
|
|
OLn = OLy |
221 |
|
|
OLs = OLy |
222 |
|
|
exchWidthX = OLx |
223 |
|
|
exchWidthY = OLy |
224 |
|
|
mysNx = sNx |
225 |
|
|
mysNy = sNy |
226 |
|
|
myNz = Nr |
227 |
|
|
C ** NOTE ** The exchange routine we use here does not |
228 |
|
|
C require the preceeding and following barriers. |
229 |
|
|
C However, the slow, simple exchange interface |
230 |
|
|
C that is calling it here is meant to ensure |
231 |
|
|
C that threads are synchronised before exchanges |
232 |
|
|
C begine. |
233 |
|
|
IF (useCubedSphereExchange) THEN |
234 |
|
|
CALL EXCH_Z_RL_CUBE( adphi, |
235 |
|
|
I OLw, OLe, OLs, OLn, myNz, |
236 |
|
|
I exchWidthX, exchWidthY, |
237 |
|
|
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
238 |
|
|
ELSE |
239 |
|
|
CALL EXCH_RL( adphi, |
240 |
|
|
I OLw, OLe, OLs, OLn, myNz, |
241 |
|
|
I exchWidthX, exchWidthY, |
242 |
|
|
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
243 |
|
|
ENDIF |
244 |
|
|
|
245 |
|
|
RETURN |
246 |
|
|
END |