[cig-commits] r5887 - in mc/3D/CitcomS/trunk: CitcomS/Components/Advection_diffusion bin lib

tan2 at geodynamics.org tan2 at geodynamics.org
Wed Jan 24 17:38:10 PST 2007


Author: tan2
Date: 2007-01-24 17:38:10 -0800 (Wed, 24 Jan 2007)
New Revision: 5887

Modified:
   mc/3D/CitcomS/trunk/CitcomS/Components/Advection_diffusion/Advection_diffusion.py
   mc/3D/CitcomS/trunk/bin/Citcom.c
   mc/3D/CitcomS/trunk/lib/Advection_diffusion.c
   mc/3D/CitcomS/trunk/lib/Convection.c
   mc/3D/CitcomS/trunk/lib/Solver_multigrid.c
   mc/3D/CitcomS/trunk/lib/global_defs.h
Log:
Get rid of static variables

Modified: mc/3D/CitcomS/trunk/CitcomS/Components/Advection_diffusion/Advection_diffusion.py
===================================================================
--- mc/3D/CitcomS/trunk/CitcomS/Components/Advection_diffusion/Advection_diffusion.py	2007-01-25 00:57:21 UTC (rev 5886)
+++ mc/3D/CitcomS/trunk/CitcomS/Components/Advection_diffusion/Advection_diffusion.py	2007-01-25 01:38:10 UTC (rev 5887)
@@ -54,7 +54,6 @@
     def setup(self):
         from CitcomSLib import set_convection_defaults
         set_convection_defaults(self.all_variables)
-	self._been_here = False
 	return
 
 

Modified: mc/3D/CitcomS/trunk/bin/Citcom.c
===================================================================
--- mc/3D/CitcomS/trunk/bin/Citcom.c	2007-01-25 00:57:21 UTC (rev 5886)
+++ mc/3D/CitcomS/trunk/bin/Citcom.c	2007-01-25 01:38:10 UTC (rev 5887)
@@ -58,6 +58,7 @@
   void read_mat_from_file();
   void open_time();
   void output_finalize();
+  void PG_timestep_init();
 
   float dot();
   float cpu_time_on_vp_it;
@@ -120,6 +121,8 @@
     parallel_process_termination();
   }
 
+  (E->next_buoyancy_field_init)(E);
+
   while ( E->control.keep_going   &&  (Emergency_stop == 0) )   {
 
     /* The next few lines of code were replaced by

Modified: mc/3D/CitcomS/trunk/lib/Advection_diffusion.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Advection_diffusion.c	2007-01-25 00:57:21 UTC (rev 5886)
+++ mc/3D/CitcomS/trunk/lib/Advection_diffusion.c	2007-01-25 01:38:10 UTC (rev 5887)
@@ -219,13 +219,6 @@
 
 void PG_timestep(struct All_variables *E)
 {
-  static int been_here = 0;
-
-  /* TODO: get rid of static variable */
-  if (been_here++ ==0)    {
-    PG_timestep_init(E);
-  }
-
   std_timestep(E);
 
   PG_timestep_solve(E);

Modified: mc/3D/CitcomS/trunk/lib/Convection.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Convection.c	2007-01-25 00:57:21 UTC (rev 5886)
+++ mc/3D/CitcomS/trunk/lib/Convection.c	2007-01-25 01:38:10 UTC (rev 5887)
@@ -39,8 +39,8 @@
 void set_convection_defaults(E)
      struct All_variables *E;
 {
-    void PG_timestep_with_melting();
     void PG_timestep();
+    void PG_timestep_init();
     void read_convection_settings();
     void convection_derived_values();
     void convection_allocate_memory();
@@ -58,6 +58,7 @@
     E->monitor.T_maxvaried = 1.05;
 
     E->next_buoyancy_field = PG_timestep;
+    E->next_buoyancy_field_init = PG_timestep_init;
     E->special_process_new_buoyancy = twiddle_thumbs;
     E->problem_settings = read_convection_settings;
     E->problem_derived_values = convection_derived_values;

Modified: mc/3D/CitcomS/trunk/lib/Solver_multigrid.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Solver_multigrid.c	2007-01-25 00:57:21 UTC (rev 5886)
+++ mc/3D/CitcomS/trunk/lib/Solver_multigrid.c	2007-01-25 01:38:10 UTC (rev 5887)
@@ -1,6 +1,6 @@
 /*
  *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- * 
+ *
  *<LicenseText>
  *
  * CitcomS by Louis Moresi, Shijie Zhong, Lijie Han, Eh Tan,
@@ -22,21 +22,13 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  *</LicenseText>
- * 
+ *
  *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  */
 #include "element_definitions.h"
 #include "global_defs.h"
 #include <math.h>
 
-/*
-static double weightIJ[5][5] =
-        {       { 0.0,    0.0,    0.0,    0.0,    0.0 },
-		{ 0.0, 0.5625, 0.1875, 0.0625, 0.1875 },
-		{ 0.0, 0.1875, 0.5625, 0.1875, 0.0625 },
-		{ 0.0, 0.0625, 0.1875, 0.5625, 0.1875 },
-		{ 0.0, 0.1875, 0.0625, 0.1875, 0.5625 } };
-*/
 
 void set_mg_defaults(E)
      struct All_variables *E;

Modified: mc/3D/CitcomS/trunk/lib/global_defs.h
===================================================================
--- mc/3D/CitcomS/trunk/lib/global_defs.h	2007-01-25 00:57:21 UTC (rev 5886)
+++ mc/3D/CitcomS/trunk/lib/global_defs.h	2007-01-25 01:38:10 UTC (rev 5887)
@@ -767,6 +767,7 @@
     void (* build_forcing_term)(void*);
     void (* iterative_solver)(void*);
     void (* next_buoyancy_field)(void*);
+    void (* next_buoyancy_field_init)(void*);
     void (* obtain_gravity)(void*);
     void (* problem_settings)(void*);
     void (* problem_derived_values)(void*);



More information about the cig-commits mailing list