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

Stephane Popinet popinet at users.sf.net
Tue Nov 24 12:24:48 UTC 2009


The following commit has been merged in the upstream branch:
commit a417a38ec1cf0df03015b0fce206b70701c81884
Author: Stephane Popinet <popinet at users.sf.net>
Date:   Fri Jul 24 11:22:56 2009 +1000

    Added option to use "bubble partitioning"
    
    darcs-hash:20090724012256-d4795-03d7647e1771b86e8af9bb7e6c2af4cfaf64d581.gz

diff --git a/src/gerris.c b/src/gerris.c
index 0644779..be85be5 100644
--- a/src/gerris.c
+++ b/src/gerris.c
@@ -64,7 +64,7 @@ int main (int argc, char * argv[])
   int c = 0;
   guint split = 0;
   guint npart = 0;
-  gboolean profile = FALSE, macros = FALSE, one_box_per_pe = TRUE;
+  gboolean profile = FALSE, macros = FALSE, one_box_per_pe = TRUE, bubble = FALSE, verbose = FALSE;
   gchar * m4_options = g_strdup ("-P");
   GPtrArray * events = g_ptr_array_new ();
   gint maxlevel = -2;
@@ -83,15 +83,17 @@ int main (int argc, char * argv[])
       {"macros", no_argument, NULL, 'm'},
       {"data", no_argument, NULL, 'd'},
       {"event", required_argument, NULL, 'e'},
+      {"bubble", required_argument, NULL, 'b'},
+      {"verbose", no_argument, NULL, 'v'},
       {"help", no_argument, NULL, 'h'},
       {"version", no_argument, NULL, 'V'},
       { NULL }
     };
     int option_index = 0;
-    switch ((c = getopt_long (argc, argv, "hVs:ip:PD:mde:",
+    switch ((c = getopt_long (argc, argv, "hVs:ip:PD:mde:b:v",
 			      long_options, &option_index))) {
 #else /* not HAVE_GETOPT_LONG */
-    switch ((c = getopt (argc, argv, "hVs:ip:PD:mde:"))) {
+    switch ((c = getopt (argc, argv, "hVs:ip:PD:mde:b:v"))) {
 #endif /* not HAVE_GETOPT_LONG */
     case 'P': /* profile */
       profile = TRUE;
@@ -99,6 +101,10 @@ int main (int argc, char * argv[])
     case 'p': /* partition */
       npart = atoi (optarg);
       break;
+    case 'b': /* "bubble" partition */
+      npart = atoi (optarg);
+      bubble = TRUE;
+      break;
     case 's': /* split */
       split = atoi (optarg);
       break;
@@ -120,6 +126,9 @@ int main (int argc, char * argv[])
     case 'e': /* event */
       g_ptr_array_add (events, g_strdup (optarg));
       break;
+    case 'v': /* verbose */
+      verbose = TRUE;
+      break;
     case 'h': /* help */
       gfs_error (0,
              "Usage: gerris [OPTION] FILE\n"
@@ -130,6 +139,8 @@ int main (int argc, char * argv[])
 	     "  -i     --pid         keep box pids when splitting\n"
              "  -p N   --partition=N partition the domain in 2^N subdomains and returns\n" 
              "                       the corresponding simulation\n"
+             "  -b N   --bubble=N    partition the domain in N subdomains and returns\n" 
+             "                       the corresponding simulation\n"
 	     "  -d     --data        when splitting or partitioning, output all data\n"
 	     "  -P     --profile     profiles calls to boundary conditions\n"
 #ifdef HAVE_M4
@@ -140,6 +151,7 @@ int main (int argc, char * argv[])
              "         --define=NAME=VALUE\n"
 #endif /* have m4 */
 	     "  -eEV   --event=EV    Evaluates GfsEvent EV and returns the simulation\n"
+	     "  -v     --verbose     Display more messages\n"
 	     "  -h     --help        display this help and exit\n"
 	     "  -V     --version     output version information and exit\n"
 	     "\n"
@@ -237,21 +249,30 @@ int main (int argc, char * argv[])
     guint nmin = 1000;
     guint mmax = 10000;
     guint ntry = 10000;
+    guint np = bubble ? npart : pow (2., npart);
     gfloat imbalance = 0.0;
     GSList * partition, * i;
     gint pid = 0;
 
-    gts_graph_print_stats (GTS_GRAPH (simulation), stderr);
-    if (gts_container_size (GTS_CONTAINER (simulation)) < pow (2., npart)) {
+    if (verbose)
+      gts_graph_print_stats (GTS_GRAPH (simulation), stderr);
+    if (gts_container_size (GTS_CONTAINER (simulation)) < np) {
       fprintf (stderr,
-	       "gerris: the number of boxes in the domain to partition should be >= 2^N\n"
+	       "gerris: the number of boxes in the domain to partition should be >= %d\n"
 	       "Use option '-s' to split the domain first\n"
-	       "Try `gerris --help' for more information.\n");
+	       "Try `gerris --help' for more information.\n",
+	       np);
       return 1;
     }
-    partition = gts_graph_recursive_bisection (GTS_WGRAPH (simulation),
-					       npart, 
-					       ntry, mmax, nmin, imbalance);
+    if (bubble)
+      partition = gts_graph_bubble_partition (GTS_GRAPH (simulation), npart, 100, 
+					      verbose ? 
+					      (GtsFunc) gts_graph_partition_print_stats : NULL, 
+					      stderr);
+    else
+      partition = gts_graph_recursive_bisection (GTS_WGRAPH (simulation),
+						 npart, 
+						 ntry, mmax, nmin, imbalance);
 
     i = partition;
     while (i) {
@@ -260,7 +281,8 @@ int main (int argc, char * argv[])
       pid++;
       i = i->next;
     }
-    gts_graph_partition_print_stats (partition, stderr);
+    if (verbose)
+      gts_graph_partition_print_stats (partition, stderr);
     gts_graph_partition_destroy (partition);
     gfs_simulation_write (simulation, maxlevel, stdout);
     return 0;

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list