[SCM] Gerris Flow Solver branch, upstream, updated. b3aa46814a06c9cb2912790b23916ffb44f1f203

Stephane Popinet s.popinet at niwa.co.nz
Fri May 15 02:51:49 UTC 2009


The following commit has been merged in the upstream branch:
commit ce761830018fe1315b9193501c09f93dff32f400
Author: Stephane Popinet <s.popinet at niwa.co.nz>
Date:   Thu Apr 14 02:48:57 2005 +1000

    gerris can take parameter file on standard input
    
    darcs-hash:20050413164857-fbd8f-dabbb66e66d80425de8173b246b26e4fde49fde8.gz

diff --git a/src/gerris.c b/src/gerris.c
index f02ce24..273bb1d 100644
--- a/src/gerris.c
+++ b/src/gerris.c
@@ -120,10 +120,14 @@ int main (int argc, char * argv[])
     return 1; /* failure */
   }
 
-  fptr = fopen (argv[optind], "r");
-  if (fptr == NULL) {
-    fprintf (stderr, "gerris: unable to open file `%s'\n", argv[optind]);
-    return 1;
+  if (!strcmp (argv[optind], "-"))
+    fptr = stdin;
+  else {
+    fptr = fopen (argv[optind], "r");
+    if (fptr == NULL) {
+      fprintf (stderr, "gerris: unable to open file `%s'\n", argv[optind]);
+      return 1;
+    }
   }
 
   fp = gts_file_new (fptr);
@@ -136,7 +140,8 @@ int main (int argc, char * argv[])
     return 1;
   }
   gts_file_destroy (fp);
-  fclose (fptr);
+  if (fptr != stdin)
+    fclose (fptr);
 
   if (npart > 0) {
     guint nmin = 1000;
diff --git a/test/ocean/geo.sh b/test/ocean/geo.sh
index aefe40c..2e1b195 100644
--- a/test/ocean/geo.sh
+++ b/test/ocean/geo.sh
@@ -1,9 +1,8 @@
 # !/bin/sh
 
-param=`mktemp /tmp/geo.XXXXXX`
 error=`mktemp /tmp/geo.XXXXXX`
 
-cat <<EOF > $param
+cat <<EOF | gerris2D3 -
 1 0 GfsOcean GfsBox GfsGEdge {} {
  # dt = 1000 s
  Time { iend = 1580 dtmax = 0.10285 }
@@ -35,8 +34,6 @@ GfsBox {
 }
 EOF
 
-gerris2D3 $param
-
 if awk 'BEGIN{emax=0.}{if ($2 > emax) emax=$2;}
 END{
   print "maximum geostrophic error: " emax;
@@ -45,11 +42,11 @@ END{
   else
     exit 1;
 }' < $error; then
-  rm -f $param $error
+  rm -f $error
   exit 1;
 fi
 
-cat <<EOF > $param
+cat <<EOF | gerris2D3 -
 1 0 GfsOcean GfsBox GfsGEdge {} {
  # dt = 1000 s
  Time { iend = 1580 dtmax = 0.10285 }
@@ -77,8 +74,6 @@ GfsBox {
 }
 EOF
 
-gerris2D3 $param
-
 if awk 'BEGIN{emin=1.}{if ($2 < emin) emin=$2;}
 END{
   print "minimum geostrophic energy: " emin;
@@ -87,8 +82,8 @@ END{
   else
     exit 1;
 }' < $error; then
-  rm -f $param $error
+  rm -f $error
   exit 1;
 fi
 
-rm -f $param $error
+rm -f $error
diff --git a/test/tension/spurious.sh b/test/tension/spurious.sh
index 7bd8b69..4e555db 100755
--- a/test/tension/spurious.sh
+++ b/test/tension/spurious.sh
@@ -6,8 +6,6 @@ else
     ../poisson/shapes ellipse | transform --scale 0.8 > circle.gts
 fi
 
-param=`mktemp /tmp/spurious.XXXXXX`
-
 for adapt in "AdaptFunction { istep = 1 } { cmax = 0.1 maxlevel = 5 } _Tx*_Tx+_Ty*_Ty"; do
   if test "$adapt"; then
     echo "Adaptive refinement"
@@ -18,7 +16,7 @@ for adapt in "AdaptFunction { istep = 1 } { cmax = 0.1 maxlevel = 5 } _Tx*_Tx+_T
       mu=`echo $La | awk '{print sqrt (0.4/$1)}'`
       tmax=`echo $mu | awk '{print 1000.*$1*0.4}'`
       du=`echo $mu | awk '{print 1e-7/$1}'`
-      cat <<EOF > $param
+      cat <<EOF | gerris2D -
 1 2 GfsSimulation GfsBox GfsGEdge {} {
   Time {
     end = $tmax
@@ -43,7 +41,6 @@ GfsBox {}
 1 1 right 
 1 1 top
 EOF
-      gerris2D $param
       if awk -v La=$La -v mu=$mu '{if ($1 == "Velocity") {max1 = max; max = $9;}} END {
       printf ("Laplace number: %6g max(U)*mu/sigma: %g\n", La, max1*mu);
       if (max1*mu > 2.5e-3)
@@ -51,10 +48,7 @@ EOF
     }' < spurious-$La; then
 	  :
       else
-	  rm -f $param
 	  exit 1
       fi
   done
 done
-
-rm -f $param

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list