[SCM] Gerris Flow Solver branch, upstream, updated. e8f73a07832050124d2b8bf6c6f35b33180e65a8
Stephane Popinet
popinet at users.sf.net
Tue Nov 24 12:24:40 UTC 2009
The following commit has been merged in the upstream branch:
commit 56535d3aa1def0cfb4645a2442ee0ec9b05c7d09
Author: Stephane Popinet <popinet at users.sf.net>
Date: Mon Jul 20 17:39:08 2009 +1000
Important bug fix for graph partitioning
i.e. the "-p" option of gerris. Incorrect object casting between GtsWGnode and
GfsBox were causing segfaults for some configurations.
darcs-hash:20090720073908-d4795-521acc25d248d87d4f847cbe2179024d9bc187ce.gz
diff --git a/src/domain.c b/src/domain.c
index d1355cf..5a5d785 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -456,14 +456,16 @@ static void free_pair (gpointer key, gpointer value)
static void cleanup_each_box (GfsBox * box, GfsDomain * domain)
{
- ftt_cell_traverse (box->root, FTT_PRE_ORDER, FTT_TRAVERSE_ALL, -1,
- (FttCellTraverseFunc) gfs_cell_cleanup, domain);
- FttDirection d;
- for (d = 0; d < FTT_NEIGHBORS; d++)
- if (GFS_IS_BOUNDARY (box->neighbor[d]))
- ftt_cell_traverse (GFS_BOUNDARY (box->neighbor[d])->root,
- FTT_PRE_ORDER, FTT_TRAVERSE_ALL, -1,
- (FttCellTraverseFunc) gfs_cell_cleanup, domain);
+ if (GFS_IS_BOX (box)) { /* this is a necessary check when using graph partitioning */
+ ftt_cell_traverse (box->root, FTT_PRE_ORDER, FTT_TRAVERSE_ALL, -1,
+ (FttCellTraverseFunc) gfs_cell_cleanup, domain);
+ FttDirection d;
+ for (d = 0; d < FTT_NEIGHBORS; d++)
+ if (GFS_IS_BOUNDARY (box->neighbor[d]))
+ ftt_cell_traverse (GFS_BOUNDARY (box->neighbor[d])->root,
+ FTT_PRE_ORDER, FTT_TRAVERSE_ALL, -1,
+ (FttCellTraverseFunc) gfs_cell_cleanup, domain);
+ }
}
static void domain_destroy (GtsObject * o)
@@ -504,9 +506,15 @@ static void add_item (gpointer item, GPtrArray * a)
g_ptr_array_add (a, item);
}
-static int compare_boxes (const void * b1, const void * b2)
+static int compare_boxes (const void * p1, const void * p2)
{
- return (*(GfsBox **)b1)->id < (*(GfsBox **)b2)->id ? -1 : 1;
+ GfsBox * b1 = *(GfsBox **)p1;
+ GfsBox * b2 = *(GfsBox **)p2;
+ /* the check below is necessary when using graph partitioning */
+ if (GFS_IS_BOX (b1) && GFS_IS_BOX (b2))
+ return b1->id < b2->id ? -1 : 1;
+ else
+ return 0;
}
static void domain_foreach (GtsContainer * c,
--
Gerris Flow Solver
More information about the debian-science-commits
mailing list