File indexing completed on 2018-03-02 18:45:03 UTC
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
410902f805 Patr*0001 #include "OPENAD_OPTIONS.h"
0002
7a4f8cc4d9 Patr*0003 subroutine template()
0004
0005 use OAD_tape
0006 use OAD_rev
0007 use OAD_cp
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 type(modeType) :: our_orig_mode
0018
0019 integer iaddr
0020 external iaddr
0021
0022
0023 CHARACTER*(2) adpref
0024 CHARACTER*(80) fname
0025 INTEGER il
0026 INTEGER myNr
0027 LOGICAL useCurrentDir
0028 Real*8 active_var_p(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
0029 INTEGER ILNBLNK
0030 EXTERNAL ILNBLNK
0031
6f5d7c9095 Patr*0032 #ifdef ALLOW_OPENAD_ACTIVE_READ_XY
410902f805 Patr*0033
7a4f8cc4d9 Patr*0034 myNr = 1
0035 useCurrentDir = .FALSE.
0036
0037 if (our_rev_mode%plain) then
0038 our_orig_mode = our_rev_mode
0039
0040 active_var_p = active_var%v
0041
0042 our_rev_mode%arg_store=.FALSE.
0043 our_rev_mode%arg_restore=.FALSE.
0044 our_rev_mode%plain=.TRUE.
0045 our_rev_mode%tape=.FALSE.
0046 our_rev_mode%adjoint=.FALSE.
0047 call ACTIVE_READ_3D_RL(
0048 & active_var_file, active_var_p, doglobalread,
0049 & useCurrentDir, lAdInit, iRec, myNr,
0050 & FORWARD_SIMULATION, myOptimIter, myThid )
0051
0052 our_rev_mode=our_orig_mode
0053
0054 active_var%v = active_var_p
0055 end if
0056
0057 if (our_rev_mode%tape) then
0058
0059 our_orig_mode=our_rev_mode
e3c770b7ff Dani*0060
0061 active_var_p = active_var%v
7a4f8cc4d9 Patr*0062 our_rev_mode%arg_store=.FALSE.
0063 our_rev_mode%arg_restore=.FALSE.
0064 our_rev_mode%plain=.TRUE.
0065 our_rev_mode%tape=.FALSE.
0066 our_rev_mode%adjoint=.FALSE.
92173bc994 Patr*0067 if (oad_st_sz.lt.oad_st_ptr) call oad_st_grow()
0068 oad_st(oad_st_ptr) = active_var_file
0069 oad_st_ptr = oad_st_ptr+1
0070 if (oad_it_sz.lt.oad_it_ptr) call oad_it_grow()
0071 oad_it(oad_it_ptr) = iRec
0072 oad_it_ptr = oad_it_ptr+1
7a4f8cc4d9 Patr*0073 call ACTIVE_READ_3D_RL(
e3c770b7ff Dani*0074 & active_var_file, active_var_p, doglobalread,
7a4f8cc4d9 Patr*0075 & useCurrentDir, lAdInit, iRec, myNr,
0076 & FORWARD_SIMULATION, myOptimIter, myThid )
92173bc994 Patr*0077 our_rev_mode=our_orig_mode
e3c770b7ff Dani*0078
0079 active_var%v = active_var_p
7a4f8cc4d9 Patr*0080 end if
0081
0082 if (our_rev_mode%adjoint) then
0083
92173bc994 Patr*0084 oad_st_ptr = oad_st_ptr-1
0085 active_var_file = oad_st(oad_st_ptr)
0086 oad_it_ptr = oad_it_ptr-1
0087 iRec = oad_it(oad_it_ptr)
7a4f8cc4d9 Patr*0088 adpref = 'ad'
0089 il = ILNBLNK( active_var_file )
0090 WRITE(fname(1:80),'(A)') ' '
92173bc994 Patr*0091 WRITE(fname(1:2+il),'(2A)') adpref, active_var_file(1:il)
0092
7a4f8cc4d9 Patr*0093 active_var_p = active_var%d
0094
0095 our_orig_mode=our_rev_mode
0096 our_rev_mode%arg_store=.FALSE.
0097 our_rev_mode%arg_restore=.FALSE.
0098 our_rev_mode%plain=.TRUE.
0099 our_rev_mode%tape=.FALSE.
0100 our_rev_mode%adjoint=.FALSE.
0101 call ACTIVE_READ_3D_RL(
0102 & fname, active_var_p, doglobalread,
0103 & useCurrentDir, lAdInit, iRec, myNr,
0104 & REVERSE_SIMULATION, myOptimIter, myThid )
0105
0106 our_rev_mode=our_orig_mode
0107
0108 active_var%d = active_var_p
0109 end if
0110
6f5d7c9095 Patr*0111 #endif /* ALLOW_OPENAD_ACTIVE_READ_XY */
410902f805 Patr*0112
7a4f8cc4d9 Patr*0113 end