REPORTERS

Class framework for outputting simulation data

Overview:

  • TimestepReporterInterface

  • PopulationCompartmentReporter

  • CellCompartmentReporter

  • PerCellCompartmentReporter

REPORTERS

class TimestepReporterInterface

Interface for classes reporting on a population each iteration.

Subclassed by epiabm::AgeStratifiedNewCasesReporter, epiabm::AgeStratifiedPopulationReporter, epiabm::CellCompartmentReporter, epiabm::NewCasesReporter, epiabm::PerCellCompartmentReporter, epiabm::PopulationCompartmentReporter

Public Functions

TimestepReporterInterface(const std::string folder, bool clearfolder = false)

Constructor.

Parameters:
  • folder – Folder to output to

  • clearfolder – whether folder should be emptied at the start of the simulation

TimestepReporterInterface(const std::filesystem::path folder, bool clearfolder = false)

Constructor.

Parameters:
  • folder – Folder to output to

  • clearfolder – whether folder should be emptied at the start of the simulation

virtual ~TimestepReporterInterface()

Destroy the Timestep Reporter Interface:: Timestep Reporter Interface object.

virtual void setup(const PopulationPtr population)

Setup method run immediately before iterations begin Used for initializing required files.

Parameters:

population – Initialized population

virtual void report(const PopulationPtr population, const unsigned short timestep)

Report the population state at a timestep.

Parameters:
  • popPopulation to report

  • timestep – Timestep of report

virtual void teardown()

Clean up method Called after the simulation has completed to finalise the output files.

class PopulationCompartmentReporter : public epiabm::TimestepReporterInterface

Report total compartment counts each iteration for the entire population Outputs a single file which contains the compartment counts over time.

Public Functions

PopulationCompartmentReporter(const std::string file)

Construct a new Population Compartment Reporter object If the file already exists, it will be overwritten.

Parameters:

file – File to write to

~PopulationCompartmentReporter()

Construct a new Population Compartment Reporter object If the file already exists, it will be overwritten.

Parameters:

file – File to write to

virtual void setup(const PopulationPtr population) override

Setup method which is called immediately before iterations begin.

Parameters:

pop – Initialized population before the iterations start

virtual void report(const PopulationPtr population, const unsigned short timestep) override

Report the population state at a timestep.

Parameters:
  • popPopulation to report

  • timestep – Timestep of report

std::set<InfectionStatus> &compartments()

Getter for set which contains the compartment types to return This set can be configured to specify which compartments to output.

Returns:

std::set<InfectionStatus>&

class CellCompartmentReporter : public epiabm::TimestepReporterInterface

Report Comportment Counts each iteration for each cell Outputs to a folder with one csv each timestep with the compartment counts for each cell.

Public Functions

CellCompartmentReporter(const std::string folder)

Construct a new Cell Compartment Reporter object.

Parameters:

folder – Output Folder

~CellCompartmentReporter()

Destroy the Cell Compartment Reporter:: Cell Compartment Reporter object.

virtual void report(const PopulationPtr pop, const unsigned short timestep) override

Report the population state at a timestep.

Parameters:
  • popPopulation to report

  • timestep – Timestep of report

std::set<InfectionStatus> &compartments()

Getter for set which contains the compartment types to return This set can be configured to specify which compartments to output.

Returns:

std::set<InfectionStatus>&

class PerCellCompartmentReporter : public epiabm::TimestepReporterInterface

Report Compartment Counts each Iteration for Each Cell Outputs to a folder with one file per cell with compartment counts over time.

Public Functions

PerCellCompartmentReporter(const std::string folder)

Construct a new Per Cell Compartment Reporter object.

Parameters:

folder – Folder to output to

~PerCellCompartmentReporter()

Destroy the Per Cell Compartment Reporter:: Per Cell Compartment Reporter object.

virtual void setup(const PopulationPtr pop) override

Setup method which is called immediately before iterations begin.

Parameters:

pop – Initialized population before the iterations start

virtual void report(const PopulationPtr pop, const unsigned short timestep) override

Report the population state at a timestep.

Parameters:
  • popPopulation to report

  • timestep – Timestep of report

virtual void teardown() override

Clean up method Called after the simulation has completed to finalise the output files.

std::set<InfectionStatus> &compartments()

Getter for set which contains the compartment types to return This set can be configured to specify which compartments to output.

Returns:

std::set<InfectionStatus>&