26 #include <spdlog/spdlog.h> 35 : m_cluster_id(cluster_id), m_cluster_type(cluster_type),
36 m_index_immune(0), m_profile(g_profiles.at(
toSizeType(m_cluster_type))),
37 m_coordinate(coordinate) {
46 m_members.emplace_back(std::make_pair(p,
true));
53 auto health = member.first->getHealth();
54 if (health.isInfected() || health.isRecovered())
61 for (
unsigned int i_member = 0; i_member <
m_members.size(); ++i_member) {
62 if (
m_members.at(i_member).first->getId() == id) {
71 std::size_t total = 0;
73 if (!person.first->isOnVacation()) {
82 bool infectious_cases =
false;
87 if (
m_members[i_member].first->getHealth().isImmune()) {
89 size_t new_place = m_index_immune - 1;
91 while (!swapped && new_place > i_member) {
92 if (
m_members[new_place].first->getHealth().isImmune()) {
102 else if (!
m_members[i_member].first->getHealth().isSusceptible()) {
103 if (!infectious_cases &&
m_members[i_member].first->getHealth().isInfectious()) {
104 infectious_cases =
true;
106 if (i_member > num_cases) {
112 return make_tuple(infectious_cases, num_cases);
void updateMemberPresence()
Calculate which members are present in the cluster on the current day.
Cluster(std::size_t cluster_id, ClusterType cluster_type, GeoCoordinate coordinate=GeoCoordinate(0, 0))
Constructor.
std::size_t getActiveClusterMembers() const
Return number of persons in this cluster.
static void addContactProfile(ClusterType cluster_type, const ContactProfile &profile)
Add contact profile.
Header for the Infector class.
std::size_t getInfectedCount() const
Return the amount of infected people in this cluster.
Header file for the Calendar class.
std::vector< std::pair< Simulator::PersonType *, bool > > m_members
Container with pointers to Cluster members.
Time Dependent Person DataType.
std::size_t toSizeType(ClusterType c)
Cast for array access.
static std::array< ContactProfile, numOfClusterTypes()> g_profiles
Forward declaration of class Person.
std::tuple< bool, size_t > sortMembers()
Sort members w.r.t. health status (order: exposed/infected/recovered, susceptible, immune).
std::size_t m_index_immune
Index of the first immune member in the Cluster.
void addPerson(Simulator::PersonType *p)
Add the given Person to the Cluster.
ClusterType
Enumerates the cluster types.
Header for the core Cluster class.
void removePerson(unsigned int id)
Remove the given Person from the Cluster.
ClusterType m_cluster_type
The type of the Cluster (for logging purposes).