Species(long c) : count(c), name("") {}
Species(std::string x) : count(0), name(x) {}
Species(std::string x, long c) : count(c), name(x) {}
+
+ // necessary otherwise compiler complains 'source type is not polymorphic'
+ // ...should probably have a virtual destructor....
+ virtual void allow_dynamic_cast() {}
};
class SimpleSpecies : public Species {
//double t_end = 1000.0;
//long max_steps = LONG_MAX;
//double sample_interval = 1.0;
- simulate(reactions, species, r.t_end, r.max_steps, r.sample_interval, print_spec);
+ simulate(reactions, species, r.t_end, r.max_steps, r.sample_interval, print_spec, r.useVerbose);
gsl_rng_free(rnd); //Free up memory from random number generator
std::cout << '\n';
}
-void print_species_traj(double t, const Species_parray &print_spec)
+void print_species_traj(double t, const Species_parray &print_spec, bool verbose)
{
std::cout << t;
for (Species_parray::const_iterator spec = print_spec.begin(),
- end = print_spec.end();
+ end = print_spec.end();
spec != end; ++spec)
{
// TODO: prettier representation
std::cout << '\t' << (*spec)->count;
+
+ if (verbose) {
+ VirusSpecies *V = dynamic_cast<VirusSpecies*> (*spec);
+ if (V) {
+ virus_map::iterator it = V->pop.begin(),
+ end = V->pop.end();
+ for (; it != end; ++it) {
+ std::cout << ' ' << it->second
+ << '(' << it->first.mutated_sites << ')';
+ }
+ }
+ }
+
}
std::cout << '\n';
}
-void simulate(Rxn_parray &reactions, Species_parray &species, double t_end, long max_steps, double sample_interval, const Species_parray &print_spec)
+void simulate(Rxn_parray &reactions, Species_parray &species, double t_end, long max_steps, double sample_interval, const Species_parray &print_spec, bool verbose)
{
long step = 0;
// print copy numbers
if (t_next_sample <= t) {
t_next_sample += sample_interval;
- print_species_traj(t,print_spec);
+ print_species_traj(t,print_spec,verbose);
}
}
if (t_end == HUGE_VAL)
- print_species_traj(t,print_spec);
+ print_species_traj(t,print_spec,verbose);
}
void run(RunParameters_SS &r);
void importState(RunParameters_SS &r);
void importEpitope(RunParameters_SS &r, Species_parray &species, Rxn_parray &reactions, VirusSpecies *V, Species_parray &print_spec);
-void simulate(Rxn_parray &reactions, Species_parray &species, double t_end, long max_steps, double sample_interval, const Species_parray &print_spec);
+void simulate(Rxn_parray &reactions, Species_parray &species, double t_end, long max_steps, double sample_interval, const Species_parray &print_spec, bool verbose);
#endif