[Avida-SVN] r1855 - development/source/main

baerb at myxo.css.msu.edu baerb at myxo.css.msu.edu
Fri Jul 27 11:22:28 PDT 2007


Author: baerb
Date: 2007-07-27 14:22:28 -0400 (Fri, 27 Jul 2007)
New Revision: 1855

Modified:
   development/source/main/cAvidaConfig.h
   development/source/main/cOrganism.cc
   development/source/main/cPopulation.cc
   development/source/main/cResourceCount.cc
   development/source/main/cSpatialResCount.cc
   development/source/main/cStats.cc
Log:

Changed code so that global resource count no longer contains the sum of 
recesource from spatial resource.  Insead do the sum only for reporting in the
resource.dat file.





Modified: development/source/main/cAvidaConfig.h
===================================================================
--- development/source/main/cAvidaConfig.h	2007-07-27 17:07:05 UTC (rev 1854)
+++ development/source/main/cAvidaConfig.h	2007-07-27 18:22:28 UTC (rev 1855)
@@ -189,7 +189,7 @@
   CONFIG_ADD_VAR(ANALYZE_MODE, int, 0, "0 = Disabled\n1 = Enabled\n2 = Interactive");
   CONFIG_ADD_VAR(VIEW_MODE, int, 1, "Initial viewer screen");
   CONFIG_ADD_VAR(CLONE_FILE, cString, "-", "Clone file to load");
-  CONFIG_ADD_VAR(VERBOSITY, int, 1, "Control output verbosity");
+  CONFIG_ADD_VAR(VERBOSITY, int, 1, "0 = No output at all\n1=Normal output\n2 = Verbose output, detailing progress\n3 = High level of details, as available\n4 = Print Debug Information, as applicable");
   
   CONFIG_ADD_GROUP(ARCH_GROUP, "Architecture Variables");
   CONFIG_ADD_VAR(WORLD_X, int, 60, "Width of the Avida world");

Modified: development/source/main/cOrganism.cc
===================================================================
--- development/source/main/cOrganism.cc	2007-07-27 17:07:05 UTC (rev 1854)
+++ development/source/main/cOrganism.cc	2007-07-27 18:22:28 UTC (rev 1855)
@@ -234,7 +234,7 @@
       m_interface->UpdateMerit(newMerit);
     }
   }
-
+ 
   m_interface->UpdateResources(res_change);
 
   //if(m_world->GetConfig().CLEAR_ON_OUTPUT.Get()) input_buffer.Clear();  @JEB Not fully implemented 

Modified: development/source/main/cPopulation.cc
===================================================================
--- development/source/main/cPopulation.cc	2007-07-27 17:07:05 UTC (rev 1854)
+++ development/source/main/cPopulation.cc	2007-07-27 18:22:28 UTC (rev 1855)
@@ -180,6 +180,9 @@
   int global_res_index = -1;
   for (int i = 0; i < resource_lib.GetSize(); i++) {
     cResource * res = resource_lib.GetResource(i);
+
+    // If the resource is not a deme resource set it up
+
     if (!res->GetDemeResource()) {
       global_res_index++;
       const double decay = 1.0 - res->GetOutflow();

Modified: development/source/main/cResourceCount.cc
===================================================================
--- development/source/main/cResourceCount.cc	2007-07-27 17:07:05 UTC (rev 1854)
+++ development/source/main/cResourceCount.cc	2007-07-27 18:22:28 UTC (rev 1855)
@@ -203,7 +203,6 @@
     exit(2);
   }
 
-
   /* If the verbose flag is set print out information about resources */
 
   if (verbosity_level > VERBOSE_NORMAL) {
@@ -232,9 +231,16 @@
     }   
   }
 
-  resource_count[id] = initial;
-  spatial_resource_count[id].RateAll
+  /* recource_count gets only the values for global resources */
+
+  if (in_geometry == nGeometry::GLOBAL) {
+    resource_count[id] = initial;
+    spatial_resource_count[id].RateAll(0);
+  } else {
+    resource_count[id] = 0;
+    spatial_resource_count[id].RateAll
                               (initial/spatial_resource_count[id].GetSize());
+  }
   spatial_resource_count[id].StateAll();  
   decay_rate[id] = decay;
   inflow_rate[id] = inflow;
@@ -357,6 +363,7 @@
          the organism demand to work immediately on the state of the resource */ 
     
       spatial_resource_count[i].State(cell_id);
+      // cout << "BDB in cResourceCount::ModifyCell id = " << i << " cell = " << cell_id << " amount[41] = " << spatial_resource_count[i].GetAmount(41) << endl;
     }
   }
 }
@@ -418,7 +425,7 @@
         }
         spatial_resource_count[i].FlowAll();
         spatial_resource_count[i].StateAll();
-        resource_count[i] = spatial_resource_count[i].SumAll();
+        // BDB: resource_count[i] = spatial_resource_count[i].SumAll();
       }
     }
   }

Modified: development/source/main/cSpatialResCount.cc
===================================================================
--- development/source/main/cSpatialResCount.cc	2007-07-27 17:07:05 UTC (rev 1854)
+++ development/source/main/cSpatialResCount.cc	2007-07-27 18:22:28 UTC (rev 1855)
@@ -18,8 +18,8 @@
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *  along with this program; if not, write to the Free Software Foundation, 
+ *  Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  */
 

Modified: development/source/main/cStats.cc
===================================================================
--- development/source/main/cStats.cc	2007-07-27 17:07:05 UTC (rev 1854)
+++ development/source/main/cStats.cc	2007-07-27 18:22:28 UTC (rev 1855)
@@ -818,10 +818,21 @@
   df.WriteComment("of the particular resource at that update.");
 
   df.Write(m_update,   "Update");
+  
+  // Check for spatial resources if they exist total up the resource in each 
+  // cell and print that total.  Also call the routine to print the individual
+  // maps for each spatial resource 
+  
   for (int i = 0; i < resource_count.GetSize(); i++) {
-    df.Write(resource_count[i], resource_names[i] );
     if (resource_geometry[i] != nGeometry::GLOBAL) {
+      double sum_spa_resource = 0;
+      for (int j = 0; j < spatial_res_count[i].GetSize(); j++) {
+         sum_spa_resource += spatial_res_count[i][j];
+      }
+      df.Write(sum_spa_resource, resource_names[i] );
       PrintSpatialResData(filename, i);
+    } else {
+      df.Write(resource_count[i], resource_names[i] );
     }
   }
   df.Endl();
@@ -830,7 +841,7 @@
 void cStats::PrintSpatialResData(const cString& filename, int i)
 {
 
-  // Write spatial data to a file that can easily be read into Matlab
+  // Write spatial resource data to a file that can easily be read into Matlab
 
   cString tmpfilename = "resource_";
   tmpfilename +=  resource_names[i] + ".m";




More information about the Avida-cvs mailing list