1 |
C /==========================================================\ |
2 |
C | SUBROUTINEs adexch_uv_xy_rs adexch_uv_xyz_rs | |
3 |
C | adexch_uv_xy_rl adexch_uv_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_uv_xy_rs( |
22 |
I withSigns, myThid, |
23 |
U aduphi, advphi |
24 |
& ) |
25 |
C /==========================================================\ |
26 |
C | SUBROUTINE ADEXCH_UV_XY_RS adjoint of EXCH_UV_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 aduphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
39 |
_RS advphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
40 |
LOGICAL withSigns |
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_UV_RS_CUBE( aduphi, advphi, withSigns, |
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( aduphi, |
71 |
I OLw, OLe, OLs, OLn, myNz, |
72 |
I exchWidthX, exchWidthY, |
73 |
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
74 |
CALL EXCH_RS( advphi, |
75 |
I OLw, OLe, OLs, OLn, myNz, |
76 |
I exchWidthX, exchWidthY, |
77 |
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
78 |
c_jmc: for JAM compatibility, replace the 2 CALLs above by the 2 CPP_MACROs: |
79 |
c _EXCH_XY_RS( aduphi, myThid ) |
80 |
c _EXCH_XY_RS( advphi, myThid ) |
81 |
ENDIF |
82 |
|
83 |
RETURN |
84 |
END |
85 |
|
86 |
|
87 |
CStartOfInterface |
88 |
SUBROUTINE adexch_uv_xy_rl( |
89 |
I withSigns, myThid, |
90 |
U aduphi, advphi |
91 |
& ) |
92 |
C /==========================================================\ |
93 |
C | SUBROUTINE ADEXCH_UV_XY_RL adjoint of EXCH_UV_XY_RL | |
94 |
C | o Handle exchanges for real*8, two-dimensional arrays. | |
95 |
C |==========================================================| |
96 |
C === Global data === |
97 |
#include "SIZE.h" |
98 |
#include "EEPARAMS.h" |
99 |
#include "EESUPPORT.h" |
100 |
|
101 |
C === Routine arguments === |
102 |
C phi - Array who's overlap regions are to be exchanged |
103 |
C myThid - My thread id. |
104 |
_RL aduphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
105 |
_RL advphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
106 |
LOGICAL withSigns |
107 |
INTEGER myThid |
108 |
CEndOfInterface |
109 |
C == Local variables == |
110 |
C OL[wens] - Overlap extents in west, east, north, south. |
111 |
C exchWidth[XY] - Extent of regions that will be exchanged. |
112 |
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY |
113 |
INTEGER mysNx, mysNy, myNz |
114 |
|
115 |
OLw = OLx |
116 |
OLe = OLx |
117 |
OLn = OLy |
118 |
OLs = OLy |
119 |
exchWidthX = OLx |
120 |
exchWidthY = OLy |
121 |
mysNx = sNx |
122 |
mysNy = sNy |
123 |
myNz = 1 |
124 |
C ** NOTE ** The exchange routine we use here does not |
125 |
C require the preceeding and following barriers. |
126 |
C However, the slow, simple exchange interface |
127 |
C that is calling it here is meant to ensure |
128 |
C that threads are synchronised before exchanges |
129 |
C begine. |
130 |
IF (useCubedSphereExchange) THEN |
131 |
CALL EXCH_UV_RL_CUBE( aduphi, advphi, withSigns, |
132 |
I OLw, OLe, OLs, OLn, myNz, |
133 |
I exchWidthX, exchWidthY, |
134 |
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
135 |
ELSE |
136 |
CALL EXCH_RL( aduphi, |
137 |
I OLw, OLe, OLs, OLn, myNz, |
138 |
I exchWidthX, exchWidthY, |
139 |
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
140 |
CALL EXCH_RL( advphi, |
141 |
I OLw, OLe, OLs, OLn, myNz, |
142 |
I exchWidthX, exchWidthY, |
143 |
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
144 |
c_jmc: for JAM compatibility, replace the 2 CALLs above by the 2 CPP_MACROs: |
145 |
c _EXCH_XY_RL( aduphi, myThid ) |
146 |
c _EXCH_XY_RL( advphi, myThid ) |
147 |
ENDIF |
148 |
|
149 |
RETURN |
150 |
END |
151 |
|
152 |
|
153 |
CStartOfInterface |
154 |
SUBROUTINE adexch_uv_xyz_rs( |
155 |
I withSigns, myThid, |
156 |
U aduphi, advphi |
157 |
& ) |
158 |
C /==========================================================\ |
159 |
C | SUBROUTINE ADEXCH_UV_XYZ_RS adjoint of EXCH_UV_XYZ_RS | |
160 |
C | o Handle exchanges for real*4, two-dimensional arrays. | |
161 |
C |==========================================================| |
162 |
C === Global data === |
163 |
#include "SIZE.h" |
164 |
#include "EEPARAMS.h" |
165 |
#include "EESUPPORT.h" |
166 |
|
167 |
C === Routine arguments === |
168 |
C phi - Array who's overlap regions are to be exchanged |
169 |
C myThid - My thread id. |
170 |
_RS aduphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
171 |
_RS advphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
172 |
LOGICAL withSigns |
173 |
INTEGER myThid |
174 |
CEndOfInterface |
175 |
C == Local variables == |
176 |
C OL[wens] - Overlap extents in west, east, north, south. |
177 |
C exchWidth[XYZ] - Extent of regions that will be exchanged. |
178 |
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY |
179 |
INTEGER mysNx, mysNy, myNz |
180 |
|
181 |
OLw = OLx |
182 |
OLe = OLx |
183 |
OLn = OLy |
184 |
OLs = OLy |
185 |
exchWidthX = OLx |
186 |
exchWidthY = OLy |
187 |
mysNx = sNx |
188 |
mysNy = sNy |
189 |
myNz = Nr |
190 |
C ** NOTE ** The exchange routine we use here does not |
191 |
C require the preceeding and following barriers. |
192 |
C However, the slow, simple exchange interface |
193 |
C that is calling it here is meant to ensure |
194 |
C that threads are synchronised before exchanges |
195 |
C begine. |
196 |
IF (useCubedSphereExchange) THEN |
197 |
CALL EXCH_UV_RS_CUBE( aduphi, advphi, withSigns, |
198 |
I OLw, OLe, OLs, OLn, myNz, |
199 |
I exchWidthX, exchWidthY, |
200 |
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
201 |
ELSE |
202 |
CALL EXCH_RS( aduphi, |
203 |
I OLw, OLe, OLs, OLn, myNz, |
204 |
I exchWidthX, exchWidthY, |
205 |
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
206 |
CALL EXCH_RS( advphi, |
207 |
I OLw, OLe, OLs, OLn, myNz, |
208 |
I exchWidthX, exchWidthY, |
209 |
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
210 |
c_jmc: for JAM compatibility, replace the 2 CALLs above by the 2 CPP_MACROs: |
211 |
c _EXCH_XY_RS( aduphi, myThid ) |
212 |
c _EXCH_XY_RS( advphi, myThid ) |
213 |
ENDIF |
214 |
|
215 |
RETURN |
216 |
END |
217 |
|
218 |
|
219 |
CStartOfInterface |
220 |
SUBROUTINE adexch_uv_xyz_rl( |
221 |
I withSigns, myThid, |
222 |
U aduphi, advphi |
223 |
& ) |
224 |
C /==========================================================\ |
225 |
C | SUBROUTINE ADEXCH_UV_XYZ_RL adjoint of EXCH_UV_XYZ_RL | |
226 |
C | o Handle exchanges for real*8, two-dimensional arrays. | |
227 |
C |==========================================================| |
228 |
C === Global data === |
229 |
#include "SIZE.h" |
230 |
#include "EEPARAMS.h" |
231 |
#include "EESUPPORT.h" |
232 |
|
233 |
C === Routine arguments === |
234 |
C phi - Array who's overlap regions are to be exchanged |
235 |
C myThid - My thread id. |
236 |
_RL aduphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
237 |
_RL advphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
238 |
LOGICAL withSigns |
239 |
INTEGER myThid |
240 |
CEndOfInterface |
241 |
C == Local variables == |
242 |
C OL[wens] - Overlap extents in west, east, north, south. |
243 |
C exchWidth[XYZ] - Extent of regions that will be exchanged. |
244 |
INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY |
245 |
INTEGER mysNx, mysNy, myNz |
246 |
|
247 |
OLw = OLx |
248 |
OLe = OLx |
249 |
OLn = OLy |
250 |
OLs = OLy |
251 |
exchWidthX = OLx |
252 |
exchWidthY = OLy |
253 |
mysNx = sNx |
254 |
mysNy = sNy |
255 |
myNz = Nr |
256 |
C ** NOTE ** The exchange routine we use here does not |
257 |
C require the preceeding and following barriers. |
258 |
C However, the slow, simple exchange interface |
259 |
C that is calling it here is meant to ensure |
260 |
C that threads are synchronised before exchanges |
261 |
C begine. |
262 |
IF (useCubedSphereExchange) THEN |
263 |
CALL EXCH_UV_RL_CUBE( aduphi, advphi, withSigns, |
264 |
I OLw, OLe, OLs, OLn, myNz, |
265 |
I exchWidthX, exchWidthY, |
266 |
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
267 |
ELSE |
268 |
CALL EXCH_RL( aduphi, |
269 |
I OLw, OLe, OLs, OLn, myNz, |
270 |
I exchWidthX, exchWidthY, |
271 |
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
272 |
CALL EXCH_RL( advphi, |
273 |
I OLw, OLe, OLs, OLn, myNz, |
274 |
I exchWidthX, exchWidthY, |
275 |
I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid ) |
276 |
c_jmc: for JAM compatibility, replace the 2 CALLs above by the 2 CPP_MACROs: |
277 |
c _EXCH_XY_RL( aduphi, myThid ) |
278 |
c _EXCH_XY_RL( advphi, myThid ) |
279 |
ENDIF |
280 |
|
281 |
RETURN |
282 |
END |
283 |
|