1 |
#include "CPP_EEOPTIONS.h" |
2 |
subroutine template() |
3 |
use OAD_rev |
4 |
|
5 |
!$TEMPLATE_PRAGMA_DECLARATIONS |
6 |
|
7 |
type(modeType) :: our_orig_mode |
8 |
|
9 |
c lovcal vars: |
10 |
|
11 |
_RL phiTilep(nSx,nSy) |
12 |
_RL sumPhip |
13 |
|
14 |
#ifdef OAD_DEBUG_SPLIT2 |
15 |
|
16 |
character*(80):: indentation=' |
17 |
+ ' |
18 |
our_indent=our_indent+1 |
19 |
|
20 |
write(standardmessageunit, '(A,A,A)', ADVANCE='NO') |
21 |
+'OAD:',indentation(1:our_indent), 'enter __SRNAME__:' |
22 |
call oad_dump_revmod(); call oad_dump_tapestats() |
23 |
write(standardmessageunit,*) |
24 |
#endif |
25 |
|
26 |
if (our_rev_mode%plain .OR. our_rev_mode%tape) then |
27 |
#ifdef OAD_DEBUG_SPLIT2 |
28 |
write(standardmessageunit,'(A,A,A)') |
29 |
+'OAD:',indentation(1:our_indent), |
30 |
+' __SRNAME__: entering plain or tape' |
31 |
#endif |
32 |
phiTilep = phiTile%v |
33 |
c set up for plain execution |
34 |
our_orig_mode=our_rev_mode |
35 |
our_rev_mode%arg_store=.FALSE. |
36 |
our_rev_mode%arg_restore=.FALSE. |
37 |
our_rev_mode%plain=.TRUE. |
38 |
our_rev_mode%tape=.FALSE. |
39 |
our_rev_mode%adjoint=.FALSE. |
40 |
call global_sum_tile_rl( phiTilep, sumPhip,myThid ) |
41 |
c reset the mode |
42 |
our_rev_mode=our_orig_mode |
43 |
c copy back |
44 |
sumPhi%v = sumPhip |
45 |
end if |
46 |
if (our_rev_mode%adjoint) then |
47 |
#ifdef OAD_DEBUG_SPLIT2 |
48 |
write(standardmessageunit,'(A,A,A)') |
49 |
+'OAD:',indentation(1:our_indent), |
50 |
+' __SRNAME__: entering adjoint' |
51 |
#endif |
52 |
phiTilep = phiTile%d |
53 |
sumPhip = sumPhi%d |
54 |
c set up for plain execution |
55 |
our_orig_mode=our_rev_mode |
56 |
our_rev_mode%arg_store=.FALSE. |
57 |
our_rev_mode%arg_restore=.FALSE. |
58 |
our_rev_mode%plain=.TRUE. |
59 |
our_rev_mode%tape=.FALSE. |
60 |
our_rev_mode%adjoint=.FALSE. |
61 |
call global_adsum_tile_rl(phiTilep, sumPhip, myThid) |
62 |
c reset the mode |
63 |
our_rev_mode=our_orig_mode |
64 |
c copy back |
65 |
phiTile%d = phiTilep |
66 |
sumPhi%d = sumPhip |
67 |
end if |
68 |
|
69 |
#ifdef OAD_DEBUG_SPLIT2 |
70 |
write(standardmessageunit,'(A,A,A)', ADVANCE='NO') |
71 |
+'OAD:',indentation(1:our_indent), 'leave __SRNAME__:' |
72 |
call oad_dump_revmod(); call oad_dump_tapestats() |
73 |
write(standardmessageunit,*) |
74 |
|
75 |
our_indent=our_indent-1 |
76 |
#endif |
77 |
|
78 |
end subroutine template |