/[MITgcm]/MITgcm/tools/OAD_support/cb2mUseModules.bash
ViewVC logotype

Contents of /MITgcm/tools/OAD_support/cb2mUseModules.bash

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Thu Sep 20 23:12:47 2012 UTC (11 years, 6 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint64o, checkpoint64a, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64n, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64c, checkpoint64g, checkpoint64f, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64, checkpoint64j, checkpoint64m, checkpoint64l
* Merge OAD_support from MITgcm_contrib/heimbach/OpenAD/OAD_support/
  to tools/OAD_support/
* Adjust genmake2 to reflect path change (attempt with ${OADTOOLS})
* Adjust insertTemplateDir.bash to reflect path change
Seems to work.

1 #!/bin/bash
2 file=$1
3 wantMPI=$2
4 needMpi=false
5 cp ${file} ${file}.tmp
6 for includeFile in `egrep "\# *include *\"" ${file} | sed 's/# *include *\"\(.*\)\"/\1/' | sort | uniq`
7 do
8 modFileName=${includeFile%.h}_mod.h
9 if [ -f ${modFileName} ]
10 then
11 echo "s/\# *include *\(\"${includeFile}\"\)/\#include \"${modFileName}\"/" > temp.sed
12 # add in the mpi include here since we filtered it from the module
13 if [ "$modFileName" == "EESUPPORT_mod.h" ]
14 then
15 needMpi=true
16 fi
17 cat ${file}.tmp | sed -f temp.sed | sed 's/IMPLICIT NONE//' | sed 's/implicit none//' > ${file}.tmp.1
18 mv ${file}.tmp.1 ${file}.tmp
19 fi
20 done
21 if [ "$needMpi" == "true" -a -n "$wantMPI" ]
22 then
23 cat > cb2mUseMPI.awk <<EOF
24 BEGIN { useSeq = 0; inSR=0}
25 /^ *SUBROUTINE/ { inSR=1 }
26 /^#include / { if (inSR == 1) { useSeq = 1 ; print } }
27 /^#ifdef/ || /^#endif/ { if (useSeq == 1) print }
28 !/^#include / && !/^#ifdef/ && !/^#endif/ { if (useSeq == 1) { printf("#include \"mpif.h\"\n"); useSeq=0; inSR=0 } }
29 {if (useSeq == 0) print }
30 END {}
31 EOF
32 awk -f cb2mUseMPI.awk ${file}.tmp > ${file}.tmp.1
33 mv ${file}.tmp.1 ${file}.tmp
34 fi
35 mv ${file}.tmp ${file%.F}_cb2m.FF90

  ViewVC Help
Powered by ViewVC 1.1.22