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

Stephane Popinet popinet at users.sourceforge.net
Fri May 15 02:51:22 UTC 2009


The following commit has been merged in the upstream branch:
commit a46ca7844949497892d4e6564a133dc43d093cb4
Author: Stephane Popinet <popinet at users.sourceforge.net>
Date:   Wed Nov 3 14:06:02 2004 +1100

    New class GfsRemovePonds (gerris--mainline--0.7--patch-25)
    
    gerris--mainline--0.7--patch-25
    Keywords:
    
    Removes small "ponds" from the domain.
    
    darcs-hash:20041103030602-aabb8-c23864cea85443d345ffd9b8fcf701b3c614caa6.gz

diff --git a/doc/gfs-sections.txt b/doc/gfs-sections.txt
index 9a66a82..cf97fff 100644
--- a/doc/gfs-sections.txt
+++ b/doc/gfs-sections.txt
@@ -323,7 +323,7 @@ gfs_domain_read
 gfs_domain_split
 gfs_domain_variable_sources
 gfs_domain_remove_droplets
-gfs_domain_remove_islands
+gfs_domain_remove_ponds
 gfs_domain_advect_point
 gfs_domain_cfl
 gfs_domain_size
diff --git a/src/domain.c b/src/domain.c
index 957af17..c61dfc6 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -2523,20 +2523,20 @@ static void remove_small_box (GfsBox * box, gpointer * data)
 }
 
 /**
- * gfs_domain_remove_islands:
+ * gfs_domain_remove_ponds:
  * @domain: a #GfsDomain.
- * @min: the minimum size (in cells) of the islands.
+ * @min: the minimum size (in cells) of the ponds.
  * @cleanup: a #FttCellCleanupFunc or %NULL.
  * @data: user data to pass to @cleanup.
  *
- * Removes all the fluid "islands" of @domain smaller than @min cells
- * if @min is positive, or all the islands but the - at min largest ones
+ * Removes all the fluid "ponds" of @domain smaller than @min cells
+ * if @min is positive, or all the ponds but the - at min largest ones
  * if @min is negative.
  */
