[SCM] Gerris Flow Solver branch, upstream, updated. b3aa46814a06c9cb2912790b23916ffb44f1f203
Stephane Popinet
popinet at users.sf.net
Fri May 15 02:53:30 UTC 2009
The following commit has been merged in the upstream branch:
commit 1703c19d532245f975af6afe6f3b6761b9c8712b
Author: Stephane Popinet <popinet at users.sf.net>
Date: Wed Feb 21 08:28:12 2007 +1100
MacOSX does not like nested functions
They were used to implement dx(), dy(), dz() in GfsFunction. They have been
replaced by using ugly (but portable) global variables.
darcs-hash:20070220212812-d4795-7c4c6447d3cb2287136c7a5256cfaa54c74bfcf8.gz
diff --git a/src/utils.c b/src/utils.c
index 442e72e..b7d3b9c 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -510,19 +510,22 @@ static void function_read (GtsObject ** o, GtsFile * fp)
" gpointer data);\n"
"static double Dirichlet = 1.;\n"
"static double Neumann = 0.;\n"
+ "static GfsSimulation * gsim = NULL;\n"
+ "static FttCell * gcell = NULL;\n"
+ "static double dd (const gchar * name, FttComponent c) {\n"
+ " GfsVariable * v = gfs_variable_from_name (GFS_DOMAIN (gsim)->variables, name);\n"
+ " if (v == NULL)\n"
+ " return 0.;\n"
+ " g_return_val_if_fail (gcell != NULL, 0.);\n"
+ " return gfs_center_gradient (gcell, c, v->i)/ftt_cell_size (gcell);\n"
+ "}\n"
+ "static double dx (const gchar * name) { return dd (name, FTT_X); }\n"
+ "static double dy (const gchar * name) { return dd (name, FTT_Y); }\n"
+ #if !FTT_2D
+ "static double dz (const gchar * name) { return dd (name, FTT_Z); }\n"
+ #endif /* 3D */
"double f (FttCell * cell, FttCellFace * face, GfsSimulation * sim) {\n"
- " double dd (const gchar * name, FttComponent c) {\n"
- " GfsVariable * v = gfs_variable_from_name (GFS_DOMAIN (sim)->variables, name);\n"
- " if (v == NULL)\n"
- " return 0.;\n"
- " g_return_val_if_fail (cell != NULL, 0.);\n"
- " return gfs_center_gradient (cell, c, v->i)/ftt_cell_size (cell);\n"
- " }\n"
- " double dx (const gchar * name) { return dd (name, FTT_X); }\n"
- " double dy (const gchar * name) { return dd (name, FTT_Y); }\n"
-#if !FTT_2D
- " double dz (const gchar * name) { return dd (name, FTT_Z); }\n"
-#endif /* 3D */
+ " gsim = sim; gcell = cell;\n"
, fin);
i = domain->variables;
while (i) {
--
Gerris Flow Solver
More information about the debian-science-commits
mailing list