/[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.1 - (show annotations) (download)
Sat Dec 27 05:39:56 2014 UTC (9 years, 4 months ago) by heimbach
Branch: MAIN
Merge Krishna's fixes to ad_template.active_read_xy.F
from MITgcm_contrib

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

  ViewVC Help
Powered by ViewVC 1.1.22