[Avida-SVN] r3301 - in development/source: actions main

hjg at myxo.css.msu.edu hjg at myxo.css.msu.edu
Tue Jun 9 10:31:45 PDT 2009


Author: hjg
Date: 2009-06-09 13:31:45 -0400 (Tue, 09 Jun 2009)
New Revision: 3301

Modified:
   development/source/actions/PrintActions.cc
   development/source/main/cStats.cc
   development/source/main/cStats.h
Log:
Added better stats tracking for formed group ids

Modified: development/source/actions/PrintActions.cc
===================================================================
--- development/source/actions/PrintActions.cc	2009-06-09 17:13:30 UTC (rev 3300)
+++ development/source/actions/PrintActions.cc	2009-06-09 17:31:45 UTC (rev 3301)
@@ -145,6 +145,7 @@
 
 // group formation 
 STATS_OUT_FILE(PrintGroupsFormedData,         groupformation.dat);
+STATS_OUT_FILE(PrintGroupIds,         groupids.dat);
 
 
 #define POP_OUT_FILE(METHOD, DEFAULT)                                                     /*  1 */ \
@@ -3167,6 +3168,7 @@
 
 	// Group Formation
 	action_lib->Register<cActionPrintGroupsFormedData>("PrintGroupsFormedData");
+	action_lib->Register<cActionPrintGroupIds>("PrintGroupIds");
 	
   action_lib->Register<cActionSetVerbose>("VERBOSE");
 }

Modified: development/source/main/cStats.cc
===================================================================
--- development/source/main/cStats.cc	2009-06-09 17:13:30 UTC (rev 3300)
+++ development/source/main/cStats.cc	2009-06-09 17:31:45 UTC (rev 3301)
@@ -2589,6 +2589,36 @@
 	
 }
 
+/* 	
+ Print data regarding the ids of used groups.
+ */
+void cStats::PrintGroupIds(const cString& filename)
+{
+	
+	cDataFile& df = m_world->GetDataFile(filename);
+	df.WriteComment("The ids of groups used.");
+	
+	map<int,int> groups = m_world->GetPopulation().GetFormedGroups();
+	
+	map <int,int>::iterator itr;
+
+	df.WriteTimeStamp();
+	
+	for(itr = groups.begin();itr!=groups.end();itr++) {
+		double cur_size = itr->second;
+		if (cur_size > 0) {
+			df.Write(m_update,   "Update [update]");
+			df.Write(itr->first, "group id [groupid]");
+			df.Write(cur_size, "size of groups [grsize]");
+			df.Endl();
+		}
+	}
+	
+	
+	df.Endl();
+	
+}
+
 /*! Print and reset network statistics.
  */
 void cStats::PrintDemeNetworkData(const cString& filename) {

Modified: development/source/main/cStats.h
===================================================================
--- development/source/main/cStats.h	2009-06-09 17:13:30 UTC (rev 3300)
+++ development/source/main/cStats.h	2009-06-09 17:31:45 UTC (rev 3301)
@@ -777,6 +777,7 @@
   void PrintExtendedTimeData(const cString& filename);
   void PrintNumOrgsKilledData(const cString& filename);
   void PrintGroupsFormedData(const cString& filename);
+	void PrintGroupIds(const cString& filename);
   
   // deme predicate stats
   void IncEventCount(int x, int y);




More information about the Avida-cvs mailing list