[Avida-SVN] r1417 - branches/dkdev/source/main

dknoester at myxo.css.msu.edu dknoester at myxo.css.msu.edu
Tue Mar 20 13:16:16 PDT 2007


Author: dknoester
Date: 2007-03-20 16:16:16 -0400 (Tue, 20 Mar 2007)
New Revision: 1417

Modified:
   branches/dkdev/source/main/cStats.cc
Log:
more logging bugfixes.

Modified: branches/dkdev/source/main/cStats.cc
===================================================================
--- branches/dkdev/source/main/cStats.cc	2007-03-20 20:08:28 UTC (rev 1416)
+++ branches/dkdev/source/main/cStats.cc	2007-03-20 20:16:16 UTC (rev 1417)
@@ -888,15 +888,19 @@
 	m_topo_numEdges.Clear();
 	df.Endl();
   
-	std::stringstream netfile;
-	netfile << "./data/topo-" << GetUpdate() << ".dot";
-	std::ofstream outfile(netfile.str().c_str());
-	boost::write_graphviz(outfile, m_topo_lastNetwork, topo_vertex_writer(m_topo_lastNetwork));
-	outfile.close();
-  
-  netfile.str("");
-  netfile << "./data/germ-" << GetUpdate() << ".genome";
-  std::ofstream germfile(netfile.str().c_str());
-  germfile << m_topo_germline.GetLatest().AsString() << std::endl;
-  germfile.close();
+  if(boost::num_vertices(m_topo_lastNetwork) > 0) {
+    std::stringstream filename;
+    filename << "./data/topo-" << GetUpdate() << ".dot";
+    std::ofstream outfile(filename.str().c_str());
+    boost::write_graphviz(outfile, m_topo_lastNetwork, topo_vertex_writer(m_topo_lastNetwork));
+    outfile.close();
+  }
+
+  if(m_topo_germline.Size() > 0) {
+    std::stringstream filename;
+    filename << "./data/germ-" << GetUpdate() << ".genome";
+    std::ofstream outfile(filename.str().c_str());
+    outfile << m_topo_germline.GetLatest().AsString() << std::endl;
+    outfile.close();
+  }
 }




More information about the Avida-cvs mailing list