/[MITgcm]/MITgcm_contrib/heimbach/OpenAD/OAD_support/ad_template.exch1_rl.F
ViewVC logotype

Contents of /MITgcm_contrib/heimbach/OpenAD/OAD_support/ad_template.exch1_rl.F

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


Revision 1.2 - (show annotations) (download)
Thu Dec 19 16:04:50 2013 UTC (12 years, 8 months ago) by utke
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
obsolete duplicates

1 #include "CPP_EEOPTIONS.h"
2 subroutine template()
3 use OAD_tape
4 use OAD_rev
5
6 !$TEMPLATE_PRAGMA_DECLARATIONS
7
8 type(modeType) :: our_orig_mode
9
10 c lovcal vars:
11 INTEGER , PARAMETER :: nArgsHelper=9
12 INTEGER argsHelper(nArgsHelper)
13 _RL array_p( 1-myOLw:sNx+myOLe,
14 & 1-myOLs:sNy+myOLn,
15 & myNz, nSx, nSy )
16
17 #ifdef OAD_DEBUG_SPLIT1
18 character*(80):: indentation='
19 + '
20 our_indent=our_indent+1
21
22 write(standardmessageunit, '(A,A,A)', ADVANCE='NO')
23 +'OAD:',indentation(1:our_indent), 'enter __SRNAME__:'
24 call oad_dump_revmod(); call oad_dump_tapestats()
25 write(standardmessageunit,*)
26 #endif
27
28 if (our_rev_mode%plain) then
29 #ifdef OAD_DEBUG_SPLIT1
30 write(standardmessageunit,'(A,A,A)')
31 +'OAD:',indentation(1:our_indent),
32 +' __SRNAME__: entering plain'
33 #endif
34 c copy the values
35 array_p = array%v
36 c keep the mode
37 our_orig_mode=our_rev_mode
38 c set up for plain execution
39 call OAD_revPlain()
40 c do it
41 call EXCH1_RL(
42 U array_p,
43 I myOLw, myOLe, myOLs, myOLn, myNz,
44 I exchWidthX, exchWidthY,
45 I cornerMode, myThid )
46 c reset the mode
47 our_rev_mode=our_orig_mode
48 c copy back
49 array%v = array_p
50 end if
51 if (our_rev_mode%tape) then
52 #ifdef OAD_DEBUG_SPLIT1
53 write(standardmessageunit,'(A,A,A)')
54 +'OAD:',indentation(1:our_indent),
55 +' __SRNAME__: entering tape'
56 #endif
57 c copy the values
58 array_p = array%v
59 c copy the args in case they are overwritte
60 argsHelper=(/myOLw, myOLe, myOLs, myOLn, myNz,exchWidthX,
61 +exchWidthY,cornerMode, myThid/)
62 c keep the mode
63 our_orig_mode=our_rev_mode
64 c set up for plain execution
65 call OAD_revPlain()
66 c do it
67 call EXCH1_RL(
68 U array_p,
69 I myOLw, myOLe, myOLs, myOLn, myNz,
70 I exchWidthX, exchWidthY,
71 I cornerMode, myThid )
72 c reset the mode
73 our_rev_mode=our_orig_mode
74 c copy back
75 array%v = array_p
76 c store the args:
77 if(oad_it_sz.lt. oad_it_ptr+nArgsHelper) call oad_it_grow()
78 oad_it(oad_it_ptr:oad_it_ptr+nArgsHelper-1)=argsHelper
79 oad_it_ptr=oad_it_ptr+nArgsHelper
80 end if
81 if (our_rev_mode%adjoint) then
82 c restore the args:
83 oad_it_ptr=oad_it_ptr-nArgsHelper
84 argsHelper=oad_it(oad_it_ptr:oad_it_ptr+nArgsHelper-1)
85 #ifdef OAD_DEBUG_SPLIT1
86 write(standardmessageunit,'(A,A,A)')
87 +'OAD:',indentation(1:our_indent),
88 +' __SRNAME__: entering adjoint'
89 #endif
90 c copy the adjoints
91 array_p = array%d
92 c keep the mode
93 our_orig_mode=our_rev_mode
94 c set up for plain execution
95 call OAD_revPlain()
96 c call the manual adjoint
97 call EXCH1_RL_AD(
98 U array_p,
99 I argsHelper(1),argsHelper(2),argsHelper(3),
100 I argsHelper(4),argsHelper(5),argsHelper(6),
101 I argsHelper(7),argsHelper(8),argsHelper(9) )
102 c reset the mode
103 our_rev_mode=our_orig_mode
104 c copy back
105 array%d = array_p
106 end if
107
108 #ifdef OAD_DEBUG_SPLIT1
109 write(standardmessageunit,'(A,A,A)', ADVANCE='NO')
110 +'OAD:',indentation(1:our_indent), 'leave __SRNAME__:'
111 call oad_dump_revmod(); call oad_dump_tapestats()
112 write(standardmessageunit,*)
113
114 our_indent=our_indent-1
115 #endif
116
117 end subroutine template

  ViewVC Help
Powered by ViewVC 1.1.22