Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:45:09 UTC

view on githubraw file Latest commit 8702af1f on 2012-09-20 23:12:48 UTC
8702af1f36 Patr*0001 module OAD_rev
                0002 
                0003   implicit none
                0004 
                0005   private
                0006   public :: modeType, our_rev_mode, OAD_revInit, &
                0007 OAD_revPlain, OAD_revTape, OAD_revAdjoint, & 
                0008 OAD_revStorePlain, OAD_revRestoreTape, &
                0009 our_indent, splitPrint, oad_dump_revmod
                0010 
                0011   type modeType
                0012      logical :: arg_store=.FALSE.
                0013      logical :: arg_restore=.FALSE.
                0014      logical :: res_store=.FALSE.
                0015      logical :: res_restore=.FALSE.
                0016      logical :: plain=.FALSE.
                0017      logical :: tape=.FALSE.
                0018      logical :: adjoint=.FALSE.
                0019      logical :: switchedToCheckpoint=.FALSE.
                0020      logical :: strictAnonymous=.TRUE.
                0021   end type modeType
                0022 
                0023   type(modeType), save :: our_rev_mode
                0024 
                0025   interface OAD_revInit
                0026      module procedure init
                0027   end interface
                0028   
                0029   interface OAD_revPlain
                0030      module procedure plain
                0031   end interface
                0032   
                0033   interface OAD_revTape
                0034      module procedure tape
                0035   end interface
                0036   
                0037   interface OAD_revAdjoint
                0038      module procedure adjoint
                0039   end interface
                0040   
                0041   interface OAD_revStorePlain
                0042      module procedure storePlain
                0043   end interface
                0044   
                0045   interface OAD_revRestoreTape
                0046      module procedure restoreTape
                0047   end interface
                0048 
                0049   integer, save:: our_indent=0
                0050   logical, save:: splitPrint=.false.
                0051 
                0052   interface oad_dump_revmod
                0053      module procedure dump_revmod
                0054   end interface
                0055 
                0056 contains
                0057 
                0058   subroutine init()
                0059     our_rev_mode%arg_store=.FALSE.
                0060     our_rev_mode%arg_restore=.FALSE.
                0061     our_rev_mode%res_store=.FALSE.
                0062     our_rev_mode%res_restore=.FALSE.
                0063     our_rev_mode%plain=.TRUE.
                0064     our_rev_mode%tape=.FALSE.
                0065     our_rev_mode%adjoint=.FALSE.
                0066   end subroutine 
                0067 
                0068   subroutine plain()
                0069     our_rev_mode%arg_store=.FALSE.
                0070     our_rev_mode%arg_restore=.FALSE.
                0071     our_rev_mode%res_store=.FALSE.
                0072     our_rev_mode%res_restore=.FALSE.
                0073     our_rev_mode%plain=.TRUE.
                0074     our_rev_mode%tape=.FALSE.
                0075     our_rev_mode%adjoint=.FALSE.
                0076   end subroutine 
                0077 
                0078   subroutine tape()
                0079     our_rev_mode%arg_store=.FALSE.
                0080     our_rev_mode%arg_restore=.FALSE.
                0081     our_rev_mode%res_store=.FALSE.
                0082     our_rev_mode%res_restore=.FALSE.
                0083     our_rev_mode%plain=.FALSE.
                0084     our_rev_mode%tape=.TRUE.
                0085     our_rev_mode%adjoint=.FALSE.
                0086   end subroutine 
                0087 
                0088   subroutine adjoint()
                0089     our_rev_mode%arg_store=.FALSE.
                0090     our_rev_mode%arg_restore=.FALSE.
                0091     our_rev_mode%res_store=.FALSE.
                0092     our_rev_mode%res_restore=.FALSE.
                0093     our_rev_mode%plain=.FALSE.
                0094     our_rev_mode%tape=.FALSE.
                0095     our_rev_mode%adjoint=.TRUE.
                0096   end subroutine 
                0097 
                0098   subroutine storePlain()
                0099     our_rev_mode%arg_store=.TRUE.
                0100     our_rev_mode%arg_restore=.FALSE.
                0101     our_rev_mode%res_store=.FALSE.
                0102     our_rev_mode%res_restore=.FALSE.
                0103     our_rev_mode%plain=.TRUE.
                0104     our_rev_mode%tape=.FALSE.
                0105     our_rev_mode%adjoint=.FALSE.
                0106   end subroutine 
                0107 
                0108   subroutine restoreTape()
                0109     our_rev_mode%arg_store=.FALSE.
                0110     our_rev_mode%arg_restore=.TRUE.
                0111     our_rev_mode%res_store=.FALSE.
                0112     our_rev_mode%res_restore=.FALSE.
                0113     our_rev_mode%plain=.FALSE.
                0114     our_rev_mode%tape=.TRUE.
                0115     our_rev_mode%adjoint=.FALSE.
                0116   end subroutine 
                0117 
                0118   subroutine dump_revmod()
                0119     write(*,'(A,L,A,L,A,L,A,L,A,L,A,L)', ADVANCE='NO') & 
                0120          ' As:',our_rev_mode%arg_store, &
                0121          ' Ar:',our_rev_mode%arg_restore, &
                0122          ' Pl:',our_rev_mode%plain, &
                0123          ' Ta:',our_rev_mode%tape, &
                0124          ' Ad:',our_rev_mode%adjoint, &
                0125          ' Sw:',our_rev_mode%switchedToCheckpoint
                0126   end subroutine dump_revmod
                0127 
                0128 end module OAD_rev