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

Stephane Popinet popinet at users.sf.net
Fri May 15 02:55:49 UTC 2009


The following commit has been merged in the upstream branch:
commit fafa5ee45370cb0dada0db5069a96d72f2e491a5
Author: Stephane Popinet <popinet at users.sf.net>
Date:   Fri Oct 24 15:08:37 2008 +1100

    rsurfacedraw outputs aspect ratio statistics
    
    darcs-hash:20081024040837-d4795-da26edb3664f1f13f059809aefcd76029a8388f2.gz

diff --git a/modules/rsurfacedraw.c b/modules/rsurfacedraw.c
index ad5cdb6..adf7c75 100644
--- a/modules/rsurfacedraw.c
+++ b/modules/rsurfacedraw.c
@@ -12,6 +12,7 @@
 
 typedef struct {
   FILE ** fp;
+  double * ratio;
   int * size;
   char * name, * ext;
   int maxdepth;
@@ -38,6 +39,11 @@ static int intersects (RSurfaceRect RSTrect, Params * p, int depth)
 	   RSTrect[0].h, RSTrect[1].h,
 	   RSTrect[0].l, RSTrect[1].h,
 	   RSTrect[0].l, RSTrect[1].l);
+  double w = RSTrect[0].h - RSTrect[0].l, h = RSTrect[1].h - RSTrect[1].l;
+  double ratio = 1e10;
+  if (w > 0. && h > 0.)
+    ratio = w > h ? w/h : h/w;
+  p->ratio[depth] += ratio;
   p->size[depth]++;
   return (depth < p->maxdepth);
 }
@@ -110,6 +116,7 @@ int main (int argc, char** argv)
   p.ext = &p.name[strlen (p.name)];
   p.fp = calloc (p.maxdepth + 1, sizeof (FILE *));
   p.size = calloc (p.maxdepth + 1, sizeof (int));
+  p.ratio = calloc (p.maxdepth + 1, sizeof (double));
   r_surface_sum_init (&s);
   r_surface_query_region_sum (rs, (RSurfaceCheck) includes, (RSurfaceCheck) intersects, &p, 
 			      rect, &s);
@@ -119,9 +126,11 @@ int main (int argc, char** argv)
     int i;
     for (i = 1; i <= p.maxdepth; i++)
       if (p.size[i] > 0) {
-	fprintf (stderr, "level %d: %d", i, p.size[i]);
+	fprintf (stderr, "level %d: %d\n", i, p.size[i]);
 	if (i < p.maxdepth && p.size[i + 1] > 0)
-	  fprintf (stderr, " average # of entries: %d\n", p.size[i + 1]/p.size[i]);
+	  fprintf (stderr, "\taverage ratio: %g average # of entries: %g\n",
+		   p.ratio[i]/p.size[i],
+		   p.size[i + 1]/(double) p.size[i]);
 	else
 	  fputc ('\n', stderr);
       }

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list