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

Stephane Popinet popinet at users.sf.net
Fri May 15 02:55:59 UTC 2009


The following commit has been merged in the upstream branch:
commit 88d666f51f76e1890a9c7f12353ba3f9656f52c2
Author: Stephane Popinet <popinet at users.sf.net>
Date:   Thu Jan 15 14:07:15 2009 +1100

    Bug fix for gfs_all_reduce()
    
    darcs-hash:20090115030715-d4795-b9ca367da11fed7b2fe1f1f35e5c7446df7b5b71.gz

diff --git a/src/domain.c b/src/domain.c
index 9f57508..e4a62ef 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -23,10 +23,11 @@
 #include <string.h>
 #include "domain.h"
 
-#include "config.h"
 #include "advection.h"
 #include "source.h"
 #include "solid.h"
+
+#include "config.h"
 #ifdef HAVE_MPI
 #  include "mpi_boundary.h"
 #  include "init.h"
diff --git a/src/mpi_boundary.h b/src/mpi_boundary.h
index 65ec8f7..737aef5 100644
--- a/src/mpi_boundary.h
+++ b/src/mpi_boundary.h
@@ -23,17 +23,6 @@
 #include <mpi.h>
 #include "boundary.h"
 
-#ifdef gfs_all_reduce
-# undef gfs_all_reduce
-#endif
-#define gfs_all_reduce(domain, p, type, op) {				\
-    if ((domain)->pid >= 0) {						\
-      union { int a; float b; double c;} global;			\
-      MPI_Allreduce (&(p), &global, 1, type, op, MPI_COMM_WORLD);	\
-      memcpy (&(p), &global, sizeof (p));				\
-    }									\
-  }
-
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
diff --git a/src/river.c b/src/river.c
index a37ec2a..133cd37 100644
--- a/src/river.c
+++ b/src/river.c
@@ -337,7 +337,7 @@ static gdouble river_cfl (GfsSimulation * sim)
   GfsRiver * r = GFS_RIVER (sim);
   r->cfl = G_MAXDOUBLE;
   gfs_domain_traverse_leaves (GFS_DOMAIN (sim), (FttCellTraverseFunc) minimum_cfl, r);
-  gfs_all_reduce (domain, r->cfl, MPI_DOUBLE, MPI_MIN);
+  gfs_all_reduce (GFS_DOMAIN (sim), r->cfl, MPI_DOUBLE, MPI_MIN);
   return r->cfl;
 }
 
diff --git a/src/simulation.c b/src/simulation.c
index eb37eb5..cd2c2b3 100644
--- a/src/simulation.c
+++ b/src/simulation.c
@@ -32,9 +32,6 @@
 #include "tension.h"
 #include "map.h"
 #include "version.h"
-#ifdef HAVE_MPI
-#  include "mpi_boundary.h"
-#endif /* HAVE_MPI */
 
 /* GfsSimulation: object */
 
diff --git a/src/utils.h b/src/utils.h
index 06d1a6e..c2f1a00 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -27,8 +27,22 @@ extern "C" {
 #include <gmodule.h>
 #include "ftt.h"
 
-/* gfs_all_reduce() defaults to nothing without MPI */
-#define gfs_all_reduce(domain, p, type, op)
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#  ifdef HAVE_MPI
+#    include <mpi.h>
+#    define gfs_all_reduce(domain, p, type, op) {				\
+      if ((domain)->pid >= 0) {						\
+        union { int a; float b; double c;} global;			\
+        MPI_Allreduce (&(p), &global, 1, type, op, MPI_COMM_WORLD);	\
+        memcpy (&(p), &global, sizeof (p));				\
+      }									\
+    }
+#else
+    /* gfs_all_reduce() defaults to nothing without MPI */
+#    define gfs_all_reduce(domain, p, type, op)
+#  endif /* HAVE_MPI */
+#endif /* HAVE_CONFIG_H */
 
 #define GFS_DOUBLE_TO_POINTER(d)     (*((gpointer *) &(d)))
 
diff --git a/src/vof.c b/src/vof.c
index 45054a9..1e61d80 100644
--- a/src/vof.c
+++ b/src/vof.c
@@ -20,11 +20,6 @@
 #include <math.h>
 #include <stdlib.h>
 #include "vof.h"
-
-#include "config.h"
-#ifdef HAVE_MPI
-#  include "mpi_boundary.h"
-#endif
 #include "variable.h"
 #include "adaptive.h"
 #include "graphic.h"

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list