-void gfs_domain_remove_islands (GfsDomain * domain, 
-				gint min,
-				FttCellCleanupFunc cleanup,
-				gpointer data)
+void gfs_domain_remove_ponds (GfsDomain * domain, 
+			      gint min,
+			      FttCellCleanupFunc cleanup,
+			      gpointer data)
 {
   GArray * sizes;
   gpointer dat[4];
diff --git a/src/domain.h b/src/domain.h
index 6cc3880..99465d3 100644
--- a/src/domain.h
+++ b/src/domain.h
@@ -204,7 +204,7 @@ void         gfs_domain_solid_force           (GfsDomain * domain,
 void         gfs_domain_remove_droplets       (GfsDomain * domain,
 					       GfsVariable * c,
 					       gint min);
-void         gfs_domain_remove_islands        (GfsDomain * domain, 
+void         gfs_domain_remove_ponds          (GfsDomain * domain, 
 					       gint min,
 					       FttCellCleanupFunc cleanup,
 					       gpointer data);
diff --git a/src/event.c b/src/event.c
index 259cc66..b2aff93 100644
--- a/src/event.c
+++ b/src/event.c
@@ -551,7 +551,8 @@ static void init_f (GfsVariable * v, GfsFunction * f, GfsDomain * domain)
 
 static gboolean gfs_init_event (GfsEvent * event, GfsSimulation * sim)
 {
-  if ((* GFS_EVENT_CLASS (GTS_OBJECT_CLASS (gfs_init_class ())->parent_class)->event) (event, sim)) {
+  if ((* GFS_EVENT_CLASS (GTS_OBJECT_CLASS (gfs_init_class ())->parent_class)->event) 
+      (event, sim)) {
     g_hash_table_foreach (GFS_INIT (event)->f, (GHFunc) init_f, sim);
     return TRUE;
   }
@@ -1301,7 +1302,8 @@ GfsInitFractionClass * gfs_init_fraction_class (void)
 
 static gboolean gfs_remove_droplets_event (GfsEvent * event, GfsSimulation * sim)
 {
-  if ((* GFS_EVENT_CLASS (GTS_OBJECT_CLASS (gfs_remove_droplets_class ())->parent_class)->event) (event, sim)) {
+  if ((* GFS_EVENT_CLASS (GTS_OBJECT_CLASS (gfs_remove_droplets_class ())->parent_class)->event) 
+      (event, sim)) {
     gfs_domain_remove_droplets (GFS_DOMAIN (sim), 
 				GFS_REMOVE_DROPLETS (event)->c, 
 				GFS_REMOVE_DROPLETS (event)->min);
@@ -1375,3 +1377,67 @@ GfsEventClass * gfs_remove_droplets_class (void)
 
   return klass;
 }
+
+/* GfsRemovePonds: Object */
+
+static gboolean gfs_remove_ponds_event (GfsEvent * event, GfsSimulation * sim)
+{
+  if ((* GFS_EVENT_CLASS (GTS_OBJECT_CLASS (gfs_remove_ponds_class ())->parent_class)->event) 
+      (event, sim)) {
+    gfs_domain_remove_ponds (GFS_DOMAIN (sim), GFS_REMOVE_PONDS (event)->min,
+			     (FttCellCleanupFunc) gfs_cell_cleanup, NULL);
+    return TRUE;
+  }
+  return FALSE;
+}
+
+static void gfs_remove_ponds_read (GtsObject ** o, GtsFile * fp)
+{
+  if (GTS_OBJECT_CLASS (gfs_remove_ponds_class ())->parent_class->read)
+    (* GTS_OBJECT_CLASS (gfs_remove_ponds_class ())->parent_class->read) 
+      (o, fp);
+  if (fp->type == GTS_ERROR)
+    return;
+
+  if (fp->type != GTS_INT) {
+    gts_file_error (fp, "expecting an integer (min)");
+    return;
+  }
+  GFS_REMOVE_PONDS (*o)->min = atoi (fp->token->str);
+  gts_file_next_token (fp);
+}
+
+static void gfs_remove_ponds_write (GtsObject * o, FILE * fp)
+{
+  if (GTS_OBJECT_CLASS (gfs_remove_ponds_class ())->parent_class->write)
+    (* GTS_OBJECT_CLASS (gfs_remove_ponds_class ())->parent_class->write) (o, fp);
+  fprintf (fp, " %d", GFS_REMOVE_PONDS (o)->min);
+}
+
+static void gfs_remove_ponds_class_init (GfsEventClass * klass)
+{
+  GFS_EVENT_CLASS (klass)->event = gfs_remove_ponds_event;
+  GTS_OBJECT_CLASS (klass)->read = gfs_remove_ponds_read;
+  GTS_OBJECT_CLASS (klass)->write = gfs_remove_ponds_write;
+}
+
+GfsEventClass * gfs_remove_ponds_class (void)
+{
+  static GfsEventClass * klass = NULL;
+
+  if (klass == NULL) {
+    GtsObjectClassInfo gfs_remove_ponds_info = {
+      "GfsRemovePonds",
+      sizeof (GfsRemovePonds),
+      sizeof (GfsEventClass),
+      (GtsObjectClassInitFunc) gfs_remove_ponds_class_init,
+      (GtsObjectInitFunc) NULL,
+      (GtsArgSetFunc) NULL,
+      (GtsArgGetFunc) NULL
+    };
+    klass = gts_object_class_new (GTS_OBJECT_CLASS (gfs_generic_init_class ()),
+				  &gfs_remove_ponds_info);
+  }
+
+  return klass;
+}
diff --git a/src/event.h b/src/event.h
index 49a19f0..6bd985b 100644
--- a/src/event.h
+++ b/src/event.h
@@ -252,6 +252,26 @@ struct _GfsRemoveDroplets {
 
 GfsEventClass * gfs_remove_droplets_class  (void);
 
+/* GfsRemovePonds: Header */
+
+typedef struct _GfsRemovePonds         GfsRemovePonds;
+
+struct _GfsRemovePonds {
+  /*< private >*/
+  GfsGenericInit parent;
+
+  /*< public >*/
+  gint min;
+};
+
+#define GFS_REMOVE_PONDS(obj)            GTS_OBJECT_CAST (obj,\
+					         GfsRemovePonds,\
+					         gfs_remove_ponds_class ())
+#define GFS_IS_REMOVE_PONDS(obj)         (gts_object_is_from_class (obj,\
+						 gfs_remove_ponds_class ()))
+
+GfsEventClass * gfs_remove_ponds_class  (void);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/src/init.c b/src/init.c
index aae1db5..3765d7e 100644
--- a/src/init.c
+++ b/src/init.c
@@ -267,6 +267,7 @@ void gfs_init (int * argc, char *** argv)
             gfs_source_vector_class ();
         gfs_source_tension_class ();
     gfs_remove_droplets_class ();
+    gfs_remove_ponds_class ();
    
     gfs_output_class ();
       gfs_output_time_class ();

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list