[Avida-SVN] r2139 - in branches/energy/source: actions main
beckma24 at myxo.css.msu.edu
beckma24 at myxo.css.msu.edu
Fri Oct 12 13:44:11 PDT 2007
Author: beckma24
Date: 2007-10-12 16:44:11 -0400 (Fri, 12 Oct 2007)
New Revision: 2139
Modified:
branches/energy/source/actions/PrintActions.cc
branches/energy/source/main/cStats.cc
Log:
Modified PrintMsgSentBlockedDump to remove files after they have been written
Modified: branches/energy/source/actions/PrintActions.cc
===================================================================
--- branches/energy/source/actions/PrintActions.cc 2007-10-12 19:40:21 UTC (rev 2138)
+++ branches/energy/source/actions/PrintActions.cc 2007-10-12 20:44:11 UTC (rev 2139)
@@ -95,7 +95,6 @@
STATS_OUT_FILE(PrintSleepData, sleep.dat );
STATS_OUT_FILE(PrintMessageData, message.dat );
STATS_OUT_FILE(PrintPredSatFracDump, pred_sat_frac_dump.dat);
-STATS_OUT_FILE(PrintMsgSentBlockedDump, msg_sent_block_dump.dat);
#define POP_OUT_FILE(METHOD, DEFAULT) /* 1 */ \
class cAction ## METHOD : public cAction { /* 2 */ \
@@ -2604,6 +2603,28 @@
}
};
+class cActionPrintMsgSentBlockedDump : public cAction
+{
+private:
+ cString m_filename;
+
+public:
+ cActionPrintMsgSentBlockedDump(cWorld* world, const cString& args) : cAction(world, args), m_filename("")
+ {
+ cString largs(args);
+ if (largs.GetSize()) m_filename = largs.PopWord();
+ }
+
+ static const cString GetDescription() { return "Arguments: [string fname='']"; }
+
+ void Process(cAvidaContext& ctx)
+ {
+ cString filename(m_filename);
+ if (filename == "") filename.Set("msg_sent_block_dump_%d.pop", m_world->GetStats().GetUpdate());
+ m_world->GetStats().PrintMsgSentBlockedDump(filename);
+ m_world->GetDataFileManager().Remove(filename);
+ }
+};
Modified: branches/energy/source/main/cStats.cc
===================================================================
--- branches/energy/source/main/cStats.cc 2007-10-12 19:40:21 UTC (rev 2138)
+++ branches/energy/source/main/cStats.cc 2007-10-12 20:44:11 UTC (rev 2139)
@@ -1077,6 +1077,7 @@
cDataFile& df = m_world->GetDataFile(filename);
cPopulation& pop = m_world->GetPopulation();
int width = pop.GetWorldX();
+
for(int i = 0; i < pop.GetSize(); i++) {
int data;
if(pop.GetCell(i).InTXRange()) { // cell blocked
@@ -1093,8 +1094,6 @@
}
df.WriteBlockElement(data, i, width);
}
- df.Endl();
- df.Endl();
}
void cStats::PrintSenseData(const cString& filename)
More information about the Avida-cvs
mailing list