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

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


The following commit has been merged in the upstream branch:
commit 76f20dec92698f981ce6a3c839e5afb43d45901e
Author: Stephane Popinet <s.popinet at niwa.co.nz>
Date:   Tue Sep 20 10:48:24 2005 +1000

    RefineHeight uses same interpolation routine as GfsFunction
    
    darcs-hash:20050920004824-fbd8f-ac92600768085416b01d3e2611e5b311173531b7.gz

diff --git a/src/refine.c b/src/refine.c
index f4c7700..9d48329 100644
--- a/src/refine.c
+++ b/src/refine.c
@@ -388,16 +388,19 @@ static void refine_height_destroy (GtsObject * object)
   (* GTS_OBJECT_CLASS (gfs_refine_height_class ())->parent_class->destroy) (object);
 }
 
-static gdouble point_height (GtsPoint * p, GtsSurface * surface, GtsFace ** guess)
+static gdouble interpolated_value (GtsSurface * s, FttVector * p)
 {
-  GtsFace * f = gts_point_locate (p, surface, *guess);
+  GtsPoint q;
+  GtsFace * t;
 
-  if (f != NULL) {
-    *guess = f;
-    gts_triangle_interpolate_height (GTS_TRIANGLE (f), p);
-    return p->z;
+  q.x = p->x; q.y = p->y;
+  t = gts_point_locate (&q, s, NULL);
+  if (t == NULL) {
+    g_warning ("cannot locate point (%g,%g)", p->x, p->y);
+    return 0.;
   }
-  return 0.;
+  gts_triangle_interpolate_height (GTS_TRIANGLE (t), &q);
+  return q.z;
 }
 
 static gdouble cell_height (FttCell * cell, 
@@ -405,22 +408,9 @@ static gdouble cell_height (FttCell * cell,
 			    GfsSimulation * sim,
 			    GfsRefineSurface * refine)
 {
-  GtsFace * guess = NULL;
-  gdouble h = ftt_cell_size (cell)/2.;
   FttVector pos;
-  GtsPoint p;
-  static guint dp[4][2] = {{ -1, -1}, {1, -1}, {1, 1}, {-1, 1}}, i;
-  gdouble min = G_MAXDOUBLE;
-
   ftt_cell_pos (cell, &pos);
-  for (i = 0; i < 4; i++) {
-    gdouble v;
-    p.x = pos.x + h*dp[i][0]; p.y = pos.y + h*dp[i][1];
-    v = point_height (&p, refine->surface, &guess);
-    if (v < min)
-      min = v;
-  }
-  return min;
+  return interpolated_value (refine->surface, &pos);
 }
 
 static void refine_height_read (GtsObject ** o, GtsFile * fp)
@@ -434,12 +424,6 @@ static void refine_height_read (GtsObject ** o, GtsFile * fp)
   }
 
   (* GTS_OBJECT_CLASS (gfs_refine_distance_class ())->parent_class->read) (o, fp);
-  if (fp->type == GTS_ERROR)
-    return;
-  
-  if (gts_surface_volume (GFS_REFINE_SURFACE (*o)->surface) < 0.)
-    gts_surface_foreach_face (GFS_REFINE_SURFACE (*o)->surface, 
-			      (GtsFunc) gts_triangle_revert, NULL);
 }
 
 static void gfs_refine_height_class_init (GfsRefineClass * klass)

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list