Back to home page

MITgcm

 
 

    


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

view on githubraw file Latest commit 9ca9f870 on 2014-04-03 13:57:36 UTC
8702af1f36 Patr*0001 #!/bin/bash
                0002 file=$1
                0003 wantMPI=$2
                0004 needMpi=false
                0005 cp ${file} ${file}.tmp
                0006 for includeFile in `egrep "\# *include *\"" ${file} | sed 's/# *include *\"\(.*\)\"/\1/' | sort | uniq`
                0007 do 
                0008   modFileName=${includeFile%.h}_mod.h
                0009   if [ -f ${modFileName} ] 
                0010   then 
                0011     echo  "s/\# *include *\(\"${includeFile}\"\)/\#include \"${modFileName}\"/" > temp.sed
                0012     # add in the mpi include here since we filtered it from the module
                0013     if [ "$modFileName" == "EESUPPORT_mod.h" ] 
                0014     then 
                0015       needMpi=true
                0016     fi
                0017     cat ${file}.tmp | sed -f temp.sed | sed 's/IMPLICIT NONE//' | sed 's/implicit none//' > ${file}.tmp.1
                0018     mv ${file}.tmp.1 ${file}.tmp
                0019   fi
                0020 done
                0021 if [ "$needMpi" == "true" -a -n "$wantMPI" ] 
                0022 then 
                0023    cat > cb2mUseMPI.awk <<EOF
                0024 BEGIN { useSeq = 0; inSR=0}
                0025 /^ *SUBROUTINE/ { inSR=1 } 
                0026 /^#include /  { if (inSR == 1) { useSeq = 1 ; print } }
                0027 /^#ifdef/ || /^#endif/ { if (useSeq == 1) print } 
                0028 !/^#include / && !/^#ifdef/ && !/^#endif/ {  if (useSeq == 1) { printf("#include \"mpif.h\"\n"); useSeq=0; inSR=0 } }
                0029 {if (useSeq == 0) print }
                0030 END {}
                0031 EOF
                0032   awk -f cb2mUseMPI.awk ${file}.tmp > ${file}.tmp.1
                0033   mv ${file}.tmp.1 ${file}.tmp
9ca9f87050 Jean*0034   rm -f cb2mUseMPI.awk
8702af1f36 Patr*0035 fi
                0036 mv ${file}.tmp ${file%.F}_cb2m.FF90