else
initialize_Ising(r,species,reactions,print_spec);
- simulate(reactions, species, r.t_end, r.max_steps, r.sample_interval, r.step_sample_interval, print_spec, r.useVerbose);
+ simulate(reactions, species, r.t_end, r.max_steps, r.sample_interval, r.step_sample_interval, print_spec, r.useVerbose, r.flushOften);
// clean up reaction array
for (Rxn_parray::iterator it = reactions.begin(),
std::cout << '\n';
}
-void print_species_traj(double t, long step, const Species_parray &print_spec, bool verbose)
+void print_species_traj(double t, long step, const Species_parray &print_spec, bool verbose, bool flushOften)
{
std::cout << t;
for (Species_parray::const_iterator spec = print_spec.begin(),
}
std::cout << '\n';
+ if (flushOften)
+ std::cout << std::flush;
}
-void simulate(Rxn_parray &reactions, Species_parray &species, double t_end, long max_steps, double sample_interval, unsigned step_sample_interval, const Species_parray &print_spec, bool verbose)
+void simulate(Rxn_parray &reactions, Species_parray &species, double t_end, long max_steps, double sample_interval, unsigned step_sample_interval, const Species_parray &print_spec, bool verbose, bool flushOften)
{
long step = 0;
double total_propensity = 0.0;
print_species_header(print_spec);
- print_species_traj(t,step,print_spec,verbose); // XXX
+ print_species_traj(t,step,print_spec,verbose,flushOften); // XXX
Rxn_parray::iterator rxn, end;
Rxn_parray::iterator rxn2, end2;
// print copy numbers
if (t_next_sample <= t) {
t_next_sample += sample_interval;
- print_species_traj(t,step,print_spec,verbose);
+ print_species_traj(t,step,print_spec,verbose,flushOften);
}
if ((step_sample_interval != 0) && (step_next_sample <= step)) {
step_next_sample += step_sample_interval;
- print_species_traj(t,step,print_spec,verbose);
+ print_species_traj(t,step,print_spec,verbose,flushOften);
}
}
if (t_end == HUGE_VAL)
- print_species_traj(t,step,print_spec,verbose);
+ print_species_traj(t,step,print_spec,verbose,flushOften);
}
" -const_ND (int) number of effector CTL divisions (generations) [default=9]\n"
" -vol (double) volume scaling factor; affects rate constants, not initial values [default=1.0]\n"
" -track_esc flag to count escaped viruses (in Iesc species)\n"
+" -flush_each flag to flush after each line of output (vs waiting for buffering)\n"
; std::cout.flush();
}
else if (strcmp(argv[i],"-track_esc")==0) { r.trackEscaped = true; }
+ else if (strcmp(argv[i],"-flush_each")==0) { r.flushOften = true; }
+
else if (strcmp(argv[i],"-h")==0 || strcmp(argv[i],"--help")==0) { usage(); return 0; }
else printf("Unrecognized argument! '%s'\n",argv[i]);
// If true, use a dummy T cell species "Iesc" with special reactions,
// updating amount when viruses aren't recognized.
+ bool flushOften; // flush output each line?
+
std::vector<std::set<unsigned int> > initPop; // Initial population sequences
std::vector<double> initFrac; // Initial population fraction
trackEscaped = false;
+ flushOften = false;
+
}
void importState_Potts(RunParameters_SS &r);
void importEpitope(RunParameters_SS &r, Species_parray &species, Rxn_parray &reactions, VirusSpecies *V, Species_parray &print_spec);
void importEpitope_Potts(RunParameters_SS &r, Species_parray &species, Rxn_parray &reactions, NTVirusSpecies *V, Species_parray &print_spec);
-void simulate(Rxn_parray &reactions, Species_parray &species, double t_end, long max_steps, double sample_interval, unsigned step_sample_interval, const Species_parray &print_spec, bool verbose);
+void simulate(Rxn_parray &reactions, Species_parray &species, double t_end, long max_steps, double sample_interval, unsigned step_sample_interval, const Species_parray &print_spec, bool verbose, bool flushOften);
void initialize_Ising(RunParameters_SS &r, Species_parray &species, Rxn_parray &reactions, Species_parray &print_spec);
void initialize_Potts(RunParameters_SS &r, Species_parray &species, Rxn_parray &reactions, Species_parray &print_spec);