[SCM] Gerris Flow Solver branch, upstream, updated. b3aa46814a06c9cb2912790b23916ffb44f1f203

Stephane Popinet popinet at users.sf.net
Fri May 15 02:53:49 UTC 2009


The following commit has been merged in the upstream branch:
commit c23db32b0c54d44935de054f3550824a67a81c8e
Author: Stephane Popinet <popinet at users.sf.net>
Date:   Thu Dec 14 11:03:31 2006 +1100

    gfs_function_face_value() uses the face-interpolated values of variables
    
    darcs-hash:20061214000331-d4795-39fae315b19fc824293847cbe100129686fe785b.gz

diff --git a/src/utils.c b/src/utils.c
index b7d3b9c..46cb021 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -556,23 +556,34 @@ static void function_read (GtsObject ** o, GtsFile * fp)
 	i = i->next;
       }
       if (lv) {
-	fputs ("  g_return_val_if_fail (cell != NULL, 0.);\n", fin);
+	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);
+	  fprintf (fin, "    %s = GFS_VARIABLE (cell, %d);\n", v->name, v->i);
 	  i = i->next;
 	}
+	fputs ("  } else {\n", fin);
+	i = lv;
+	while (i) {
+	  GfsVariable * v = i->data;
+	  fprintf (fin, "    %s = gfs_face_interpolated_value (face, %d);\n", v->name, v->i);
+	  i = i->next;
+	}
+	fputs ("  }\n", fin);
 	g_slist_free (lv);
       }
-      i = ldv;
-      while (i) {
-	GfsDerivedVariable * v = i->data;
-	fprintf (fin, "  %s = (* (Func) %p) (cell, face, sim, ((GfsDerivedVariable *) %p)->data);\n", 
-		 v->name, v->func, v);
-	i = i->next;
+      if (ldv) {
+	fputs ("  g_return_val_if_fail (cell != NULL, 0.);\n", fin);
+	i = ldv;
+	while (i) {
+	  GfsDerivedVariable * v = i->data;
+	  fprintf (fin, "  %s = (* (Func) %p) (cell, face, sim, ((GfsDerivedVariable *) %p)->data);\n", 
+		   v->name, v->func, v);
+	  i = i->next;
+	}
+	g_slist_free (ldv);
       }
-      g_slist_free (ldv);
     }
     fprintf (fin, "#line %d \"GfsFunction\"\n", fp->line);
 
@@ -788,11 +799,11 @@ gdouble gfs_function_face_value (GfsFunction * f, FttCellFace * fa)
   else if (f->v)
     return gfs_face_interpolated_value (fa, f->v->i);
   else if (f->dv)
-    return (* (GfsFunctionDerivedFunc) f->dv->func) (fa->cell, fa,
+    return (* (GfsFunctionDerivedFunc) f->dv->func) (NULL, fa,
 						     gfs_object_simulation (f), 
 						     f->dv->data);
   else if (f->f)
-    return (* f->f) (fa->cell, fa, gfs_object_simulation (f));
+    return (* f->f) (NULL, fa, gfs_object_simulation (f));
   else
     return f->val;
 }

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list