From: Dariusz Murakowski Date: Thu, 6 Mar 2014 20:41:08 +0000 (-0500) Subject: Print generation number on each line. (Need to update unit tests.) X-Git-Url: http://src.murakowski.org/?a=commitdiff_plain;h=8c91fcd71356b8dcde3a743c6a3d533d893a2ae8;p=VirEvoDyn.git Print generation number on each line. (Need to update unit tests.) --- diff --git a/population.cpp b/population.cpp index 560ff56..ec7415d 100644 --- a/population.cpp +++ b/population.cpp @@ -177,11 +177,22 @@ void Population::write_population(FILE *output, unsigned int generation) { for (virus_map::iterator iter=pop.begin(); iter!=pop.end(); ++iter) { - fprintf(output,"%d\t%.6e",iter->second,iter->first.energy); + //fprintf(output,"%d\t%.6e",iter->second,iter->first.energy); + fprintf(output,"%d\t%d\t%.6e",generation,iter->second,iter->first.energy); ms = iter->first.mutated_sites; for (std::set::iterator ms_iter=ms.begin(); ms_iter!=ms.end(); ++ms_iter) fprintf(output,"\t%d",*ms_iter); + /* + fprintf(output,"\t"); + std::set::iterator ms_iter=ms.begin(); + if (ms_iter != ms.end()) + fprintf(output,"%d",*ms_iter); + ++ms_iter; + for (; ms_iter!=ms.end(); ++ms_iter) + fprintf(output,",%d",*ms_iter); + */ + fprintf(output,"\n"); } diff --git a/wf.cpp b/wf.cpp index 16ee39e..30a9364 100644 --- a/wf.cpp +++ b/wf.cpp @@ -105,6 +105,7 @@ void run(RunParameters &r, unsigned seed) { Population P(H, r.n, r.mu, r.initPop, r.initFrac); // print epitopes + /* std::cout << "-----------\n"; for (unsigned ep=0; ep.st + std::ifstream input(r.epitopeInfile.c_str()); // .ep if (!input) { perror((std::string("ERROR in importEpitope: ") + r.epitopeInfile).c_str()); exit(1); } std::string readStr; @@ -248,7 +250,7 @@ void importEpitope(RunParameters &r) { std::stringstream readStrStrm(std::string(readStr,pos0,posBar-pos0)); while (readStrStrm >> word) { - std::cout << word << " "; + std::cout << word << " "; // XXX std::istringstream i(word); if (i >> site) tmpEp.push_back(site); @@ -260,11 +262,11 @@ void importEpitope(RunParameters &r) { tmpEp.clear(); // reset temp epitope readStrStrm.str(""); readStrStrm.clear(); // reset stream - std::cout << "| "; + std::cout << "| "; // XXX readStrStrm.str(std::string(readStr,posBar+1,posEnd/*-posBar-1*/)); while (readStrStrm >> word) { - std::cout << word << " "; + std::cout << word << " "; // XXX std::istringstream i(word); if (i >> site) tmpEp.push_back(site); @@ -275,7 +277,7 @@ void importEpitope(RunParameters &r) { r.numEpitopes++; - std::cout << "\n"; + std::cout << "\n"; // XXX }