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

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


The following commit has been merged in the upstream branch:
commit 41016d5899e29e80faa16425fa66adf42882f3f8
Author: Stephane Popinet <popinet at users.sourceforge.net>
Date:   Tue Nov 16 11:33:03 2004 +1100

    Option not to output solid surface in GfsOutputSimulation (gerris--ocean--0.7--patch-13)
    
    gerris--ocean--0.7--patch-13
    Keywords:
    
    darcs-hash:20041116003303-aabb8-f5bbe3280cb5cefedde462129ac869e8c2de8538.gz

diff --git a/doc/tmpl/output_simulation.sgml b/doc/tmpl/output_simulation.sgml
index d8ebcf6..683a7b1 100644
--- a/doc/tmpl/output_simulation.sgml
+++ b/doc/tmpl/output_simulation.sgml
@@ -12,7 +12,7 @@ GfsOutputSimulation will write a description of the current state of the simulat
 The syntax in parameter files is as follows:
 <informalexample>
 <programlisting>
-[ #GfsOutput ] { depth = 5 variables = U,V,C binary = 1 }
+[ #GfsOutput ] { depth = 5 variables = U,V,C binary = 1 surface = 0 }
 </programlisting>
 </informalexample>
 with
@@ -37,6 +37,11 @@ with
 <entry>An optional parameter specifying if a binary format should be used. Binary files allow faster reading of simulation files. The default is a more portable ASCII format.</entry>
 </row>
 
+<row>
+<entry><structfield>surface</structfield></entry>
+<entry>An optional parameter specifying if the surface describing solid boundaries should be included in the simulation file. The default is to include the solid surface.</entry>
+</row>
+
 </tbody></tgroup></informaltable>
 </para>
 
diff --git a/src/output.c b/src/output.c
index 44f9e29..ef32fcd 100644
--- a/src/output.c
+++ b/src/output.c
@@ -707,7 +707,8 @@ GfsOutputClass * gfs_output_diffusion_stats_class (void)
 static gboolean gfs_output_solid_stats_event (GfsEvent * event, 
 					     GfsSimulation * sim)
 {
-  if ((* GFS_EVENT_CLASS (GTS_OBJECT_CLASS (gfs_output_solid_stats_class ())->parent_class)->event) (event, sim)) {
+  if ((* GFS_EVENT_CLASS (GTS_OBJECT_CLASS (gfs_output_solid_stats_class ())->parent_class)->event)
+      (event, sim)) {
     GtsRange stats = gfs_domain_stats_solid (GFS_DOMAIN (sim));
     GtsRange ma, mn;
 
@@ -758,7 +759,8 @@ GfsOutputClass * gfs_output_solid_stats_class (void)
 static gboolean gfs_output_adapt_stats_event (GfsEvent * event, 
 					      GfsSimulation * sim)
 {
-  if ((* GFS_EVENT_CLASS (GTS_OBJECT_CLASS (gfs_output_adapt_stats_class ())->parent_class)->event) (event, sim)) {
+  if ((* GFS_EVENT_CLASS (GTS_OBJECT_CLASS (gfs_output_adapt_stats_class ())->parent_class)->event)
+      (event, sim)) {
     gfs_adapt_stats_update (&sim->adapts_stats);
     fprintf (GFS_OUTPUT (event)->file->fp,
 	     "Adaptive mesh refinement statistics\n"
@@ -834,15 +836,6 @@ static void timing_print (GtsRange * r, gdouble total, FILE * fp)
 	   r->max);	   
 }
 
-static void timing_bc_print (GtsRange * r, gdouble total, guint n, FILE * fp)
-{
-  fprintf (fp,
-	   "      calls: %7d avg: %9.3f (%4.1f%%)\n",
-	   r->n,
-	   n > 0 ? r->sum/n : 0.,
-	   total > 0. ? 100.*r->sum/total : 0.);
-}
-
 static void timer_print (gchar * name, GfsTimer * t, gpointer * data)
 {
   FILE * fp = data[0];
@@ -923,7 +916,8 @@ GfsOutputClass * gfs_output_timing_class (void)
 static gboolean gfs_output_balance_event (GfsEvent * event, 
 					  GfsSimulation * sim)
 {
-  if ((* GFS_EVENT_CLASS (GTS_OBJECT_CLASS (gfs_output_balance_class ())->parent_class)->event) (event, sim)) {
+  if ((* GFS_EVENT_CLASS (GTS_OBJECT_CLASS (gfs_output_balance_class ())->parent_class)->event)
+      (event, sim)) {
     GfsDomain * domain = GFS_DOMAIN (sim);
     FILE * fp = GFS_OUTPUT (event)->file->fp;
     GtsRange size, boundary, mpiwait;
@@ -1153,24 +1147,27 @@ static void output_simulation_destroy (GtsObject * object)
 
   gfs_variable_list_destroy (output->var);
 
-  (* GTS_OBJECT_CLASS (gfs_output_simulation_class ())->parent_class->destroy) 
-    (object);
+  (* GTS_OBJECT_CLASS (gfs_output_simulation_class ())->parent_class->destroy) (object);
 }
 
 static gboolean output_simulation_event (GfsEvent * event, GfsSimulation * sim)
 {
   if ((* GFS_EVENT_CLASS (gfs_output_class())->event) (event, sim)) {
     GfsDomain * domain = GFS_DOMAIN (sim);
+    GfsOutputSimulation * output = GFS_OUTPUT_SIMULATION (event);
     GfsVariable * var = domain->variables_io;
     gboolean binary = domain->binary;
+    gboolean surface = sim->output_surface;
 
-    domain->variables_io = GFS_OUTPUT_SIMULATION (event)->var;
-    domain->binary = GFS_OUTPUT_SIMULATION (event)->binary;
+    domain->variables_io = output->var;
+    domain->binary =       output->binary;
+    sim->output_surface =  output->surface;
     gfs_simulation_write (sim,
-			  GFS_OUTPUT_SIMULATION (event)->max_depth,
+			  output->max_depth,
 			  GFS_OUTPUT (event)->file->fp);
     domain->variables_io = var;
-    domain->binary = binary;
+    domain->binary =       binary;
+    sim->output_surface =  surface;
     fflush (GFS_OUTPUT (event)->file->fp);
     return TRUE;
   }
@@ -1198,15 +1195,18 @@ static void output_simulation_write (GtsObject * o, FILE * fp)
   }
   if (output->binary)
     fputs (" binary = 1", fp);
+  if (!output->surface)
+    fputs (" surface = 0", fp);
   fputs (" }", fp);
 }
 
 static void output_simulation_read (GtsObject ** o, GtsFile * fp)
 {
   GtsFileVariable var[] = {
-    {GTS_INT,    "depth",     TRUE},
-    {GTS_STRING, "variables", TRUE},
-    {GTS_INT,    "binary",    TRUE},
+    {GTS_INT,    "depth",    TRUE},
+    {GTS_STRING, "variables",TRUE},
+    {GTS_INT,    "binary",   TRUE},
+    {GTS_INT,    "surface",  TRUE},
     {GTS_NONE}
   };
   gchar * variables = NULL;
@@ -1221,6 +1221,7 @@ static void output_simulation_read (GtsObject ** o, GtsFile * fp)
   var[0].data = &output->max_depth;
   var[1].data = &variables;
   var[2].data = &output->binary;
+  var[3].data = &output->surface;
   gts_file_assign_variables (fp, var);
   if (fp->type == GTS_ERROR) {
     g_free (variables);
@@ -1260,6 +1261,8 @@ static void gfs_output_simulation_init (GfsOutputSimulation * object)
 {
   object->max_depth = -1;
   object->var = NULL;
+  object->binary = 0;
+  object->surface = 1;
 }
 
 GfsOutputClass * gfs_output_simulation_class (void)
@@ -1567,7 +1570,8 @@ GfsOutputClass * gfs_output_scalar_class (void)
 static gboolean gfs_output_scalar_norm_event (GfsEvent * event, 
 					      GfsSimulation * sim)
 {
-  if ((* GFS_EVENT_CLASS (GTS_OBJECT_CLASS (gfs_output_scalar_norm_class ())->parent_class)->event) (event, sim)) {
+  if ((* GFS_EVENT_CLASS (GTS_OBJECT_CLASS (gfs_output_scalar_norm_class ())->parent_class)->event)
+      (event, sim)) {
     GfsOutputScalar * output = GFS_OUTPUT_SCALAR (event);
     GfsNorm norm = gfs_domain_norm_variable (GFS_DOMAIN (sim), 
 					     output->v,
@@ -1615,7 +1619,8 @@ GfsOutputClass * gfs_output_scalar_norm_class (void)
 static gboolean gfs_output_scalar_stats_event (GfsEvent * event, 
 					     GfsSimulation * sim)
 {
-  if ((* GFS_EVENT_CLASS (GTS_OBJECT_CLASS (gfs_output_scalar_stats_class ())->parent_class)->event) (event, sim)) {
+  if ((* GFS_EVENT_CLASS (GTS_OBJECT_CLASS (gfs_output_scalar_stats_class ())->parent_class)->event)
+      (event, sim)) {
     GfsOutputScalar * output = GFS_OUTPUT_SCALAR (event);
     GtsRange stats = gfs_domain_stats_variable (GFS_DOMAIN (sim), 
 						output->v,
@@ -1673,7 +1678,8 @@ static void add (FttCell * cell, gpointer * data)
 static gboolean gfs_output_scalar_sum_event (GfsEvent * event, 
 					     GfsSimulation * sim)
 {
-  if ((* GFS_EVENT_CLASS (GTS_OBJECT_CLASS (gfs_output_scalar_sum_class ())->parent_class)->event) (event, sim)) {
+  if ((* GFS_EVENT_CLASS (GTS_OBJECT_CLASS (gfs_output_scalar_sum_class ())->parent_class)->event)
+      (event, sim)) {
     GfsOutputScalar * output = GFS_OUTPUT_SCALAR (event);
     gpointer data[2];
     gdouble sum = 0.;
@@ -2083,7 +2089,8 @@ GfsOutputClass * gfs_output_correlation_class (void)
 
 static gboolean gfs_output_squares_event (GfsEvent * event, GfsSimulation * sim)
 {
-  if ((* GFS_EVENT_CLASS (GTS_OBJECT_CLASS (gfs_output_squares_class ())->parent_class)->event) (event, sim)) {
+  if ((* GFS_EVENT_CLASS (GTS_OBJECT_CLASS (gfs_output_squares_class ())->parent_class)->event)
+      (event, sim)) {
     GfsOutputScalar * output = GFS_OUTPUT_SCALAR (event);
     
     gfs_write_squares (GFS_DOMAIN (sim), 
@@ -2170,7 +2177,8 @@ static void gfs_output_streamline_write (GtsObject * o, FILE * fp)
 static gboolean gfs_output_streamline_event (GfsEvent * event, 
 					    GfsSimulation * sim)
 {
-  if ((* GFS_EVENT_CLASS (GTS_OBJECT_CLASS (gfs_output_streamline_class ())->parent_class)->event) (event,sim)) {
+  if ((* GFS_EVENT_CLASS (GTS_OBJECT_CLASS (gfs_output_streamline_class ())->parent_class)->event)
+      (event,sim)) {
     GSList * stream = gfs_streamline_new (GFS_DOMAIN (sim),
 					  GFS_OUTPUT_STREAMLINE (event)->p,
 					  GFS_OUTPUT_SCALAR (event)->v,
diff --git a/src/output.h b/src/output.h
index a4d80ad..7cb6bd5 100644
--- a/src/output.h
+++ b/src/output.h
@@ -132,7 +132,7 @@ struct _GfsOutputSimulation {
 
   gint max_depth;
   GfsVariable * var;
-  gboolean binary;
+  gboolean binary, surface;
 };
 
 #define GFS_OUTPUT_SIMULATION(obj)            GTS_OBJECT_CAST (obj,\
diff --git a/src/simulation.c b/src/simulation.c
index 67e5f8b..bd80d0f 100644
--- a/src/simulation.c
+++ b/src/simulation.c
@@ -149,7 +149,7 @@ static void simulation_write (GtsObject * object, FILE * fp)
     i = i->next;
   }
 
-  if (sim->surface) {
+  if (sim->surface && sim->output_surface) {
     fputs ("  GtsSurface { ", fp);
     if (GFS_DOMAIN (sim)->binary) {
       gboolean binary = GTS_POINT_CLASS (sim->surface->vertex_class)->binary;
@@ -635,6 +635,7 @@ static void gfs_simulation_init (GfsSimulation * object)
   gfs_multilevel_params_init (&object->approx_projection_params);
 
   object->surface = NULL;
+  object->output_surface = TRUE;
 
   object->interface = NULL;
   object->itree = NULL;
diff --git a/src/simulation.h b/src/simulation.h
index d048756..69203cb 100644
--- a/src/simulation.h
+++ b/src/simulation.h
@@ -65,6 +65,7 @@ struct _GfsSimulation {
   GfsMultilevelParams diffusion_params;
 
   GtsSurface * surface;
+  gboolean output_surface;
 
   GtsSurface * interface;
   GNode * itree;

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list