[SCM] Gerris Flow Solver branch, upstream, updated. b3aa46814a06c9cb2912790b23916ffb44f1f203
Stephane Popinet
popinet at users.sf.net
Fri May 15 02:53:41 UTC 2009
The following commit has been merged in the upstream branch:
commit 21ba79805953cc9d5c2fdd62fbe631f6e691738f
Author: Stephane Popinet <popinet at users.sf.net>
Date: Fri Oct 6 12:07:56 2006 +1000
New function gfs_domain_boundary_locate()
darcs-hash:20061006020756-d4795-0353be888c661e514e69090cda337c7df7b4f876.gz
diff --git a/src/domain.c b/src/domain.c
index c2fea66..5cf403e 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -1834,14 +1834,16 @@ void gfs_domain_split (GfsDomain * domain, gboolean one_box_per_pe)
gts_container_foreach (GTS_CONTAINER (domain), (GtsFunc) get_ref_pos, &domain->refpos);
}
-static void box_locate (GfsBox * box, gpointer * data)
-{
- FttVector * target = data[0];
- gint * max_depth = data[1];
- FttCell ** cell = data[2];
+typedef struct {
+ FttVector target;
+ gint max_depth;
+ FttCell * cell;
+} LocateArgs;
- if (*cell == NULL)
- *cell = ftt_cell_locate (box->root, *target, *max_depth);
+static void box_locate (GfsBox * box, LocateArgs * a)
+{
+ if (a->cell == NULL)
+ a->cell = ftt_cell_locate (box->root, a->target, a->max_depth);
}
/**
@@ -1862,17 +1864,53 @@ FttCell * gfs_domain_locate (GfsDomain * domain,
FttVector target,
gint max_depth)
{
- FttCell * cell = NULL;
- gpointer data[3];
+ LocateArgs a;
+
+ g_return_val_if_fail (domain != NULL, NULL);
+
+ a.target = target;
+ a.max_depth = max_depth;
+ a.cell = NULL;
+ gts_container_foreach (GTS_CONTAINER (domain), (GtsFunc) box_locate, &a);
+
+ return a.cell;
+}
+
+static void box_boundary_locate (GfsBox * box, LocateArgs * a)
+{
+ FttDirection d;
+
+ for (d = 0; d < FTT_NEIGHBORS; d++)
+ if (a->cell == NULL && box->neighbor[d] && GFS_IS_BOUNDARY (box->neighbor[d]))
+ a->cell = ftt_cell_locate (GFS_BOUNDARY (box->neighbor[d])->root, a->target, a->max_depth);
+}
+
+/**
+ * gfs_domain_boundary_locate:
+ * @domain: a #GfsDomain.
+ * @target: position of the point to look for.
+ * @max_depth: maximum depth to consider (-1 means no restriction).
+ *
+ * Locates the cell of the boundary of @domain containing @target.
+ *
+ * Returns: a #FttCell of the boundary of @domain containing the
+ * point defined by @target or %NULL if @target is not contained in
+ * any cell of the boundary of @domain.
+ */
+FttCell * gfs_domain_boundary_locate (GfsDomain * domain,
+ FttVector target,
+ gint max_depth)
+{
+ LocateArgs a;
g_return_val_if_fail (domain != NULL, NULL);
- data[0] = ⌖
- data[1] = &max_depth;
- data[2] = &cell;
- gts_container_foreach (GTS_CONTAINER (domain), (GtsFunc) box_locate, data);
+ a.target = target;
+ a.max_depth = max_depth;
+ a.cell = NULL;
+ gts_container_foreach (GTS_CONTAINER (domain), (GtsFunc) box_boundary_locate, &a);
- return cell;
+ return a.cell;
}
static void box_distance2 (GfsBox * box, GPtrArray * a)
diff --git a/src/domain.h b/src/domain.h
index 0da6177..06088fd 100644
--- a/src/domain.h
+++ b/src/domain.h
@@ -190,6 +190,9 @@ void gfs_domain_split (GfsDomain * domain,
FttCell * gfs_domain_locate (GfsDomain * domain,
FttVector target,
gint max_depth);
+FttCell * gfs_domain_boundary_locate (GfsDomain * domain,
+ FttVector target,
+ gint max_depth);
gdouble gfs_domain_cell_point_distance2 (GfsDomain * domain,
GtsPoint * p,
gdouble (* distance2) (FttCell *,
diff --git a/src/vof.c b/src/vof.c
index 6a072d7..c91fc40 100644
--- a/src/vof.c
+++ b/src/vof.c
@@ -398,13 +398,8 @@ void gfs_youngs_normal (FttCell * cell, GfsVariable * v, FttVector * n)
FttVector o;
o.x = p.x + h*x; o.y = p.y + h*y; o.z = 0.;
FttCell * neighbor = gfs_domain_locate (v->domain, o, level);
- g_assert (neighbor);
-
- guint l = ftt_cell_level (neighbor);
- FttVector m;
- gdouble alpha;
- if (l == level || !gfs_vof_plane (neighbor, v, &m, &alpha))
- f[x + 1][y + 1] = GFS_VARIABLE (neighbor, v->i);
+ if (!neighbor) /* fixme: boundary conditions */
+ f[x + 1][y + 1] = f[1][1];
else {
FttComponent c;
FttVector q;
--
Gerris Flow Solver
More information about the debian-science-commits
mailing list