Stride Reference Manual
- generated for commit 9643b11
|
A group of Persons that potentially have contacts with one another. More...
#include <ContactPool.h>
Public Types | |
using | iterator = std::vector< stride::Person * >::iterator |
Public Member Functions | |
ContactPool (unsigned int poolId, ContactType::Id type) | |
Initializing constructor. More... | |
~ContactPool ()=default | |
Default will do. More... | |
void | AddMember (Person *p) |
Add the given Person. More... | |
unsigned int | GetId () const |
Get the pool id. More... | |
unsigned int | GetInfectedCount () const |
Get Infected count. More... | |
const std::vector< Person * > & | GetPool () const |
Get the entire pool of members. More... | |
ContactType::Id | GetType () const |
Get the type of ContactPool, used for logging and tests. More... | |
iterator | begin () |
Iterator to first person. More... | |
iterator | end () |
Iterator to end of persons. More... | |
size_t | size () const |
Gets current size of Location storage. More... | |
Person *const & | operator[] (size_t index) const |
Gets a Person by index, doesn't performs a range check. More... | |
Private Member Functions | |
std::tuple< bool, unsigned int > | SortMembers () |
Sort w.r.t. health status: order: exposed/infected/recovered, susceptible, immune. More... | |
Private Attributes | |
unsigned int | m_index_immune |
Index of the first immune member in the ContactPool. More... | |
unsigned int | m_pool_id |
The ID of the ContactPool (for logging purposes). More... | |
ContactType::Id | m_pool_type |
The type of the ContactPool (for logging and testing purposes). More... | |
std::vector< Person * > | m_members |
Pointers to contactpool members (raw pointers intentional). More... | |
Friends | |
template<ContactLogMode::Id LL, bool TIC, bool TO> | |
class | Infector |
Calculates contacts and transmissions; accesses private methods and data. More... | |
A group of Persons that potentially have contacts with one another.
We do not expose the vector that stores pool members because adding & sorting it takes some care.
Definition at line 38 of file ContactPool.h.
using stride::ContactPool::iterator = std::vector<stride::Person*>::iterator |
Definition at line 64 of file ContactPool.h.
stride::ContactPool::ContactPool | ( | unsigned int | poolId, |
ContactType::Id | type | ||
) |
Initializing constructor.
Definition at line 32 of file ContactPool.cpp.
|
default |
Default will do.
void stride::ContactPool::AddMember | ( | Person * | p | ) |
Add the given Person.
Definition at line 37 of file ContactPool.cpp.
References m_index_immune, and m_members.
|
inline |
Get the pool id.
Definition at line 51 of file ContactPool.h.
References GetInfectedCount(), and m_pool_id.
Referenced by geopop::GeoGridJSONWriter::WriteContactPool(), and geopop::GeoGridProtoWriter::WriteContactPool().
unsigned int stride::ContactPool::GetInfectedCount | ( | ) | const |
Get Infected count.
Definition at line 43 of file ContactPool.cpp.
References m_members.
Referenced by GetId().
|
inline |
Get the entire pool of members.
Definition at line 57 of file ContactPool.h.
References m_members.
Referenced by stride::Immunizer::Cocoon().
|
inline |
Get the type of ContactPool, used for logging and tests.
Definition at line 60 of file ContactPool.h.
References m_pool_type.
|
inline |
|
inline |
|
inline |
Gets current size of Location storage.
Definition at line 73 of file ContactPool.h.
References m_members.
Gets a Person by index, doesn't performs a range check.
Definition at line 76 of file ContactPool.h.
References m_members, and SortMembers().
|
private |
Sort w.r.t. health status: order: exposed/infected/recovered, susceptible, immune.
Definition at line 55 of file ContactPool.cpp.
References m_index_immune, and m_members.
Referenced by stride::Infector< LL, TIC, true >::Exec(), and operator[]().
|
friend |
Calculates contacts and transmissions; accesses private methods and data.
Definition at line 84 of file ContactPool.h.
|
private |
Index of the first immune member in the ContactPool.
Definition at line 87 of file ContactPool.h.
Referenced by AddMember(), stride::Infector< LL, TIC, true >::Exec(), and SortMembers().
|
private |
The ID of the ContactPool (for logging purposes).
Definition at line 88 of file ContactPool.h.
Referenced by GetId().
|
private |
The type of the ContactPool (for logging and testing purposes).
Definition at line 89 of file ContactPool.h.
Referenced by stride::Infector< LL, TIC, TO >::Exec(), stride::Infector< LL, TIC, true >::Exec(), and GetType().
|
private |
Pointers to contactpool members (raw pointers intentional).
Definition at line 90 of file ContactPool.h.
Referenced by AddMember(), begin(), end(), stride::Infector< LL, TIC, TO >::Exec(), stride::Infector< LL, TIC, true >::Exec(), GetInfectedCount(), GetPool(), operator[](), size(), and SortMembers().