31 vector<pair<shared_ptr<Location>,
int>> locations;
34 auto totalPopulation = 0U;
36 for (
const CSVRow& row : reader) {
40 const auto loc = make_shared<Location>(row.GetValue<
int>(0), row.GetValue<
int>(1),
41 Coordinate(row.GetValue<
double>(6), row.GetValue<
double>(5)),
44 locations.emplace_back(loc, row.GetValue<
int>(2));
45 totalPopulation += row.GetValue<
int>(2);
48 for (
const auto& l : locations) {
49 l.first->SetPopFraction(static_cast<double>(l.second) / static_cast<double>(totalPopulation));
Create an abstract Reader which fills a GeoGrid with the cities found in file.
Utilities for the project.
void AddLocation(std::shared_ptr< Location > location)
Adds a location to this GeoGrid.
void FillGeoGrid(GeoGrid &geoGrid) const override
Add the locations read to the GeoGrid.
A Geographic grid of simulation region contains Locations that in turn contain an index to the Contac...
Namespace for the geographic and demograhic classes.
boost::geometry::model::point< double, 2, boost::geometry::cs::geographic< boost::geometry::degree >> Coordinate
std::unique_ptr< std::istream > m_inputStream
The istream with the file content.
A collection of CSVRow elements.
Header file of base class for config that needs to be read from a file.
Header file of base class for config that needs to be read from a file.
LocationsCSVReader(std::unique_ptr< std::istream > inputStream)
Construct the CitiesCSVReader that reads istream CSV data.