[SCM] Gerris Flow Solver branch, upstream, updated. b3aa46814a06c9cb2912790b23916ffb44f1f203
Stephane Popinet
popinet at users.sf.net
Fri May 15 02:54:41 UTC 2009
The following commit has been merged in the upstream branch:
commit 404eb040c9dad362fed98cdc804a3a3d05c669b6
Author: Stephane Popinet <popinet at users.sf.net>
Date: Thu Sep 13 13:01:21 2007 +1000
New "Id" and "Pid" derived variables
darcs-hash:20070913030121-d4795-3030967834ed9ff4cae8ece05ea4fde030502c81.gz
diff --git a/src/boundary.c b/src/boundary.c
index f6c1bf4..2875f94 100644
--- a/src/boundary.c
+++ b/src/boundary.c
@@ -684,6 +684,7 @@ GfsBoundary * gfs_boundary_new (GfsBoundaryClass * klass,
if (box->root) {
domain = gfs_box_domain (box);
boundary->root = ftt_cell_new ((FttCellInitFunc) gfs_cell_init, domain);
+ FTT_ROOT_CELL (boundary->root)->parent = box;
ftt_cell_set_level (boundary->root, ftt_cell_level (box->root));
ftt_cell_set_neighbor_match (boundary->root, box->root, boundary->d,
(FttCellInitFunc) gfs_cell_init, domain);
@@ -1542,6 +1543,7 @@ static void gfs_box_read (GtsObject ** o, GtsFile * fp)
}
}
+ FTT_ROOT_CELL (b->root)->parent = b;
if (ftt_cell_level (b->root) != domain->rootlevel) {
FttDirection d;
diff --git a/src/domain.c b/src/domain.c
index c51b64f..4fd74c3 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -1787,8 +1787,10 @@ static void box_destroy (GfsBox * box, GfsVariable * newboxp)
ftt_cell_destroy_root (box->root, &child, (FttCellCleanupFunc) gfs_cell_cleanup, NULL);
box->root = NULL;
for (i = 0; i < FTT_CELLS; i++)
- if (child.c[i])
+ if (child.c[i]) {
newbox[i]->root = child.c[i];
+ FTT_ROOT_CELL (newbox[i]->root)->parent = newbox[i];
+ }
gts_object_destroy (GTS_OBJECT (box));
}
diff --git a/src/ftt.c b/src/ftt.c
index 701ac16..4c8f9ed 100644
--- a/src/ftt.c
+++ b/src/ftt.c
@@ -39,8 +39,6 @@ gint ftt_opposite_direction[FTT_NEIGHBORS] =
typedef struct _FttOct FttOct;
typedef struct _FttRootCell FttRootCell;
-#define FTT_ROOT_CELL(cell) ((FttRootCell *) cell)
-
static void oct_new (FttCell * parent,
gboolean check_neighbors,
FttCellInitFunc init,
diff --git a/src/ftt.h b/src/ftt.h
index 6a39ae7..a40de24 100644
--- a/src/ftt.h
+++ b/src/ftt.h
@@ -150,6 +150,7 @@ struct _FttRootCell {
#if FTT_2D3
gdouble dz;
#endif
+ gpointer parent;
};
struct _FttOct {
@@ -169,6 +170,7 @@ struct _FttCellFace {
FttDirection d;
};
+#define FTT_ROOT_CELL(c) ((struct _FttRootCell *) c)
#define FTT_CELL_ID(c) ((c)->flags & FTT_FLAG_ID)
#define FTT_CELL_IS_LEAF(c) ((c)->children == NULL)
#define FTT_CELL_IS_ROOT(c) ((c)->parent == NULL)
diff --git a/src/simulation.c b/src/simulation.c
index 91479f9..93d7b34 100644
--- a/src/simulation.c
+++ b/src/simulation.c
@@ -625,6 +625,20 @@ static gdouble cell_2nd_principal_invariant (FttCell * cell, FttCellFace * face,
return gfs_2nd_principal_invariant (cell, gfs_domain_velocity (domain))/ftt_cell_size (cell);
}
+static gdouble cell_pid (FttCell * cell)
+{
+ while (!FTT_CELL_IS_ROOT (cell))
+ cell = ftt_cell_parent (cell);
+ return GFS_BOX (FTT_ROOT_CELL (cell)->parent)->pid;
+}
+
+static gdouble cell_id (FttCell * cell)
+{
+ while (!FTT_CELL_IS_ROOT (cell))
+ cell = ftt_cell_parent (cell);
+ return GFS_BOX (FTT_ROOT_CELL (cell)->parent)->id;
+}
+
static void simulation_init (GfsSimulation * object)
{
GfsDomain * domain = GFS_DOMAIN (object);
@@ -660,6 +674,8 @@ static void simulation_init (GfsSimulation * object)
{ "Lambda2", "Vortex-detection criterion of Jeong & Hussein", cell_velocity_lambda2 },
{ "Curvature", "Curvature of the local streamline", cell_streamline_curvature },
{ "D2", "Second principal invariant of the deformation tensor", cell_2nd_principal_invariant },
+ { "Pid", "Parent box process ID", cell_pid },
+ { "Id", "Parent box ID", cell_id },
{ NULL, NULL, NULL}
};
GfsDerivedVariableInfo * v = derived_variable;
--
Gerris Flow Solver
More information about the debian-science-commits
mailing list