[Avida-SVN] r1371 - in branches/dkdev/source: actions main

dknoester at myxo.css.msu.edu dknoester at myxo.css.msu.edu
Mon Feb 26 11:47:31 PST 2007


Author: dknoester
Date: 2007-02-26 14:47:31 -0500 (Mon, 26 Feb 2007)
New Revision: 1371

Modified:
   branches/dkdev/source/actions/PrintActions.cc
   branches/dkdev/source/main/cPopulation.cc
   branches/dkdev/source/main/cStats.cc
   branches/dkdev/source/main/cStats.h
Log:
commit for 036-connected

Modified: branches/dkdev/source/actions/PrintActions.cc
===================================================================
--- branches/dkdev/source/actions/PrintActions.cc	2007-02-26 01:09:53 UTC (rev 1370)
+++ branches/dkdev/source/actions/PrintActions.cc	2007-02-26 19:47:31 UTC (rev 1371)
@@ -1476,7 +1476,6 @@
   action_lib->Register<cActionPrintInstructionData>("PrintInstructionData");
   action_lib->Register<cActionPrintGenotypeMap>("PrintGenotypeMap");
   action_lib->Register<cActionPrintMarketData>("PrintMarketData");
-  action_lib->Register<cActionPrintTopologyData>("PrintTopologyData");
   
   // Population Out Files
   action_lib->Register<cActionPrintPhenotypeData>("PrintPhenotypeData");
@@ -1518,8 +1517,9 @@
   // Print Settings
   action_lib->Register<cActionSetVerbose>("SetVerbose");
   
+  // Topology
+  action_lib->Register<cActionPrintTopologyData>("PrintTopologyData");
 
-
   // @DMB - The following actions are DEPRECATED aliases - These will be removed in 2.7.
   action_lib->Register<cActionPrintAverageData>("print_average_data");
   action_lib->Register<cActionPrintErrorData>("print_error_data");

Modified: branches/dkdev/source/main/cPopulation.cc
===================================================================
--- branches/dkdev/source/main/cPopulation.cc	2007-02-26 01:09:53 UTC (rev 1370)
+++ branches/dkdev/source/main/cPopulation.cc	2007-02-26 19:47:31 UTC (rev 1371)
@@ -813,7 +813,7 @@
         
         // Hm, ok, well we now have completely connected deme.  We should really do some
         // stats tracking now.
-        m_world->GetStats().ConnectedTopology(network);
+        m_world->GetStats().ConnectedTopology(source_deme);
         break;
       }        
       default:

Modified: branches/dkdev/source/main/cStats.cc
===================================================================
--- branches/dkdev/source/main/cStats.cc	2007-02-26 01:09:53 UTC (rev 1370)
+++ branches/dkdev/source/main/cStats.cc	2007-02-26 19:47:31 UTC (rev 1371)
@@ -19,6 +19,10 @@
 
 #include <float.h>
 #include <math.h>
+#include <string>
+#include <sstream>
+#include <fstream>
+#include <boost/graph/graphviz.hpp>
 
 
 cStats::cStats(cWorld* world)
@@ -846,12 +850,20 @@
 	df.Write(num_used, "num used" );
 	df.Write(num_own_used, "num own used" );
 	num_bought = num_sold = num_used = num_own_used = 0;
-df.Endl();
+  df.Endl();
 }
 
-void cStats::ConnectedTopology(cDeme::Network& network) {
+
+void cStats::ConnectedTopology(cDeme& deme) {
+  cDeme::Network& network = deme.GetNetwork();
   ++m_topo_numReplications;
   m_topo_numEdges.Add(boost::num_edges(network));
+
+  std::stringstream filename;
+  filename << "./data/topo-" << GetUpdate() << ".dot";
+  std::ofstream outfile(filename.str().c_str());
+  boost::write_graphviz(outfile, network);
+  outfile.close();
 }
 
 

Modified: branches/dkdev/source/main/cStats.h
===================================================================
--- branches/dkdev/source/main/cStats.h	2007-02-26 01:09:53 UTC (rev 1370)
+++ branches/dkdev/source/main/cStats.h	2007-02-26 19:47:31 UTC (rev 1371)
@@ -15,31 +15,14 @@
 #include <fstream>
 #include <iostream>
 
-#ifndef defs_h
 #include "defs.h"
-#endif
-#ifndef cDoubleSum_h
 #include "cDoubleSum.h"
-#endif
-#ifndef functions_h
 #include "functions.h"
-#endif
-#ifndef cIntSum_h
 #include "cIntSum.h"
-#endif
-#ifndef cRunningAverage_h
 #include "cRunningAverage.h"
-#endif
-#ifndef tArray_h
 #include "tArray.h"
-#endif
-#ifndef tDataManager_h
 #include "tDataManager.h"
-#endif
-#ifndef nGeometry_h
 #include "nGeometry.h"
-#endif
-
 #include "cDeme.h"
 
 class cGenotype;
@@ -565,9 +548,8 @@
   void PrintMarketData(const cString& filename);
   
   // Topology
-  void ConnectedTopology(cDeme::Network& network);
+  void ConnectedTopology(cDeme& deme);
   void PrintTopologyData(const cString& filename);
-
 };
 
 




More information about the Avida-cvs mailing list