Stride Reference Manual  - generated for commit 9643b11
geopop::Location Class Reference

Location for use within the GeoGrid, contains Coordinate and index to ContactPools. More...

#include <Location.h>

Collaboration diagram for geopop::Location:
Collaboration graph

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
 

Detailed Description

Location for use within the GeoGrid, contains Coordinate and index to ContactPools.

Definition at line 41 of file Location.h.

Constructor & Destructor Documentation

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.

Member Function Documentation

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.

Here is the call graph for this function:

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.

const Coordinate geopop::Location::GetCoordinate ( ) const
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().

Here is the caller graph for this function:

unsigned int geopop::Location::GetID ( ) const
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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

std::string geopop::Location::GetName ( ) const
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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

unsigned int geopop::Location::GetPopCount ( ) const
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().

Here is the caller graph for this function:

unsigned int geopop::Location::GetProvince ( ) const
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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

void geopop::Location::SetCoordinate ( const Coordinate coordinate)
inline

Sets the Coordinate of this Location.

Definition at line 87 of file Location.h.

References m_coordinate, SetPopCount(), and SetPopFraction().

Here is the call graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

const stride::util::SegmentedVector<stride::ContactPool*>& geopop::Location::CRefPools ( stride::ContactType::Id  id) const
inline

Access through const reference to ContactPools of type 'id'.

Parameters
idContactType::Id of pools container you want to access.
Returns
The requested reference.

Definition at line 99 of file Location.h.

References m_pool_index.

Referenced by operator==().

Here is the caller graph for this function:

template<stride::ContactType::Id T>
const stride::util::SegmentedVector<stride::ContactPool*>& geopop::Location::CRefPools ( ) const
inline

Templated version of for use when the type id is fixed.

Template Parameters
TContactType::Id of pools container you want to access.
Returns
The requested reference.

Definition at line 108 of file Location.h.

References m_pool_index.

Referenced by operator==().

Here is the caller graph for this function:

stride::util::SegmentedVector<stride::ContactPool*>& geopop::Location::RefPools ( stride::ContactType::Id  id)
inline

Access through reference to ContactPools of type 'id'.

Parameters
idContactType::Id of pools container you want to access.
Returns
The requested reference.

Definition at line 116 of file Location.h.

References m_pool_index.

Referenced by geopop::GeoGridProtoWriter::WriteLocation().

Here is the caller graph for this function:

template<stride::ContactType::Id T>
stride::util::SegmentedVector<stride::ContactPool*>& geopop::Location::RefPools ( )
inline

Templated version of for use when the type id is fixed.

Template Parameters
TContactType::Id of pools container you want to access.
Returns
The requested reference.

Definition at line 125 of file Location.h.

References m_pool_index.

void geopop::Location::RegisterPool ( stride::ContactPool p,
stride::ContactType::Id  typeId 
)
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().

Here is the caller graph for this function:

template<stride::ContactType::Id T>
void geopop::Location::RegisterPool ( stride::ContactPool p)
inline

Templated version of .

Definition at line 139 of file Location.h.

References m_pool_index.

const std::vector<std::pair<Location*, double> >& geopop::Location::CRefIncomingCommutes ( ) const
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==().

Here is the caller graph for this function:

const std::vector<std::pair<Location*, double> >& geopop::Location::CRefOutgoingCommutes ( ) const
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().

Here is the caller graph for this function:

Member Data Documentation

Coordinate geopop::Location::m_coordinate
private

Coordinate of the Location.

Definition at line 152 of file Location.h.

Referenced by GetCoordinate(), and SetCoordinate().

unsigned int geopop::Location::m_id = 0U
private

Id.

Definition at line 153 of file Location.h.

Referenced by GetID().

std::string geopop::Location::m_name
private

Name.

Definition at line 154 of file Location.h.

Referenced by GetName().

unsigned int geopop::Location::m_pop_count
private

Population count (number of individuals) at this Location.

Definition at line 155 of file Location.h.

Referenced by GetOutgoingCommuteCount(), GetPopCount(), and SetPopCount().

double geopop::Location::m_pop_fraction
private

Fraction of whole population at this Location.

Definition at line 156 of file Location.h.

Referenced by GetPopFraction(), SetPopCount(), and SetPopFraction().

unsigned int geopop::Location::m_province
private

Province id.

Definition at line 157 of file Location.h.

Referenced by GetProvince().

std::vector<std::pair<Location*, double> > geopop::Location::m_inCommutes
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().

std::vector<std::pair<Location*, double> > geopop::Location::m_outCommutes
private

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().

Definition at line 166 of file Location.h.

Referenced by CRefPools(), RefPools(), and RegisterPool().


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