Back to home page

MITgcm

 
 

    


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

view on githubraw file Latest commit 8702af1f on 2012-09-20 23:12:48 UTC
8702af1f36 Patr*0001       subroutine template()
                0002       use OAD_rev
                0003 
                0004 !$TEMPLATE_PRAGMA_DECLARATIONS
                0005 
                0006       type(modeType) :: our_orig_mode
                0007 
                0008 c lovcal vars:
                0009 
                0010       real*8 sumPhip
                0011 
                0012 #ifdef OAD_DEBUG_SPLIT2
                0013 
                0014       character*(80):: indentation='                                        
                0015      +                                         '
                0016       our_indent=our_indent+1
                0017 
                0018       write(standardmessageunit, '(A,A,A)', ADVANCE='NO') 
                0019      +'OAD:',indentation(1:our_indent), 'enter __SRNAME__:'
                0020       call oad_dump_revmod(); call oad_dump_tapestats()
                0021       write(standardmessageunit,*) 
                0022 #endif
                0023 
                0024       if (our_rev_mode%plain .OR. our_rev_mode%tape) then
                0025 #ifdef OAD_DEBUG_SPLIT2
                0026          write(standardmessageunit,'(A,A,A)') 
                0027      +'OAD:',indentation(1:our_indent), 
                0028      +' __SRNAME__: entering plain or tape'
                0029 #endif
                0030          sumPhip = sumPhi%v
                0031 c set up for plain execution
                0032          our_orig_mode=our_rev_mode
                0033          our_rev_mode%arg_store=.FALSE.
                0034          our_rev_mode%arg_restore=.FALSE.
                0035          our_rev_mode%plain=.TRUE.
                0036          our_rev_mode%tape=.FALSE.
                0037          our_rev_mode%adjoint=.FALSE.
                0038          call global_sum_r8( sumPhip,myThid )
                0039 c reset the mode
                0040          our_rev_mode=our_orig_mode
                0041 c copy back
                0042          sumPhi%v = sumPhip
                0043       end if
                0044       if (our_rev_mode%adjoint) then
                0045 #ifdef OAD_DEBUG_SPLIT2
                0046          write(standardmessageunit,'(A,A,A)') 
                0047      +'OAD:',indentation(1:our_indent), 
                0048      +' __SRNAME__: entering adjoint'
                0049 #endif
                0050          sumPhip = sumPhi%d
                0051 c set up for plain execution
                0052          our_orig_mode=our_rev_mode
                0053          our_rev_mode%arg_store=.FALSE.
                0054          our_rev_mode%arg_restore=.FALSE.
                0055          our_rev_mode%plain=.TRUE.
                0056          our_rev_mode%tape=.FALSE.
                0057          our_rev_mode%adjoint=.FALSE.
                0058          call global_adsum_r8(sumPhip, myThid)
                0059 c reset the mode
                0060          our_rev_mode=our_orig_mode
                0061 c copy back
                0062          sumPhi%d = sumPhip
                0063       end if
                0064 
                0065 #ifdef OAD_DEBUG_SPLIT2
                0066       write(standardmessageunit,'(A,A,A)', ADVANCE='NO') 
                0067      +'OAD:',indentation(1:our_indent), 'leave __SRNAME__:'
                0068       call oad_dump_revmod(); call oad_dump_tapestats()
                0069       write(standardmessageunit,*) 
                0070 
                0071       our_indent=our_indent-1
                0072 #endif
                0073 
                0074       end subroutine template