1 |
subroutine template() |
2 |
use OpenAD_checkpoints |
3 |
use OpenAD_tape |
4 |
use OpenAD_rev |
5 |
|
6 |
c we may need these for the checkpointing |
7 |
use SIZE_mod |
8 |
use EEPARAMS_mod |
9 |
use PARAMS_mod |
10 |
use BAR2_mod |
11 |
use BARRIER_mod |
12 |
use CD_CODE_VARS_mod |
13 |
use CG2D_mod |
14 |
use CG3D_mod |
15 |
use DFILE_mod |
16 |
use DYNVARS_mod |
17 |
use EEIO_mod |
18 |
use EESUPPORT_mod |
19 |
use EOS_mod |
20 |
use EXCH_JAM_mod |
21 |
use EXCH_mod |
22 |
use FC_NAMEMANGLE_mod |
23 |
use FFIELDS_mod |
24 |
use GAD_mod |
25 |
use GLOBAL_MAX_mod |
26 |
use GLOBAL_SUM_mod |
27 |
use GRID_mod |
28 |
use MPI_INFO_mod |
29 |
use SOLVE_FOR_PRESSURE3D_mod |
30 |
use SOLVE_FOR_PRESSURE_mod |
31 |
use SURFACE_mod |
32 |
use tamc_mod |
33 |
use tamc_keys_mod |
34 |
use cost_mod |
35 |
use g_cost_mod |
36 |
use ctrl_mod |
37 |
use ctrl_dummy_mod |
38 |
use ctrl_weights_mod |
39 |
use optim_mod |
40 |
use grdchk_mod |
41 |
|
42 |
!$TEMPLATE_PRAGMA_DECLARATIONS |
43 |
|
44 |
integer :: cp_loop_variable_1,cp_loop_variable_2, |
45 |
+ cp_loop_variable_3,cp_loop_variable_4,cp_loop_variable_5 |
46 |
|
47 |
type(modeType) :: our_orig_mode |
48 |
|
49 |
integer iaddr |
50 |
external iaddr |
51 |
|
52 |
character*(80):: indentation=' |
53 |
+ ' |
54 |
|
55 |
our_indent=our_indent+1 |
56 |
|
57 |
write(*,'(A,A,A,L,L,L,L,L)') |
58 |
+'JU:',indentation(1:our_indent), "enter __SRNAME__:", |
59 |
+our_rev_mode%arg_store, |
60 |
+our_rev_mode%arg_restore, |
61 |
+our_rev_mode%plain, |
62 |
+our_rev_mode%tape, |
63 |
+our_rev_mode%adjoint |
64 |
|
65 |
c write(*,'(A,A,A,I6,A,I6,A,I6,A,I6,A,I8,A,I8)') |
66 |
c +indentation(1:our_indent), "enter __SRNAME__:", |
67 |
c +" CD:",cp_double_pointer, |
68 |
c +" CI:",cp_integer_pointer, |
69 |
c +" CB:",cp_boolean_pointer, |
70 |
c +" CS:",cp_string_pointer, |
71 |
c +" TD:",double_tape_pointer, |
72 |
c +" TI:",integer_tape_pointer |
73 |
|
74 |
if (our_rev_mode%arg_store) then |
75 |
write(*,'(A,A,A)') |
76 |
+'JU:',indentation(1:our_indent), " __SRNAME__: entering arg store" |
77 |
!$PLACEHOLDER_PRAGMA$ id=4 |
78 |
end if |
79 |
if (our_rev_mode%arg_restore) then |
80 |
write(*,'(A,A,A)') |
81 |
+'JU:',indentation(1:our_indent), |
82 |
+" __SRNAME__: entering arg restore" |
83 |
!$PLACEHOLDER_PRAGMA$ id=6 |
84 |
end if |
85 |
if (our_rev_mode%plain) then |
86 |
write(*,'(A,A,A)') |
87 |
+'JU:',indentation(1:our_indent), " __SRNAME__: entering plain" |
88 |
our_orig_mode=our_rev_mode |
89 |
our_rev_mode%arg_store=.FALSE. |
90 |
!$PLACEHOLDER_PRAGMA$ id=1 |
91 |
our_rev_mode=our_orig_mode |
92 |
end if |
93 |
if (our_rev_mode%tape) then |
94 |
write(*,'(A,A,A)') |
95 |
+'JU:',indentation(1:our_indent), " __SRNAME__: entering tape" |
96 |
our_orig_mode=our_rev_mode |
97 |
our_rev_mode%arg_store=.TRUE. |
98 |
our_rev_mode%arg_restore=.FALSE. |
99 |
our_rev_mode%res_store=.FALSE. |
100 |
our_rev_mode%res_restore=.FALSE. |
101 |
our_rev_mode%plain=.TRUE. |
102 |
our_rev_mode%tape=.FALSE. |
103 |
our_rev_mode%adjoint=.FALSE. |
104 |
!$PLACEHOLDER_PRAGMA$ id=2 |
105 |
write(*,'(A,A,A)') |
106 |
+'JU:',indentation(1:our_indent), |
107 |
+" __SRNAME__: following with adjoint" |
108 |
our_rev_mode%arg_store=.FALSE. |
109 |
our_rev_mode%arg_restore=.TRUE. |
110 |
our_rev_mode%res_store=.FALSE. |
111 |
our_rev_mode%res_restore=.FALSE. |
112 |
our_rev_mode%plain=.FALSE. |
113 |
our_rev_mode%tape=.TRUE. |
114 |
our_rev_mode%adjoint=.TRUE. |
115 |
!$PLACEHOLDER_PRAGMA$ id=3 |
116 |
our_rev_mode=our_orig_mode |
117 |
end if |
118 |
|
119 |
c write(*,'(A,A,A,I6,A,I6,A,I6,A,I6,A,I8,A,I8)') |
120 |
c +indentation(1:our_indent), "leave __SRNAME__:", |
121 |
c +" CD:",cp_double_pointer, |
122 |
c +" CI:",cp_integer_pointer, |
123 |
c +" CB:",cp_boolean_pointer, |
124 |
c +" CS:",cp_string_pointer, |
125 |
c +" TD:",double_tape_pointer, |
126 |
c +" TI:",integer_tape_pointer |
127 |
|
128 |
write(*,'(A,A,A,L,L,L,L,L)') |
129 |
+'JU:',indentation(1:our_indent), "leave __SRNAME__:", |
130 |
+our_rev_mode%arg_store, |
131 |
+our_rev_mode%arg_restore, |
132 |
+our_rev_mode%plain, |
133 |
+our_rev_mode%tape, |
134 |
+our_rev_mode%adjoint |
135 |
|
136 |
our_indent=our_indent-1 |
137 |
|
138 |
end subroutine template |