[SCM] Gerris Flow Solver branch, upstream, updated. b3aa46814a06c9cb2912790b23916ffb44f1f203
Stephane Popinet
popinet at users.sourceforge.net
Fri May 15 02:51:24 UTC 2009
The following commit has been merged in the upstream branch:
commit 63ea2d7231e6fa688176d3cadca083b9bf9d9535
Author: Stephane Popinet <popinet at users.sourceforge.net>
Date: Tue Nov 9 13:21:44 2004 +1100
More robust GfsRefineHeight algorithm (gerris--ocean--0.7--patch-4)
gerris--ocean--0.7--patch-4
Keywords:
Uses the four cell corner height values rather than just the central
one.
darcs-hash:20041109022144-aabb8-fafa5899eb02b923d28807e0c8947065ffcd1649.gz
diff --git a/src/refine.c b/src/refine.c
index 91cd135..416c464 100644
--- a/src/refine.c
+++ b/src/refine.c
@@ -398,20 +398,43 @@ static void refine_height_read (GtsObject ** o, GtsFile * fp)
(GtsFunc) gts_triangle_revert, NULL);
}
+static gboolean height_maxlevel (GtsPoint * p, guint level, GfsRefine * refine, GtsFace ** guess)
+{
+ GtsFace * f = gts_point_locate (p, GFS_REFINE_SURFACE (refine)->surface, *guess);
+
+ if (f != NULL) {
+ FttVector pos;
+
+ *guess = f;
+ gts_triangle_interpolate_height (GTS_TRIANGLE (f), p);
+ pos.x = p->x; pos.y = p->y; pos.z = p->z;
+ return (level < gfs_function_value (refine->maxlevel, &pos, p->z));
+ }
+ return FALSE;
+}
+
static gboolean refine_height_maxlevel (FttCell * cell, gpointer * data)
{
GfsRefine * refine = data[0];
- GtsFace * f, ** guess = data[1];
+ GtsFace ** guess = data[1];
+ guint level = ftt_cell_level (cell);
+ gdouble h = ftt_cell_size (cell)/2.;
FttVector pos;
GtsPoint p;
ftt_cell_pos (cell, &pos);
- p.x = pos.x; p.y = pos.y;
- if ((f = gts_point_locate (&p, GFS_REFINE_SURFACE (refine)->surface, NULL))) {
- *guess = f;
- gts_triangle_interpolate_height (GTS_TRIANGLE (f), &p);
- return (ftt_cell_level (cell) < gfs_function_value (refine->maxlevel, &pos, p.z));
- }
+ p.x = pos.x - h; p.y = pos.y - h;
+ if (height_maxlevel (&p, level, refine, guess))
+ return TRUE;
+ p.x = pos.x + h; p.y = pos.y - h;
+ if (height_maxlevel (&p, level, refine, guess))
+ return TRUE;
+ p.x = pos.x + h; p.y = pos.y + h;
+ if (height_maxlevel (&p, level, refine, guess))
+ return TRUE;
+ p.x = pos.x - h; p.y = pos.y + h;
+ if (height_maxlevel (&p, level, refine, guess))
+ return TRUE;
return FALSE;
}
--
Gerris Flow Solver
More information about the debian-science-commits
mailing list