35 m_logger->trace(
"Starting to populate Colleges");
38 for (
const auto& loc : geoGrid) {
39 if (loc->GetPopCount() == 0) {
43 const auto& nearByCollegePools = geoGrid.GetNearbyPools(Id::College, *loc);
45 AssertThrow(!nearByCollegePools.empty(),
"No College found!", m_logger);
47 const auto distNonCommuting =
48 m_rn_man.GetUniformIntGenerator(0, static_cast<int>(nearByCollegePools.size()), 0U);
51 vector<Location*> commutingCollege;
52 vector<double> commutingWeights;
53 for (
const auto& commute : loc->CRefOutgoingCommutes()) {
54 const auto& cpools = commute.first->CRefPools(Id::College);
55 if (!cpools.empty()) {
56 commutingCollege.push_back(commute.first);
57 commutingWeights.push_back(commute.second);
61 function<int()> disCommuting;
63 if (!commutingWeights.empty()) {
64 disCommuting = m_rn_man.GetDiscreteGenerator(commutingWeights, 0U);
68 for (
const auto& hhPool : loc->RefPools(Id::Household)) {
69 for (
Person* p : *hhPool) {
70 if (AgeBrackets::College::HasAge(p->GetAge()) &&
73 if (!commutingCollege.empty() &&
78 const auto& collegePools =
79 commutingCollege[disCommuting()]->CRefPools(Id::College);
81 auto disPools = m_rn_man.GetUniformIntGenerator(
82 0, static_cast<int>(collegePools.size()), 0U);
83 auto idraw = disPools();
84 collegePools[idraw]->AddMember(p);
85 p->SetPoolId(Id::College, collegePools[idraw]->GetId());
87 auto idraw = distNonCommuting();
88 nearByCollegePools[idraw]->AddMember(p);
89 p->SetPoolId(Id::College, nearByCollegePools[idraw]->GetId());
96 m_logger->trace(
"Done populating Colleges");
Header file for the Person class.
Configuration data mostly for generating a population, but also for computing the required number of ...
Header for the core ContactPool class.
#define AssertThrow(CONDITION, MESSAGE, LOGGER)
A Geographic grid of simulation region contains Locations that in turn contain an index to the Contac...
Namespace for the geographic and demograhic classes.
void Apply(GeoGrid &, const GeoGridConfig &)
Populate the ContactPools type ID. This is a placeholder for the specializations. ...
double fraction_college_commuters
Fraction of college students that commute.
struct geopop::GeoGridConfig::@0 param
double participation_college
Participation of college (fraction of people of college age going to college).
Store and handle person data.
Namespace for the simulator and related classes.
Namespace to manage types of ContactPool.