/[MITgcm]/MITgcm/tools/OAD_support/ad_template.active_read_xy.F
ViewVC logotype

Contents of /MITgcm/tools/OAD_support/ad_template.active_read_xy.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Sat Dec 27 20:37:57 2014 UTC (9 years, 4 months ago) by heimbach
Branch: MAIN
Changes since 1.1: +9 -0 lines
Temporarily remove development code for OpenAD active file

1 ! $Header: $
2 ! $Name: $
3
4 #include "OPENAD_OPTIONS.h"
5
6 subroutine template()
7 C !FUNCTIONS
8 use OAD_tape
9 use OAD_rev
10 use OAD_cp
11
12
13 ! original arguments get inserted before version
14 ! ! and declared here together with all local variables
15 ! ! generated by xaifBooster
16
17 !use mode_variables
18
19 !$TEMPLATE_PRAGMA_DECLARATIONS
20 type(modeType) :: our_orig_mode
21
22 integer iaddr
23 external iaddr
24
25 !LOCAL VARIABLES:
26 CHARACTER*(2) adpref
27 CHARACTER*(80) fname
28 INTEGER il
29 INTEGER myNr
30 LOGICAL useCurrentDir
31 Real*8 active_var_p(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
32 INTEGER ILNBLNK
33 EXTERNAL ILNBLNK
34
35 #ifdef ALLOW_OPENAD_ACTIVE_FILE
36
37 myNr = 1
38 useCurrentDir = .FALSE.
39
40 if (our_rev_mode%plain) then
41 our_orig_mode = our_rev_mode
42 ! original function
43 active_var_p = active_var%v
44 ! set up for plain execution
45 our_orig_mode=our_rev_mode
46 our_rev_mode%arg_store=.FALSE.
47 our_rev_mode%arg_restore=.FALSE.
48 our_rev_mode%plain=.TRUE.
49 our_rev_mode%tape=.FALSE.
50 our_rev_mode%adjoint=.FALSE.
51 call ACTIVE_READ_3D_RL(
52 & active_var_file, active_var_p, doglobalread,
53 & useCurrentDir, lAdInit, iRec, myNr,
54 & FORWARD_SIMULATION, myOptimIter, myThid )
55 ! reset the mode
56 our_rev_mode=our_orig_mode
57 ! copy back
58 active_var%v = active_var_p
59 end if
60
61 if (our_rev_mode%tape) then
62 ! taping
63 our_orig_mode=our_rev_mode
64 our_rev_mode%arg_store=.FALSE.
65 our_rev_mode%arg_restore=.FALSE.
66 our_rev_mode%plain=.TRUE.
67 our_rev_mode%tape=.FALSE.
68 our_rev_mode%adjoint=.FALSE.
69 call ACTIVE_READ_3D_RL(
70 & active_var_file, active_var, doglobalread,
71 & useCurrentDir, lAdInit, iRec, myNr,
72 & FORWARD_SIMULATION, myOptimIter, myThid )
73 end if
74
75 if (our_rev_mode%adjoint) then
76 ! adjoint
77 adpref = 'ad'
78 il = ILNBLNK( active_var_file )
79 WRITE(fname(1:80),'(A)') ' '
80 ! WRITE(fname(1:2+il),'(2A)') adpref, active_var_file(1:il)
81 WRITE(fname(1:2+il),'(2A)') adpref, active_var_file
82 active_var_p = active_var%d
83 ! set up for plain execution
84 our_orig_mode=our_rev_mode
85 our_rev_mode%arg_store=.FALSE.
86 our_rev_mode%arg_restore=.FALSE.
87 our_rev_mode%plain=.TRUE.
88 our_rev_mode%tape=.FALSE.
89 our_rev_mode%adjoint=.FALSE.
90 call ACTIVE_READ_3D_RL(
91 & fname, active_var_p, doglobalread,
92 & useCurrentDir, lAdInit, iRec, myNr,
93 & REVERSE_SIMULATION, myOptimIter, myThid )
94 ! reset the mode
95 our_rev_mode=our_orig_mode
96 ! copy back
97 active_var%d = active_var_p
98 end if
99
100 #endif /* ALLOW_OPENAD_ACTIVE_FILE */
101
102 end

  ViewVC Help
Powered by ViewVC 1.1.22