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