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

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


The following commit has been merged in the upstream branch:
commit afe7948a7cb5221232858eb8319b0ee8d785ede2
Author: Stephane Popinet <popinet at users.sf.net>
Date:   Fri May 9 17:06:54 2008 +1000

    gfs_domain_add_variable() takes a class parameter
    
    darcs-hash:20080509070654-d4795-16a7a2537b563e944bc4cc425495fc30ee0e6f64.gz

diff --git a/src/domain.c b/src/domain.c
index 6caa042..5bd7d41 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -141,7 +141,7 @@ static void domain_read (GtsObject ** o, GtsFile * fp)
     variables1 = g_strdup (variables);
     s = strtok (variables1, ",");
     while (s) {
-      gfs_domain_add_variable (domain, s, NULL);
+      gfs_domain_add_variable (domain, gfs_variable_class (), s, NULL);
       s = strtok (NULL, ",");
     }
     g_free (variables1);
@@ -2615,6 +2615,7 @@ void gfs_domain_free (GfsDomain * domain, guint i)
 /**
  * gfs_domain_add_variable:
  * @domain: a #GfsDomain.
+ * @klass: a #GfsVariableClass.
  * @name: the name of the variable to add or %NULL.
  * @description: the variable description or %NULL.
  *
@@ -2624,14 +2625,16 @@ void gfs_domain_free (GfsDomain * domain, guint i)
  * already exists.  
  */
 GfsVariable * gfs_domain_add_variable (GfsDomain * domain,
+				       gpointer klass,
 				       const gchar * name,
 				       const gchar * description)
 {
   GfsVariable * v;
 
   g_return_val_if_fail (domain != NULL, NULL);
+  g_return_val_if_fail (klass != NULL, NULL);
 
-  if ((v = gfs_variable_new (gfs_variable_class (), domain, name, description)) == NULL)
+  if ((v = gfs_variable_new (klass, domain, name, description)) == NULL)
     return NULL;
   domain->variables = g_slist_append (domain->variables, v);
   return v;
@@ -2666,7 +2669,7 @@ GfsVariable * gfs_domain_get_or_add_variable (GfsDomain * domain,
     v->description = description ? g_strdup (description) : NULL;
   }
   else
-    v = gfs_domain_add_variable (domain, name, description);
+    v = gfs_domain_add_variable (domain, gfs_variable_class (), name, description);
   return v;
 }
 
diff --git a/src/domain.h b/src/domain.h
index b0862d5..ce4b113 100644
--- a/src/domain.h
+++ b/src/domain.h
@@ -237,7 +237,8 @@ void         gfs_cell_write_binary            (const FttCell * cell,
 guint        gfs_domain_alloc                 (GfsDomain * domain);
 void         gfs_domain_free                  (GfsDomain * domain, 
 					       guint i);
-GfsVariable * gfs_domain_add_variable         (GfsDomain * domain, 
+GfsVariable * gfs_domain_add_variable         (GfsDomain * domain,
+					       gpointer klass,
 					       const gchar * name,
 					       const gchar * description);
 GfsVariable * gfs_domain_get_or_add_variable  (GfsDomain * domain,
diff --git a/src/event.c b/src/event.c
index 9b16a92..29ce776 100644
--- a/src/event.c
+++ b/src/event.c
@@ -1423,7 +1423,7 @@ static void gfs_event_stop_read (GtsObject ** o, GtsFile * fp)
   s->max = gfs_read_constant (fp, domain);
   if (fp->type == GTS_ERROR)      
     return;
-  s->oldv = gfs_domain_add_variable (domain, NULL, NULL);
+  s->oldv = gfs_domain_add_variable (domain, gfs_variable_class (), NULL, NULL);
   /* fixme: the lines below are necessary in the general case (e.g. when dealing with a VOF tracer)
    * but will crash if s->oldv is not of the same class as s->v.
    * s->oldv->fine_coarse = s->v->fine_coarse;
diff --git a/src/ocean.c b/src/ocean.c
index be09036..d1f2ee4 100644
--- a/src/ocean.c
+++ b/src/ocean.c
@@ -787,7 +787,7 @@ static void gfs_ocean_class_init (GfsSimulationClass * klass)
 
 static void gfs_ocean_init (GfsOcean * object)
 {
-  gfs_domain_add_variable (GFS_DOMAIN (object), "H", "Depth");
+  gfs_domain_add_variable (GFS_DOMAIN (object), gfs_variable_class (), "H", "Depth");
   GFS_SIMULATION (object)->approx_projection_params.weighted = 1;
   object->layer = g_ptr_array_new ();
   new_layer (object);
diff --git a/src/simulation.c b/src/simulation.c
index c31884a..e8b4635 100644
--- a/src/simulation.c
+++ b/src/simulation.c
@@ -815,15 +815,17 @@ static void simulation_init (GfsSimulation * object)
     { NULL, NULL, NULL}
   };
 
-  gfs_domain_add_variable (domain, "P", "Approximate projection pressure")->centered = TRUE;
-  gfs_domain_add_variable (domain, "Pmac", "MAC projection pressure")->centered = TRUE;
-  gfs_variable_set_vector (gfs_domain_add_variable (domain, "U", 
-						    "x-component of the velocity"), FTT_X);
-  gfs_variable_set_vector (gfs_domain_add_variable (domain, "V",
-						    "y-component of the velocity"), FTT_Y);
+  gfs_domain_add_variable (domain, gfs_variable_class (),
+			   "P", "Approximate projection pressure")->centered = TRUE;
+  gfs_domain_add_variable (domain, gfs_variable_class (),
+			   "Pmac", "MAC projection pressure")->centered = TRUE;
+  gfs_variable_set_vector (gfs_domain_add_variable (domain, gfs_variable_class (),
+						    "U", "x-component of the velocity"), FTT_X);
+  gfs_variable_set_vector (gfs_domain_add_variable (domain, gfs_variable_class (),
+						    "V", "y-component of the velocity"), FTT_Y);
 #if (!FTT_2D)
-  gfs_variable_set_vector (gfs_domain_add_variable (domain, "W",
-						    "z-component of the velocity"), FTT_Z);
+  gfs_variable_set_vector (gfs_domain_add_variable (domain, gfs_variable_class (),
+						    "W", "z-component of the velocity"), FTT_Z);
 #endif /* FTT_3D */
 
   GfsDerivedVariableInfo * v = derived_variable;
@@ -1689,7 +1691,8 @@ static void poisson_class_init (GfsSimulationClass * klass)
 
 static void poisson_init (GfsDomain * domain)
 {
-  gfs_domain_add_variable (domain, "Div", "Right-hand-side of the Poisson equation");
+  gfs_domain_add_variable (domain, gfs_variable_class (),
+			   "Div", "Right-hand-side of the Poisson equation");
 }
 
 GfsSimulationClass * gfs_poisson_class (void)
diff --git a/src/tension.c b/src/tension.c
index 5936c1d..afebeb4 100644
--- a/src/tension.c
+++ b/src/tension.c
@@ -145,7 +145,7 @@ static void gfs_source_tension_css_read (GtsObject ** o, GtsFile * fp)
   for (c = 0; c < FTT_DIMENSION; c++) {
     static gchar * name[3] = {"_Tx", "_Ty", "_Tz"};
     if ((s->t[c] = gfs_variable_from_name (domain->variables, name[c])) == NULL)
-      s->t[c] = gfs_domain_add_variable (domain, name[c], NULL);
+      s->t[c] = gfs_domain_add_variable (domain, gfs_variable_class (), name[c], NULL);
   }
 }
 

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list