1 |
C /==========================================================\ |
2 |
C | SUBROUTINEs adexch_xy_rs adexch_xyz_rs | |
3 |
C | adexch_xy_rl adexch_xyz_rl | |
4 |
C | adexch_xz_rs adexch_yz_rs | |
5 |
C | adexch_xz_rl adexch_yz_rl | |
6 |
C | o adjoint routines to exchange routines | |
7 |
C |==========================================================| |
8 |
C | These routines essentially are calling the original | |
9 |
C | routines in reverse mode. | |
10 |
C | These are regular adjoint routines with no innermost | |
11 |
C | dimension added. | |
12 |
C | Calls to these routines will be generated automatically | |
13 |
C | by TAMC if correct flow directives are given | |
14 |
C | tamc -reverse .... | |
15 |
C | | |
16 |
C | written and tested by Ralf Giering, Jan. 14th 1999 | |
17 |
C | added new S/R's for _xz_ , _yz_ heimbach@mit.edu May-01 | |
18 |
C \==========================================================/ |
19 |
|
20 |
#include "CPP_EEOPTIONS.h" |
21 |
|
22 |
CStartOfInterface |
23 |
SUBROUTINE adexch_xy_rs( |
24 |
I myThid |
25 |
U , adphi |
26 |
& ) |
27 |
C /==========================================================\ |
28 |
C | SUBROUTINE ADEXCH_XY_RS adjoint of EXCH_XY_RS | |
29 |
C | o Handle exchanges for real*4, two-dimensional arrays. | |
30 |
C |==========================================================| |
31 |
C === Global data === |
32 |
implicit none |
33 |
#include "SIZE.h" |
34 |
#include "EEPARAMS.h" |
35 |
#include "EESUPPORT.h" |
36 |
|
37 |
C === Routine arguments === |
38 |
C phi - Array who's overlap regions are to be exchanged |
39 |
C myThid - My thread id. |
40 |
_RS adphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
41 |
INTEGER myThid |
42 |
CEndOfInterface |
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 |
INTEGER mysNx, mysNy, myNz |
48 |
|
49 |
OLw = OLx |
50 |
OLe = OLx |
51 |
OLn = OLy |
52 |
OLs = OLy |
53 |
exchWidthX = OLx |
54 |
exchWidthY = OLy |
55 |
mysNx = sNx |
56 |
mysNy = sNy |
57 |
myNz = 1 |
58 |
C ** NOTE ** The exchange routine we use here does not |
59 |
C require the preceeding and following barriers. |
60 |
C However, the slow, simple exchange interface |
61 |
C that is calling it here is meant to ensure |
62 |
C that threads are synchronised before exchanges |
63 |
C begine. |
64 |
IF (useCubedSphereExchange) THEN |
65 |
CALL EXCH_RS_CUBE( adphi, |
66 |
I OLw, OLe, OLs, OLn, myNz, |
67 |
I exchWidthX, exchWidthY, |
68 |
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
69 |
ELSE |
70 |
CALL EXCH_RS( adphi, |
71 |
I OLw, OLe, OLs, OLn, myNz, |
72 |
I exchWidthX, exchWidthY, |
73 |
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
74 |
ENDIF |
75 |
|
76 |
RETURN |
77 |
END |
78 |
|
79 |
|
80 |
CStartOfInterface |
81 |
SUBROUTINE adexch_xy_rl( |
82 |
I myThid |
83 |
U , adphi |
84 |
& ) |
85 |
C /==========================================================\ |
86 |
C | SUBROUTINE ADEXCH_XY_RL adjoint of EXCH_XY_RL | |
87 |
C | o Handle exchanges for real*8, two-dimensional arrays. | |
88 |
C |==========================================================| |
89 |
C === Global data === |
90 |
#include "SIZE.h" |
91 |
#include "EEPARAMS.h" |
92 |
#include "EESUPPORT.h" |
93 |
|
94 |
C === Routine arguments === |
95 |
C phi - Array who's overlap regions are to be exchanged |
96 |
C myThid - My thread id. |
97 |
_RL adphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
98 |
INTEGER myThid |
99 |
CEndOfInterface |
100 |
C == Local variables == |
101 |
C OL[wens] - Overlap extents in west, east, north, south. |
102 |
C exchWidth[XY] - Extent of regions that will be exchanged. |
103 |
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY |
104 |
INTEGER mysNx, mysNy, myNz |
105 |
|
106 |
OLw = OLx |
107 |
OLe = OLx |
108 |
OLn = OLy |
109 |
OLs = OLy |
110 |
exchWidthX = OLx |
111 |
exchWidthY = OLy |
112 |
mysNx = sNx |
113 |
mysNy = sNy |
114 |
myNz = 1 |
115 |
C ** NOTE ** The exchange routine we use here does not |
116 |
C require the preceeding and following barriers. |
117 |
C However, the slow, simple exchange interface |
118 |
C that is calling it here is meant to ensure |
119 |
C that threads are synchronised before exchanges |
120 |
C begine. |
121 |
IF (useCubedSphereExchange) THEN |
122 |
CALL EXCH_RL_CUBE( adphi, |
123 |
I OLw, OLe, OLs, OLn, myNz, |
124 |
I exchWidthX, exchWidthY, |
125 |
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
126 |
ELSE |
127 |
CALL EXCH_RL( adphi, |
128 |
I OLw, OLe, OLs, OLn, myNz, |
129 |
I exchWidthX, exchWidthY, |
130 |
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
131 |
ENDIF |
132 |
|
133 |
RETURN |
134 |
END |
135 |
|
136 |
|
137 |
CStartOfInterface |
138 |
SUBROUTINE adexch_xyz_rs( |
139 |
I myThid |
140 |
U , adphi |
141 |
& ) |
142 |
C /==========================================================\ |
143 |
C | SUBROUTINE ADEXCH_XYZ_RS adjoint of EXCH_XYZ_RS | |
144 |
C | o Handle exchanges for real*4, two-dimensional arrays. | |
145 |
C |==========================================================| |
146 |
C === Global data === |
147 |
#include "SIZE.h" |
148 |
#include "EEPARAMS.h" |
149 |
#include "EESUPPORT.h" |
150 |
|
151 |
C === Routine arguments === |
152 |
C phi - Array who's overlap regions are to be exchanged |
153 |
C myThid - My thread id. |
154 |
_RS adphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nr,nSx,nSy) |
155 |
INTEGER myThid |
156 |
CEndOfInterface |
157 |
C == Local variables == |
158 |
C OL[wens] - Overlap extents in west, east, north, south. |
159 |
C exchWidth[XYZ] - Extent of regions that will be exchanged. |
160 |
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY |
161 |
INTEGER mysNx, mysNy, myNz |
162 |
|
163 |
OLw = OLx |
164 |
OLe = OLx |
165 |
OLn = OLy |
166 |
OLs = OLy |
167 |
exchWidthX = OLx |
168 |
exchWidthY = OLy |
169 |
mysNx = sNx |
170 |
mysNy = sNy |
171 |
myNz = Nr |
172 |
C ** NOTE ** The exchange routine we use here does not |
173 |
C require the preceeding and following barriers. |
174 |
C However, the slow, simple exchange interface |
175 |
C that is calling it here is meant to ensure |
176 |
C that threads are synchronised before exchanges |
177 |
C begine. |
178 |
IF (useCubedSphereExchange) THEN |
179 |
CALL EXCH_RS_CUBE( adphi, |
180 |
I OLw, OLe, OLs, OLn, myNz, |
181 |
I exchWidthX, exchWidthY, |
182 |
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
183 |
ELSE |
184 |
CALL EXCH_RS( adphi, |
185 |
I OLw, OLe, OLs, OLn, myNz, |
186 |
I exchWidthX, exchWidthY, |
187 |
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
188 |
ENDIF |
189 |
|
190 |
RETURN |
191 |
END |
192 |
|
193 |
|
194 |
CStartOfInterface |
195 |
SUBROUTINE adexch_xyz_rl( |
196 |
I myThid |
197 |
U , adphi |
198 |
& ) |
199 |
C /==========================================================\ |
200 |
C | SUBROUTINE ADEXCH_XYZ_RL adjoint of EXCH_XYZ_RL | |
201 |
C | o Handle exchanges for real*8, two-dimensional arrays. | |
202 |
C |==========================================================| |
203 |
C === Global data === |
204 |
#include "SIZE.h" |
205 |
#include "EEPARAMS.h" |
206 |
#include "EESUPPORT.h" |
207 |
|
208 |
C === Routine arguments === |
209 |
C phi - Array who's overlap regions are to be exchanged |
210 |
C myThid - My thread id. |
211 |
_RL adphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nr,nSx,nSy) |
212 |
INTEGER myThid |
213 |
CEndOfInterface |
214 |
C == Local variables == |
215 |
C OL[wens] - Overlap extents in west, east, north, south. |
216 |
C exchWidth[XYZ] - Extent of regions that will be exchanged. |
217 |
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY |
218 |
INTEGER mysNx, mysNy, myNz |
219 |
|
220 |
OLw = OLx |
221 |
OLe = OLx |
222 |
OLn = OLy |
223 |
OLs = OLy |
224 |
exchWidthX = OLx |
225 |
exchWidthY = OLy |
226 |
mysNx = sNx |
227 |
mysNy = sNy |
228 |
myNz = Nr |
229 |
C ** NOTE ** The exchange routine we use here does not |
230 |
C require the preceeding and following barriers. |
231 |
C However, the slow, simple exchange interface |
232 |
C that is calling it here is meant to ensure |
233 |
C that threads are synchronised before exchanges |
234 |
C begine. |
235 |
IF (useCubedSphereExchange) THEN |
236 |
CALL EXCH_RL_CUBE( adphi, |
237 |
I OLw, OLe, OLs, OLn, myNz, |
238 |
I exchWidthX, exchWidthY, |
239 |
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
240 |
ELSE |
241 |
CALL EXCH_RL( adphi, |
242 |
I OLw, OLe, OLs, OLn, myNz, |
243 |
I exchWidthX, exchWidthY, |
244 |
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
245 |
ENDIF |
246 |
|
247 |
RETURN |
248 |
END |
249 |
|
250 |
|
251 |
CStartOfInterface |
252 |
SUBROUTINE adexch_xz_rs( |
253 |
I myThid |
254 |
U , adphi |
255 |
& ) |
256 |
C /==========================================================\ |
257 |
C | SUBROUTINE ADEXCH_XZ_RS adjoint of EXCH_XZ_RS | |
258 |
C | o Handle exchanges for real*4, two-dimensional arrays. | |
259 |
C |==========================================================| |
260 |
C === Global data === |
261 |
#include "SIZE.h" |
262 |
#include "EEPARAMS.h" |
263 |
#include "EESUPPORT.h" |
264 |
|
265 |
C === Routine arguments === |
266 |
C phi - Array who's overlap regions are to be exchanged |
267 |
C myThid - My thread id. |
268 |
_RS adphi(1-OLx:sNx+OLx,1,1:Nr,nSx,nSy) |
269 |
INTEGER myThid |
270 |
CEndOfInterface |
271 |
C == Local variables == |
272 |
C OL[wens] - Overlap extents in west, east, north, south. |
273 |
C exchWidth[XYZ] - Extent of regions that will be exchanged. |
274 |
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY |
275 |
INTEGER mysNx, mysNy, myNz |
276 |
|
277 |
OLw = OLx |
278 |
OLe = OLx |
279 |
OLn = 0 |
280 |
OLs = 0 |
281 |
exchWidthX = OLx |
282 |
exchWidthY = 0 |
283 |
mysNx = sNx |
284 |
mysNy = 1 |
285 |
myNz = Nr |
286 |
C ** NOTE ** The exchange routine we use here does not |
287 |
C require the preceeding and following barriers. |
288 |
C However, the slow, simple exchange interface |
289 |
C that is calling it here is meant to ensure |
290 |
C that threads are synchronised before exchanges |
291 |
C begine. |
292 |
CALL EXCH_RS( adphi, |
293 |
I OLw, OLe, OLs, OLn, myNz, |
294 |
I exchWidthX, exchWidthY, |
295 |
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
296 |
|
297 |
RETURN |
298 |
END |
299 |
|
300 |
|
301 |
CStartOfInterface |
302 |
SUBROUTINE adexch_xz_rl( |
303 |
I myThid |
304 |
U , adphi |
305 |
& ) |
306 |
C /==========================================================\ |
307 |
C | SUBROUTINE ADEXCH_XZ_RL adjoint of EXCH_XZ_RL | |
308 |
C | o Handle exchanges for real*8, two-dimensional arrays. | |
309 |
C |==========================================================| |
310 |
C === Global data === |
311 |
#include "SIZE.h" |
312 |
#include "EEPARAMS.h" |
313 |
#include "EESUPPORT.h" |
314 |
|
315 |
C === Routine arguments === |
316 |
C phi - Array who's overlap regions are to be exchanged |
317 |
C myThid - My thread id. |
318 |
_RL adphi(1-OLx:sNx+OLx,1,1:Nr,nSx,nSy) |
319 |
INTEGER myThid |
320 |
CEndOfInterface |
321 |
C == Local variables == |
322 |
C OL[wens] - Overlap extents in west, east, north, south. |
323 |
C exchWidth[XYZ] - Extent of regions that will be exchanged. |
324 |
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY |
325 |
INTEGER mysNx, mysNy, myNz |
326 |
|
327 |
OLw = OLx |
328 |
OLe = OLx |
329 |
OLn = 0 |
330 |
OLs = 0 |
331 |
exchWidthX = OLx |
332 |
exchWidthY = 0 |
333 |
mysNx = sNx |
334 |
mysNy = 1 |
335 |
myNz = Nr |
336 |
C ** NOTE ** The exchange routine we use here does not |
337 |
C require the preceeding and following barriers. |
338 |
C However, the slow, simple exchange interface |
339 |
C that is calling it here is meant to ensure |
340 |
C that threads are synchronised before exchanges |
341 |
C begine. |
342 |
CALL EXCH_RL( adphi, |
343 |
I OLw, OLe, OLs, OLn, myNz, |
344 |
I exchWidthX, exchWidthY, |
345 |
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
346 |
|
347 |
RETURN |
348 |
END |
349 |
|
350 |
|
351 |
CStartOfInterface |
352 |
SUBROUTINE adexch_yz_rs( |
353 |
I myThid |
354 |
U , adphi |
355 |
& ) |
356 |
C /==========================================================\ |
357 |
C | SUBROUTINE ADEXCH_YZ_RS adjoint of EXCH_YZ_RS | |
358 |
C | o Handle exchanges for real*4, two-dimensional arrays. | |
359 |
C |==========================================================| |
360 |
C === Global data === |
361 |
#include "SIZE.h" |
362 |
#include "EEPARAMS.h" |
363 |
#include "EESUPPORT.h" |
364 |
|
365 |
C === Routine arguments === |
366 |
C phi - Array who's overlap regions are to be exchanged |
367 |
C myThid - My thread id. |
368 |
_RS adphi(1,1-OLy:sNy+OLy,1:Nr,nSx,nSy) |
369 |
INTEGER myThid |
370 |
CEndOfInterface |
371 |
C == Local variables == |
372 |
C OL[wens] - Overlap extents in west, east, north, south. |
373 |
C exchWidth[XYZ] - Extent of regions that will be exchanged. |
374 |
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY |
375 |
INTEGER mysNx, mysNy, myNz |
376 |
|
377 |
OLw = 0 |
378 |
OLe = 0 |
379 |
OLn = OLy |
380 |
OLs = OLy |
381 |
exchWidthX = 0 |
382 |
exchWidthY = OLy |
383 |
mysNx = 1 |
384 |
mysNy = sNy |
385 |
myNz = Nr |
386 |
C ** NOTE ** The exchange routine we use here does not |
387 |
C require the preceeding and following barriers. |
388 |
C However, the slow, simple exchange interface |
389 |
C that is calling it here is meant to ensure |
390 |
C that threads are synchronised before exchanges |
391 |
C begine. |
392 |
CALL EXCH_RS( adphi, |
393 |
I OLw, OLe, OLs, OLn, myNz, |
394 |
I exchWidthX, exchWidthY, |
395 |
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
396 |
|
397 |
RETURN |
398 |
END |
399 |
|
400 |
|
401 |
CStartOfInterface |
402 |
SUBROUTINE adexch_yz_rl( |
403 |
I myThid |
404 |
U , adphi |
405 |
& ) |
406 |
C /==========================================================\ |
407 |
C | SUBROUTINE ADEXCH_YZ_RL adjoint of EXCH_YZ_RL | |
408 |
C | o Handle exchanges for real*8, two-dimensional arrays. | |
409 |
C |==========================================================| |
410 |
C === Global data === |
411 |
#include "SIZE.h" |
412 |
#include "EEPARAMS.h" |
413 |
#include "EESUPPORT.h" |
414 |
|
415 |
C === Routine arguments === |
416 |
C phi - Array who's overlap regions are to be exchanged |
417 |
C myThid - My thread id. |
418 |
_RL adphi(1,1-OLy:sNy+OLy,1:Nr,nSx,nSy) |
419 |
INTEGER myThid |
420 |
CEndOfInterface |
421 |
C == Local variables == |
422 |
C OL[wens] - Overlap extents in west, east, north, south. |
423 |
C exchWidth[XYZ] - Extent of regions that will be exchanged. |
424 |
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY |
425 |
INTEGER mysNx, mysNy, myNz |
426 |
|
427 |
OLw = 0 |
428 |
OLe = 0 |
429 |
OLn = OLy |
430 |
OLs = OLy |
431 |
exchWidthX = 0 |
432 |
exchWidthY = OLy |
433 |
mysNx = 1 |
434 |
mysNy = sNy |
435 |
myNz = Nr |
436 |
C ** NOTE ** The exchange routine we use here does not |
437 |
C require the preceeding and following barriers. |
438 |
C However, the slow, simple exchange interface |
439 |
C that is calling it here is meant to ensure |
440 |
C that threads are synchronised before exchanges |
441 |
C begine. |
442 |
CALL EXCH_RL( adphi, |
443 |
I OLw, OLe, OLs, OLn, myNz, |
444 |
I exchWidthX, exchWidthY, |
445 |
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
446 |
|
447 |
RETURN |
448 |
END |