Class ContactTracing¶
Class for tracing contacts between agents. More...
#include <contacttracing-bones.hpp>
Public Functions¶
| Type | Name |
|---|---|
| ContactTracing () |
|
| ContactTracing (size_t n_agents, size_t max_contacts) Construct a new Contact Tracing object. |
|
| void | add_contact (size_t agent_a, size_t agent_b, size_t day) Add a contact between two agents at a given day. |
| std::pair< size_t, size_t > | get_contact (size_t agent, size_t idx) Get the contact object. |
| size_t | get_n_contacts (size_t agent) Get the number of contacts for an agent. |
| void | print (size_t agent) Print the contacts of an agent. |
| void | reset (size_t n_agents, size_t max_contacts) Reset the contact tracing data. |
Detailed Description¶
The class assumes that contacts are stored in a matrix-like structure, where rows are agents and columns are contacts in a column-major format. Each entry stores the id of the contact and the day of the contact is stored in a parallel array.
The maximum number of contacts per agent is fixed at initialization time. If more contacts are added, they will overwrite previous contacts in a circular buffer fashion.
Public Functions Documentation¶
function ContactTracing [1/2]¶
function ContactTracing [2/2]¶
Construct a new Contact Tracing object.
Parameters:
n_agentsAgents in the system, usuallyModel <TSeq>::size().max_contactsMaximum number of contacts to track per agent.
function add_contact¶
Add a contact between two agents at a given day.
Parameters:
agent_aAgent id (usually infectious agent)agent_bAgent id (usually susceptible agent)dayDay of the contact (usually Model<TSeq>::today()).
function get_contact¶
Get the contact object.
Parameters:
agentSource agent (id)idxIndex of the contact (0 to get_n_contacts(agent)-1)
Returns:
std::pair<size_t, size_t> with (contact_id, contact_day)
Exception:
std::out_of_rangeif idx is out of range.
function get_n_contacts¶
Get the number of contacts for an agent.
Parameters:
agentAgent id
Returns:
size_t Number of contacts recorded for that agent (can be more than max_contacts)
function print¶
Print the contacts of an agent.
Parameters:
agentAgent id
function reset¶
Reset the contact tracing data.
Usually called by Model <TSeq>:: reset().
Parameters:
n_agentsNumber of agentsmax_contactsMaximum number of contacts to track per agent
The documentation for this class was generated from the following file epiworld-src/include/epiworld/contacttracing-bones.hpp