Stride Reference Manual  1.0
stride::Cluster Class Reference

Represents a location for social contacts, an group of people. More...

#include <Cluster.h>

Collaboration diagram for stride::Cluster:
Collaboration graph

Public Member Functions

 Cluster (std::size_t cluster_id, ClusterType cluster_type, GeoCoordinate coordinate=GeoCoordinate(0, 0))
 Constructor. More...
 
void addPerson (Simulator::PersonType *p)
 Add the given Person to the Cluster. More...
 
void removePerson (unsigned int id)
 Remove the given Person from the Cluster. More...
 
std::size_t getSize () const
 Return number of persons in this cluster. More...
 
std::size_t getActiveClusterMembers () const
 Return number of persons in this cluster. More...
 
std::size_t getInfectedCount () const
 Return the amount of infected people in this cluster. More...
 
ClusterType getClusterType () const
 Return the type of this cluster. More...
 
GeoCoordinate getLocation () const
 Return the geo coordinates (latitude-longitude) of the cluster. More...
 
double getContactRate (const Simulator::PersonType *p) const
 Get basic contact rate in this cluster. More...
 
std::size_t getId () const
 Get the ID of this cluster. More...
 
const std::vector< std::pair< Simulator::PersonType *, bool > > & getMembers () const
 Get the members of this vector Rather for testing purposes. More...
 

Static Public Member Functions

static void addContactProfile (ClusterType cluster_type, const ContactProfile &profile)
 Add contact profile. More...
 

Private Member Functions

std::tuple< bool, size_t > sortMembers ()
 Sort members w.r.t. health status (order: exposed/infected/recovered, susceptible, immune). More...
 
void updateMemberPresence ()
 Calculate which members are present in the cluster on the current day. More...
 

Private Attributes

std::size_t m_cluster_id
 The ID of the Cluster (for logging purposes). More...
 
ClusterType m_cluster_type
 The type of the Cluster (for logging purposes). More...
 
std::size_t m_index_immune
 Index of the first immune member in the Cluster. More...
 
std::vector< std::pair< Simulator::PersonType *, bool > > m_members
 Container with pointers to Cluster members. More...
 
const ContactProfilem_profile
 
const GeoCoordinate m_coordinate
 The location of the cluster. More...
 

Static Private Attributes

static std::array< ContactProfile, numOfClusterTypes()> g_profiles
 

Friends

template<LogMode log_level, bool track_index_case, typename local_information_policy >
class Infector
 Infector calculates contacts and transmissions. More...
 
class Hdf5Loader
 
class Hdf5Saver
 

Detailed Description

Represents a location for social contacts, an group of people.

Definition at line 46 of file Cluster.h.

Constructor & Destructor Documentation

stride::Cluster::Cluster ( std::size_t  cluster_id,
ClusterType  cluster_type,
GeoCoordinate  coordinate = GeoCoordinate(0, 0) 
)

Constructor.

Definition at line 34 of file Cluster.cpp.

Member Function Documentation

void stride::Cluster::addPerson ( Simulator::PersonType p)

Add the given Person to the Cluster.

Definition at line 45 of file Cluster.cpp.

References m_index_immune, and m_members.

void stride::Cluster::removePerson ( unsigned int  id)

Remove the given Person from the Cluster.

Definition at line 60 of file Cluster.cpp.

References m_index_immune, and m_members.

std::size_t stride::Cluster::getSize ( ) const
inline

Return number of persons in this cluster.

Definition at line 58 of file Cluster.h.

Referenced by stride::ClusterSaver::getClusterJSON(), and stride::ClusterSaver::saveClusterCSV().

std::size_t stride::Cluster::getActiveClusterMembers ( ) const

Return number of persons in this cluster.

Definition at line 70 of file Cluster.cpp.

References m_members.

std::size_t stride::Cluster::getInfectedCount ( ) const

Return the amount of infected people in this cluster.

Definition at line 50 of file Cluster.cpp.

References m_members.

Referenced by stride::ClusterSaver::getClusterJSON(), and stride::ClusterSaver::saveClusterCSV().

ClusterType stride::Cluster::getClusterType ( ) const
inline

Return the type of this cluster.

Definition at line 67 of file Cluster.h.

Referenced by stride::ClusterSaver::getClusterJSON(), and stride::ClusterSaver::saveClusterCSV().

GeoCoordinate stride::Cluster::getLocation ( ) const
inline

Return the geo coordinates (latitude-longitude) of the cluster.

Definition at line 70 of file Cluster.h.

Referenced by stride::ClusterSaver::getClusterJSON(), and stride::ClusterSaver::saveClusterCSV().

std::size_t stride::Cluster::getId ( ) const
inline

Get the ID of this cluster.

Definition at line 78 of file Cluster.h.

Referenced by stride::ClusterSaver::getClusterJSON(), and stride::ClusterSaver::saveClusterCSV().

const std::vector<std::pair<Simulator::PersonType*, bool> >& stride::Cluster::getMembers ( ) const
inline

Get the members of this vector Rather for testing purposes.

Definition at line 82 of file Cluster.h.

void stride::Cluster::addContactProfile ( ClusterType  cluster_type,
const ContactProfile profile 
)
static

Add contact profile.

Definition at line 40 of file Cluster.cpp.

References g_profiles, and stride::toSizeType().

tuple< bool, size_t > stride::Cluster::sortMembers ( )
private

Sort members w.r.t. health status (order: exposed/infected/recovered, susceptible, immune).

Definition at line 81 of file Cluster.cpp.

References m_index_immune, and m_members.

Referenced by stride::Infector< log_level, track_index_case, NoLocalInformation >::execute().

void stride::Cluster::updateMemberPresence ( )
private

Friends And Related Function Documentation

template<LogMode log_level, bool track_index_case, typename local_information_policy >
friend class Infector
friend

Infector calculates contacts and transmissions.

Definition at line 94 of file Cluster.h.

friend class Hdf5Loader
friend

Definition at line 110 of file Cluster.h.

friend class Hdf5Saver
friend

Definition at line 112 of file Cluster.h.

Member Data Documentation

std::size_t stride::Cluster::m_cluster_id
private

The ID of the Cluster (for logging purposes).

Definition at line 100 of file Cluster.h.

std::size_t stride::Cluster::m_index_immune
private

Index of the first immune member in the Cluster.

Definition at line 102 of file Cluster.h.

Referenced by addPerson(), stride::Infector< log_level, track_index_case, NoLocalInformation >::execute(), removePerson(), and sortMembers().

const ContactProfile& stride::Cluster::m_profile
private

Definition at line 104 of file Cluster.h.

const GeoCoordinate stride::Cluster::m_coordinate
private

The location of the cluster.

Definition at line 105 of file Cluster.h.

std::array< ContactProfile, numOfClusterTypes()> stride::Cluster::g_profiles
staticprivate

Definition at line 107 of file Cluster.h.

Referenced by addContactProfile().


The documentation for this class was generated from the following files: