Original WRF subgrid support version from John Michalakes without fire
[wrffire.git] / wrfv2_fire / external / RSL / RSL / generate_invoke.csh
blobc77499af668b654a0e163a009c1e74d859ea4b4a
1 # generates the case statement in invoke_pf.F
2 # Usage:  generate_invoke.csh n
4 # where n is the number of cases to generate.
5
6 onintr cleanup
8 /bin/rm -f /tmp/foo1.$$
10 set n = $1
12 set i = 0 
13 while ( $i < $n )
14   echo "," >> /tmp/foo1.$$
15   @ i += 1
16 end
18 set i = 0
19 while ( $i < $n )
20   @ ii = $i + 1
21   sed "$ii,${n}s/.*,/&A($i),/" /tmp/foo1.$$ > /tmp/foo2.$$
22   /bin/mv /tmp/foo2.$$ /tmp/foo1.$$
23   @ i += 1
24 end
26 cat -n /tmp/foo1.$$ | \
27 sed -e 's/^/case/' -e 's/       / : /' -e 's/,/(*f)(/' -e 's/,$/); break ;/' \
28 > /tmp/foo2.$$
30 echo 'case     0 : (*f)() ; break ;'
31 cat /tmp/foo2.$$
34 cleanup:
36 /bin/rm -f /tmp/foo[12].$$