[SCM] Gerris Flow Solver branch, upstream, updated. b3aa46814a06c9cb2912790b23916ffb44f1f203
Stephane Popinet
s.popinet at niwa.co.nz
Fri May 15 02:52:40 UTC 2009
The following commit has been merged in the upstream branch:
commit 620f1cbe2aed2466cc75f78c324ade83163170f7
Author: Stephane Popinet <s.popinet at niwa.co.nz>
Date: Mon Sep 26 12:01:45 2005 +1000
Some derived variables can be used in GfsFunction even with cell
darcs-hash:20050926020145-fbd8f-c82f8a9871ef22ddeaa02b8640d7ba22bea8ea8b.gz
diff --git a/src/simulation.c b/src/simulation.c
index 3af85e5..8b55ada 100644
--- a/src/simulation.c
+++ b/src/simulation.c
@@ -611,6 +611,8 @@ static gdouble cell_x (FttCell * cell, FttCellFace * face)
{
FttVector p;
+ g_return_val_if_fail (cell != NULL || face != NULL, 0.);
+
if (face && face->d/2 == 0)
ftt_face_pos (face, &p);
else
@@ -622,6 +624,8 @@ static gdouble cell_y (FttCell * cell, FttCellFace * face)
{
FttVector p;
+ g_return_val_if_fail (cell != NULL || face != NULL, 0.);
+
if (face && face->d/2 == 1)
ftt_face_pos (face, &p);
else
@@ -633,6 +637,8 @@ static gdouble cell_z (FttCell * cell, FttCellFace * face)
{
FttVector p;
+ g_return_val_if_fail (cell != NULL || face != NULL, 0.);
+
if (face && face->d/2 == 2)
ftt_face_pos (face, &p);
else
@@ -644,6 +650,8 @@ static gdouble cell_cx (FttCell * cell, FttCellFace * face)
{
FttVector p;
+ g_return_val_if_fail (cell != NULL || face != NULL, 0.);
+
if (face && face->d/2 == 0)
ftt_face_pos (face, &p);
else
@@ -655,6 +663,8 @@ static gdouble cell_cy (FttCell * cell, FttCellFace * face)
{
FttVector p;
+ g_return_val_if_fail (cell != NULL || face != NULL, 0.);
+
if (face && face->d/2 == 1)
ftt_face_pos (face, &p);
else
@@ -666,6 +676,8 @@ static gdouble cell_cz (FttCell * cell, FttCellFace * face)
{
FttVector p;
+ g_return_val_if_fail (cell != NULL || face != NULL, 0.);
+
if (face && face->d/2 == 2)
ftt_face_pos (face, &p);
else
@@ -705,6 +717,7 @@ static gdouble cell_level (FttCell * cell)
static gdouble cell_fraction (FttCell * cell)
{
+ g_return_val_if_fail (cell != NULL, 0.);
return GFS_IS_MIXED (cell) ? GFS_STATE (cell)->solid->a : 1.;
}
diff --git a/src/utils.c b/src/utils.c
index 4068f96..1222043 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -432,18 +432,20 @@ static void function_read (GtsObject ** o, GtsFile * fp)
fprintf (fin, " double %s;\n", v->name);
i = i->next;
}
- fputs (" if (cell) {\n", fin);
- i = lv;
- while (i) {
- GfsVariable * v = i->data;
- fprintf (fin, " %s = GFS_VARIABLE (cell, %d);\n", v->name, v->i);
- i = i->next;
+ if (lv) {
+ fputs (" g_return_val_if_fail (cell != NULL, 0.);\n", fin);
+ i = lv;
+ while (i) {
+ GfsVariable * v = i->data;
+ fprintf (fin, " %s = GFS_VARIABLE (cell, %d);\n", v->name, v->i);
+ i = i->next;
+ }
+ g_slist_free (lv);
}
- g_slist_free (lv);
i = ldv;
while (i) {
GfsDerivedVariable * v = i->data;
- fprintf (fin, " %s = (* (Func) %p) (cell, face, sim, ", v->name, v->func);
+ fprintf (fin, " %s = (* (Func) %p) (cell, face, sim, ", v->name, v->func);
if (v->data)
fprintf (fin, "%p);\n", v->data);
else
@@ -451,7 +453,6 @@ static void function_read (GtsObject ** o, GtsFile * fp)
i = i->next;
}
g_slist_free (ldv);
- fputs (" }\n", fin);
}
fprintf (fin, "#line %d \"GfsFunction\"\n", fp->line);
--
Gerris Flow Solver
More information about the debian-science-commits
mailing list