| 1 |
utke |
1.1 |
module OAD_rev |
| 2 |
|
|
|
| 3 |
utke |
1.2 |
implicit none |
| 4 |
utke |
1.1 |
|
| 5 |
utke |
1.2 |
private |
| 6 |
|
|
public :: modeType, our_rev_mode, OAD_revInit, & |
| 7 |
|
|
OAD_revPlain, OAD_revTape, OAD_revAdjoint, & |
| 8 |
|
|
OAD_revStorePlain, OAD_revRestoreTape, & |
| 9 |
|
|
our_indent, splitPrint, oad_dump_revmod |
| 10 |
|
|
|
| 11 |
|
|
type modeType |
| 12 |
|
|
logical :: arg_store=.FALSE. |
| 13 |
|
|
logical :: arg_restore=.FALSE. |
| 14 |
|
|
logical :: res_store=.FALSE. |
| 15 |
|
|
logical :: res_restore=.FALSE. |
| 16 |
|
|
logical :: plain=.FALSE. |
| 17 |
|
|
logical :: tape=.FALSE. |
| 18 |
|
|
logical :: adjoint=.FALSE. |
| 19 |
|
|
logical :: switchedToCheckpoint=.FALSE. |
| 20 |
|
|
logical :: strictAnonymous=.TRUE. |
| 21 |
|
|
end type modeType |
| 22 |
|
|
|
| 23 |
|
|
type(modeType), save :: our_rev_mode |
| 24 |
|
|
|
| 25 |
|
|
interface OAD_revInit |
| 26 |
|
|
module procedure init |
| 27 |
|
|
end interface |
| 28 |
|
|
|
| 29 |
|
|
interface OAD_revPlain |
| 30 |
|
|
module procedure plain |
| 31 |
|
|
end interface |
| 32 |
|
|
|
| 33 |
|
|
interface OAD_revTape |
| 34 |
|
|
module procedure tape |
| 35 |
|
|
end interface |
| 36 |
|
|
|
| 37 |
|
|
interface OAD_revAdjoint |
| 38 |
|
|
module procedure adjoint |
| 39 |
|
|
end interface |
| 40 |
|
|
|
| 41 |
|
|
interface OAD_revStorePlain |
| 42 |
|
|
module procedure storePlain |
| 43 |
|
|
end interface |
| 44 |
|
|
|
| 45 |
|
|
interface OAD_revRestoreTape |
| 46 |
|
|
module procedure restoreTape |
| 47 |
|
|
end interface |
| 48 |
|
|
|
| 49 |
|
|
integer, save:: our_indent=0 |
| 50 |
|
|
logical, save:: splitPrint=.false. |
| 51 |
|
|
|
| 52 |
|
|
interface oad_dump_revmod |
| 53 |
|
|
module procedure dump_revmod |
| 54 |
|
|
end interface |
| 55 |
utke |
1.1 |
|
| 56 |
|
|
contains |
| 57 |
|
|
|
| 58 |
utke |
1.2 |
subroutine init() |
| 59 |
|
|
our_rev_mode%arg_store=.FALSE. |
| 60 |
|
|
our_rev_mode%arg_restore=.FALSE. |
| 61 |
|
|
our_rev_mode%res_store=.FALSE. |
| 62 |
|
|
our_rev_mode%res_restore=.FALSE. |
| 63 |
|
|
our_rev_mode%plain=.TRUE. |
| 64 |
|
|
our_rev_mode%tape=.FALSE. |
| 65 |
|
|
our_rev_mode%adjoint=.FALSE. |
| 66 |
|
|
end subroutine |
| 67 |
|
|
|
| 68 |
|
|
subroutine plain() |
| 69 |
|
|
our_rev_mode%arg_store=.FALSE. |
| 70 |
|
|
our_rev_mode%arg_restore=.FALSE. |
| 71 |
|
|
our_rev_mode%res_store=.FALSE. |
| 72 |
|
|
our_rev_mode%res_restore=.FALSE. |
| 73 |
|
|
our_rev_mode%plain=.TRUE. |
| 74 |
|
|
our_rev_mode%tape=.FALSE. |
| 75 |
|
|
our_rev_mode%adjoint=.FALSE. |
| 76 |
|
|
end subroutine |
| 77 |
|
|
|
| 78 |
|
|
subroutine tape() |
| 79 |
|
|
our_rev_mode%arg_store=.FALSE. |
| 80 |
|
|
our_rev_mode%arg_restore=.FALSE. |
| 81 |
|
|
our_rev_mode%res_store=.FALSE. |
| 82 |
|
|
our_rev_mode%res_restore=.FALSE. |
| 83 |
|
|
our_rev_mode%plain=.FALSE. |
| 84 |
|
|
our_rev_mode%tape=.TRUE. |
| 85 |
|
|
our_rev_mode%adjoint=.FALSE. |
| 86 |
|
|
end subroutine |
| 87 |
|
|
|
| 88 |
|
|
subroutine adjoint() |
| 89 |
|
|
our_rev_mode%arg_store=.FALSE. |
| 90 |
|
|
our_rev_mode%arg_restore=.FALSE. |
| 91 |
|
|
our_rev_mode%res_store=.FALSE. |
| 92 |
|
|
our_rev_mode%res_restore=.FALSE. |
| 93 |
|
|
our_rev_mode%plain=.FALSE. |
| 94 |
|
|
our_rev_mode%tape=.FALSE. |
| 95 |
|
|
our_rev_mode%adjoint=.TRUE. |
| 96 |
|
|
end subroutine |
| 97 |
|
|
|
| 98 |
|
|
subroutine storePlain() |
| 99 |
|
|
our_rev_mode%arg_store=.TRUE. |
| 100 |
|
|
our_rev_mode%arg_restore=.FALSE. |
| 101 |
|
|
our_rev_mode%res_store=.FALSE. |
| 102 |
|
|
our_rev_mode%res_restore=.FALSE. |
| 103 |
|
|
our_rev_mode%plain=.TRUE. |
| 104 |
|
|
our_rev_mode%tape=.FALSE. |
| 105 |
|
|
our_rev_mode%adjoint=.FALSE. |
| 106 |
|
|
end subroutine |
| 107 |
|
|
|
| 108 |
|
|
subroutine restoreTape() |
| 109 |
|
|
our_rev_mode%arg_store=.FALSE. |
| 110 |
|
|
our_rev_mode%arg_restore=.TRUE. |
| 111 |
|
|
our_rev_mode%res_store=.FALSE. |
| 112 |
|
|
our_rev_mode%res_restore=.FALSE. |
| 113 |
|
|
our_rev_mode%plain=.FALSE. |
| 114 |
|
|
our_rev_mode%tape=.TRUE. |
| 115 |
|
|
our_rev_mode%adjoint=.FALSE. |
| 116 |
|
|
end subroutine |
| 117 |
|
|
|
| 118 |
|
|
subroutine dump_revmod() |
| 119 |
|
|
write(*,'(A,L,A,L,A,L,A,L,A,L,A,L)', ADVANCE='NO') & |
| 120 |
|
|
' As:',our_rev_mode%arg_store, & |
| 121 |
|
|
' Ar:',our_rev_mode%arg_restore, & |
| 122 |
|
|
' Pl:',our_rev_mode%plain, & |
| 123 |
|
|
' Ta:',our_rev_mode%tape, & |
| 124 |
|
|
' Ad:',our_rev_mode%adjoint, & |
| 125 |
|
|
' Sw:',our_rev_mode%switchedToCheckpoint |
| 126 |
|
|
end subroutine dump_revmod |
| 127 |
utke |
1.1 |
|
| 128 |
utke |
1.2 |
end module OAD_rev |