34 m_logger->trace(
"Starting to populate Secondary Communities");
36 for (
const auto& loc : geoGrid) {
37 if (loc->GetPopCount() == 0) {
41 const auto& nearbyPools = geoGrid.GetNearbyPools(Id::SecondaryCommunity, *loc);
43 if (nearbyPools.empty()) {
48 const auto& households = loc->RefPools(Id::Household);
50 auto hh_per_comm = households.size() / nearbyPools.size();
51 auto remainder = households.size() % nearbyPools.size();
52 auto current_comm = 0U;
53 auto current_hh_in_comm = 0U;
55 for (
const auto& housePool : households) {
56 if ((current_hh_in_comm == hh_per_comm && (!remainder || current_comm >= remainder)) ||
57 (current_hh_in_comm == hh_per_comm + 1 && (remainder && current_comm < remainder))) {
59 current_hh_in_comm = 0;
62 auto pool = nearbyPools[current_comm];
63 for (
auto p : *housePool) {
65 p->SetPoolId(Id::SecondaryCommunity, pool->GetId());
70 m_logger->trace(
"Done populating Secondary Communities");
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.
A Geographic grid of simulation region contains Locations that in turn contain an index to the Contac...
Namespace for the geographic and demograhic classes.
Populator uses geo & pop data to populate ContactPools in the GeoGrid.
Namespace for the simulator and related classes.
Namespace to manage types of ContactPool.