Class HospitalizationsTracker¶
template <typename TSeq>
ClassList > HospitalizationsTracker
Class to track hospitalizations in an epidemiological model. More...
#include <hospitalizationstracker-bones.hpp>
Public Functions¶
| Type | Name |
|---|---|
| HospitalizationsTracker () = default |
|
| void | get (int ndays, std::vector< int > & date, std::vector< int > & virus_id, std::vector< int > & tool_id, std::vector< int > & count, std::vector< double > & weight) const Get the full time series of hospitalizations. |
| void | record (Agent< TSeq > & agent, Model< TSeq > & model) Record a hospitalization event for an agent. |
| void | reset () Reset the tracker by clearing all data. |
| size_t | size () const Get the number of raw records in the tracker. |
Detailed Description¶
This class keeps track of hospitalizations in a model. For each hospitalized agent, it records the date, virus ID, and tool IDs with appropriate weights.
Since agents always have at most one virus but may have multiple tools, if an agent has N tools, then N records are created, each with weight equal to 1/N. If the agent has no tools, a single record is created with tool_id = -1 and weight = 1.0.
The get() method returns a summary of the hospitalizations grouped by date, virus_id, and tool_id, with weight summed across all matching records.
Template parameters:
TSeqType of sequence (should matchTSeqacross the model)
Public Functions Documentation¶
function HospitalizationsTracker¶
function get¶
Get the full time series of hospitalizations.
void HospitalizationsTracker::get (
int ndays,
std::vector< int > & date,
std::vector< int > & virus_id,
std::vector< int > & tool_id,
std::vector< int > & count,
std::vector< double > & weight
) const
Parameters:
ndaysNumber of days in the simulation (0 to ndays-1).dateOutput vector for dates.virus_idOutput vector for virus IDs.tool_idOutput vector for tool IDs.countOutput vector for counts (number of hospitalized individuals).weightOutput vector for summed weights (fractional contribution based on tool distribution).
Returns the full time series of hospitalization data. For each unique (virus_id, tool_id) combination observed, returns an entry for every day from 0 to ndays-1.
The count vector contains the actual number of individuals hospitalized for that (date, virus_id, tool_id) combination. This is useful for answering questions like "how many total people were hospitalized?" regardless of their tools.
The weight vector contains fractional contributions: if an agent has N tools, each tool gets weight = 1/N. Summing weights across all tool_ids for a given date and virus_id gives the total number of hospitalizations.
function record¶
Record a hospitalization event for an agent.
Parameters:
agentReference to the agent being hospitalized.modelReference to the model.
For each hospitalization, the method records: * The current date from the model * The virus ID from the agent's virus * For each tool the agent has, a separate record with weight = 1/N where N is the number of tools * If the agent has no tools, a single record with tool_id = -1 and weight = 1.0
function reset¶
Reset the tracker by clearing all data.
function size¶
Get the number of raw records in the tracker.
Returns:
Number of records.
The documentation for this class was generated from the following file epiworld-src/include/epiworld/hospitalizationstracker-bones.hpp