38 const auto communitySize = ggConfig.
people[Id::SecondaryCommunity];
39 const auto communityCount =
static_cast<unsigned int>(ceil(popCount / static_cast<double>(communitySize)));
41 vector<double> weights;
42 for (
const auto& loc : geoGrid) {
43 const auto weight =
static_cast<double>(loc->GetPopCount()) / static_cast<double>(popCount);
44 AssertThrow(weight >= 0 && weight <= 1 && !std::isnan(weight),
45 "SecondaryCommunityGenerator> Invalid weight: " + to_string(weight), m_logger);
46 weights.push_back(weight);
49 if (weights.empty()) {
54 const auto dist = m_rn_man.GetDiscreteGenerator(weights, 0U);
55 auto pop = geoGrid.GetPopulation();
57 for (
auto i = 0U; i < communityCount; i++) {
58 const auto loc = geoGrid[dist()];
59 AddPools(*loc, pop, ggConfig);
Configuration data mostly for generating a population, but also for computing the required number of ...
#define AssertThrow(CONDITION, MESSAGE, LOGGER)
A Geographic grid of simulation region contains Locations that in turn contain an index to the Contac...
unsigned int pop_size
Target population size for the generated population.
Namespace for the geographic and demograhic classes.
stride::ContactType::IdSubscriptArray< unsigned int > people
People per unit (= Household, K12School, College, etc.) for each of the ContactTypes.
struct geopop::GeoGridConfig::@0 param
void Apply(GeoGrid &, const GeoGridConfig &)
Generate ContactPools for ContactType::Id as sepcified by data in GeoGridConfig.
Namespace for the simulator and related classes.
Namespace to manage types of ContactPool.