Stride Reference Manual
- generated for commit 9643b11
|
Location for use within the GeoGrid, contains Coordinate and index to ContactPools. More...
#include <Location.h>
Public Member Functions | |
Location (unsigned int id, unsigned int province, Coordinate coordinate=Coordinate(0.0, 0.0), std::string name="", unsigned int popCount=0U) | |
Parametrized constructor with population count. More... | |
bool | operator== (const Location &other) const |
Perform a full comparison with the other location. More... | |
void | AddIncomingCommute (std::shared_ptr< Location > otherLocation, double fraction) |
Adds a Location and a proportion to the incoming commute vector. More... | |
void | AddOutgoingCommute (std::shared_ptr< Location > otherLocation, double fraction) |
Adds a Location and a fraction to the outgoing commute vector. More... | |
const Coordinate | GetCoordinate () const |
Gets the Coordinate of this Location. More... | |
unsigned int | GetID () const |
Gets ID of this Location. More... | |
int | GetIncomingCommuteCount (double fractionCommuters) const |
Calculates number of incomming commuters, given the fraction of the population that commutes. More... | |
unsigned int | GetInfectedCount () const |
Gets the number of people infected in the contactpools at this location. More... | |
std::string | GetName () const |
Gets the name. More... | |
unsigned int | GetOutgoingCommuteCount (double fractionCommuters) const |
Calculates number of outgoing commuters, given the fraction of the population that commutes. More... | |
unsigned int | GetPopCount () const |
Gets the absolute population. More... | |
unsigned int | GetProvince () const |
Gets the province. More... | |
double | GetPopFraction () const |
Get Location's population fraction (of the total populaion count). More... | |
void | SetCoordinate (const Coordinate &coordinate) |
Sets the Coordinate of this Location. More... | |
void | SetPopCount (unsigned int totalPopCount) |
Set Location's population count using its population fraction and the total population count. More... | |
void | SetPopFraction (double relativePopulation) |
Set Location's population fraction (of the total populaion count). More... | |
const stride::util::SegmentedVector< stride::ContactPool * > & | CRefPools (stride::ContactType::Id id) const |
Access through const reference to ContactPools of type 'id'. More... | |
template<stride::ContactType::Id T> | |
const stride::util::SegmentedVector< stride::ContactPool * > & | CRefPools () const |
Templated version of for use when the type id is fixed. More... | |
stride::util::SegmentedVector< stride::ContactPool * > & | RefPools (stride::ContactType::Id id) |
Access through reference to ContactPools of type 'id'. More... | |
template<stride::ContactType::Id T> | |
stride::util::SegmentedVector< stride::ContactPool * > & | RefPools () |
Templated version of for use when the type id is fixed. More... | |
void | RegisterPool (stride::ContactPool *p, stride::ContactType::Id typeId) |
Register a ContactPool pointer in this Location's pool system. More... | |
template<stride::ContactType::Id T> | |
void | RegisterPool (stride::ContactPool *p) |
Templated version of . More... | |
const std::vector< std::pair< Location *, double > > & | CRefIncomingCommutes () const |
References incoming commute Locations + fraction of commutes to that Location. More... | |
const std::vector< std::pair< Location *, double > > & | CRefOutgoingCommutes () const |
References outgoing commute Locations + fraction of commutes to that Location. More... | |
Private Attributes | |
Coordinate | m_coordinate |
Coordinate of the Location. More... | |
unsigned int | m_id = 0U |
Id. More... | |
std::string | m_name |
Name. More... | |
unsigned int | m_pop_count |
Population count (number of individuals) at this Location. More... | |
double | m_pop_fraction |
Fraction of whole population at this Location. More... | |
unsigned int | m_province |
Province id. More... | |
std::vector< std::pair< Location *, double > > | m_inCommutes |
Incomming commutes stored as pair of Location and fraction of population at that Location. More... | |
std::vector< std::pair< Location *, double > > | m_outCommutes |
The system holding pointers to the contactpools (for each type id) at this Location. More... | |
stride::ContactType::IdSubscriptArray< stride::util::SegmentedVector< stride::ContactPool * > > | m_pool_index |
Location for use within the GeoGrid, contains Coordinate and index to ContactPools.
Definition at line 41 of file Location.h.
geopop::Location::Location | ( | unsigned int | id, |
unsigned int | province, | ||
Coordinate | coordinate = Coordinate(0.0, 0.0) , |
||
std::string | name = "" , |
||
unsigned int | popCount = 0U |
||
) |
Parametrized constructor with population count.
Definition at line 30 of file Location.cpp.
bool geopop::Location::operator== | ( | const Location & | other | ) | const |
Perform a full comparison with the other location.
Definition at line 36 of file Location.cpp.
References CRefIncomingCommutes(), CRefOutgoingCommutes(), CRefPools(), GetCoordinate(), GetID(), GetName(), GetPopCount(), GetProvince(), and stride::ContactType::IdList.
void geopop::Location::AddIncomingCommute | ( | std::shared_ptr< Location > | otherLocation, |
double | fraction | ||
) |
Adds a Location and a proportion to the incoming commute vector.
I.e. fraction of commuting population at otherLocation commuting to this Location.
Definition at line 51 of file Location.cpp.
References m_inCommutes.
void geopop::Location::AddOutgoingCommute | ( | std::shared_ptr< Location > | otherLocation, |
double | fraction | ||
) |
Adds a Location and a fraction to the outgoing commute vector.
I.e. fraction of commuting population at this Location commuting to otherLocation.
Definition at line 56 of file Location.cpp.
References m_outCommutes.
|
inline |
Gets the Coordinate of this Location.
Definition at line 60 of file Location.h.
References m_coordinate.
Referenced by geopop::GeoGrid::LocationsInBox(), operator==(), geopop::GeoGridJSONWriter::WriteLocation(), and geopop::GeoGridProtoWriter::WriteLocation().
|
inline |
Gets ID of this Location.
Definition at line 63 of file Location.h.
References GetIncomingCommuteCount(), GetInfectedCount(), and m_id.
Referenced by operator==(), geopop::GeoGridJSONWriter::WriteLocation(), and geopop::GeoGridProtoWriter::WriteLocation().
int geopop::Location::GetIncomingCommuteCount | ( | double | fractionCommuters | ) | const |
Calculates number of incomming commuters, given the fraction of the population that commutes.
Definition at line 61 of file Location.cpp.
References m_inCommutes.
Referenced by GetID().
unsigned int geopop::Location::GetInfectedCount | ( | ) | const |
Gets the number of people infected in the contactpools at this location.
Definition at line 71 of file Location.cpp.
Referenced by GetID().
|
inline |
Gets the name.
Definition at line 72 of file Location.h.
References GetOutgoingCommuteCount(), and m_name.
Referenced by operator==(), geopop::GeoGridJSONWriter::WriteLocation(), and geopop::GeoGridProtoWriter::WriteLocation().
unsigned int geopop::Location::GetOutgoingCommuteCount | ( | double | fractionCommuters | ) | const |
Calculates number of outgoing commuters, given the fraction of the population that commutes.
Definition at line 83 of file Location.cpp.
References m_outCommutes, and m_pop_count.
Referenced by GetName().
|
inline |
Gets the absolute population.
Definition at line 78 of file Location.h.
References m_pop_count.
Referenced by operator==(), geopop::GeoGrid::TopK(), geopop::GeoGridJSONWriter::WriteLocation(), and geopop::GeoGridProtoWriter::WriteLocation().
|
inline |
Gets the province.
Definition at line 81 of file Location.h.
References GetPopFraction(), and m_province.
Referenced by operator==(), geopop::GeoGridJSONWriter::WriteLocation(), and geopop::GeoGridProtoWriter::WriteLocation().
double geopop::Location::GetPopFraction | ( | ) | const |
Get Location's population fraction (of the total populaion count).
Definition at line 93 of file Location.cpp.
References m_pop_fraction.
Referenced by GetProvince().
|
inline |
Sets the Coordinate of this Location.
Definition at line 87 of file Location.h.
References m_coordinate, SetPopCount(), and SetPopFraction().
void geopop::Location::SetPopCount | ( | unsigned int | totalPopCount | ) |
Set Location's population count using its population fraction and the total population count.
Definition at line 95 of file Location.cpp.
References m_pop_count, and m_pop_fraction.
Referenced by SetCoordinate().
void geopop::Location::SetPopFraction | ( | double | relativePopulation | ) |
Set Location's population fraction (of the total populaion count).
Definition at line 99 of file Location.cpp.
References m_pop_fraction.
Referenced by SetCoordinate().
|
inline |
Access through const reference to ContactPools of type 'id'.
id | ContactType::Id of pools container you want to access. |
Definition at line 99 of file Location.h.
References m_pool_index.
Referenced by operator==().
|
inline |
Templated version of for use when the type id is fixed.
T | ContactType::Id of pools container you want to access. |
Definition at line 108 of file Location.h.
References m_pool_index.
Referenced by operator==().
|
inline |
Access through reference to ContactPools of type 'id'.
id | ContactType::Id of pools container you want to access. |
Definition at line 116 of file Location.h.
References m_pool_index.
Referenced by geopop::GeoGridProtoWriter::WriteLocation().
|
inline |
Templated version of for use when the type id is fixed.
T | ContactType::Id of pools container you want to access. |
Definition at line 125 of file Location.h.
References m_pool_index.
|
inline |
Register a ContactPool pointer in this Location's pool system.
Prior to this the pool should have been created in Population's pool system.
Definition at line 132 of file Location.h.
References m_pool_index.
Referenced by geopop::Generator< ID >::AddPools().
|
inline |
|
inline |
References incoming commute Locations + fraction of commutes to that Location.
Definition at line 146 of file Location.h.
References m_inCommutes.
Referenced by operator==().
|
inline |
References outgoing commute Locations + fraction of commutes to that Location.
Definition at line 149 of file Location.h.
References m_outCommutes.
Referenced by operator==(), geopop::GeoGridJSONWriter::WriteLocation(), and geopop::GeoGridProtoWriter::WriteLocation().
|
private |
Coordinate of the Location.
Definition at line 152 of file Location.h.
Referenced by GetCoordinate(), and SetCoordinate().
|
private |
|
private |
|
private |
Population count (number of individuals) at this Location.
Definition at line 155 of file Location.h.
Referenced by GetOutgoingCommuteCount(), GetPopCount(), and SetPopCount().
|
private |
Fraction of whole population at this Location.
Definition at line 156 of file Location.h.
Referenced by GetPopFraction(), SetPopCount(), and SetPopFraction().
|
private |
Incomming commutes stored as pair of Location and fraction of population at that Location.
Outgoing commutes stored as pair of Location and fraction of population to this this Location.
Definition at line 160 of file Location.h.
Referenced by AddIncomingCommute(), CRefIncomingCommutes(), and GetIncomingCommuteCount().
The system holding pointers to the contactpools (for each type id) at this Location.
Definition at line 163 of file Location.h.
Referenced by AddOutgoingCommute(), CRefOutgoingCommutes(), and GetOutgoingCommuteCount().
|
private |
Definition at line 166 of file Location.h.
Referenced by CRefPools(), RefPools(), and RegisterPool().