Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:38:29 UTC

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
bf4be02920 Jean*0001 !=======================================================================
                0002       integer function generate_tag( iarg1, iarg2, carg )
                0003       implicit none
                0004 ! Predefined constants/arrays
                0005 #include "CPLR_SIG.h"
                0006 ! Arguments
                0007       integer iarg1
                0008       integer iarg2
                0009       character*(*) carg
                0010 ! Local
d33d5ef395 Jean*0011 c     integer j,hash,pow
                0012 c     integer itrans(MAXLEN_COMP_NAME)
bf4be02920 Jean*0013 !     ------------------------------------------------------------------
                0014 
                0015 ! Convert the characters to an integer array
d33d5ef395 Jean*0016 c     call mitcplr_char2int( carg, itrans )
bf4be02920 Jean*0017 
                0018 ! Hash the integer array
d33d5ef395 Jean*0019 c     hash=1
                0020 c     pow=1
                0021 c     do j=1,MAXLEN_COMP_NAME
                0022 c      hash=abs(hash+itrans(j)*pow)
                0023 c      pow=mod(pow*128,256*256)
                0024 c     enddo
bf4be02920 Jean*0025 
d33d5ef395 Jean*0026 c     generate_tag=(hash*256+iarg2)*128+iarg1
                0027 c     generate_tag=abs(mod(generate_tag,256*256*256))
                0028       generate_tag = iarg1*MAX_TILES + iarg2
bf4be02920 Jean*0029 
                0030 c     if (DEBUG)
                0031 c    & write(0,*) 'generate_tag = ',generate_tag,iarg1,iarg2,carg
                0032 
                0033 !     ------------------------------------------------------------------
                0034       return
                0035       end
                0036 !=======================================================================