40 GOOGLE_PROTOBUF_VERIFY_VERSION;
43 for (
const auto& location : geoGrid) {
50 m_persons_found.clear();
51 if (!protoGrid.SerializeToOstream(&stream)) {
54 google::protobuf::ShutdownProtobufLibrary();
61 static const map<Id, proto::GeoGrid_Location_ContactPools_Type> types = {
69 protoContactPools->
set_type(types.at(typeId));
78 protoContactPool->
set_id(static_cast<google::protobuf::int64>(contactPool->
GetId()));
79 for (
const auto& person : *contactPool) {
88 protoCoordinate->
set_longitude(boost::geometry::get<0>(coordinate));
89 protoCoordinate->
set_latitude(boost::geometry::get<1>(coordinate));
103 for (
auto commute_pair : commutes) {
105 commute->
set_to(commute_pair.first->GetID());
106 commute->set_proportion(commute_pair.second);
117 protoPerson->
set_age(static_cast<google::protobuf::int64>(person->
GetAge()));
unsigned int GetID() const
Gets ID of this Location.
void WritePerson(stride::Person *person, proto::GeoGrid_Person *protoPerson)
Create a ProtoBuf Person containing all the info needed to reconstruct a Person.
std::string GetName() const
Gets the name.
Header file for the Person class.
A group of Persons that potentially have contacts with one another.
stride::util::SegmentedVector< stride::ContactPool * > & RefPools(stride::ContactType::Id id)
Access through reference to ContactPools of type 'id'.
Header for the core ContactPool class.
constexpr std::initializer_list< Id > IdList
To allow iteration over the type ids.
void WriteContactPools(stride::ContactType::Id typeId, stride::util::SegmentedVector< stride::ContactPool * > &contactPools, proto::GeoGrid_Location_ContactPools *protoContactPools)
Create a ProtoBuf ContactPools structure.
void set_id(::google::protobuf::int64 value)
void add_people(::google::protobuf::int64 value)
Utilities for the project.
unsigned int GetProvince() const
Gets the province.
::proto::GeoGrid_Location_ContactPools_ContactPool * add_pools()
void set_allocated_coordinate(::proto::GeoGrid_Location_Coordinate *coordinate)
::proto::GeoGrid_Location * add_locations()
unsigned int GetId() const
Get the id.
::proto::GeoGrid_Location_Commute * add_commutes()
void set_province(::google::protobuf::int64 value)
void set_latitude(double value)
void set_age(::google::protobuf::int64 value)
void set_id(::google::protobuf::int64 value)
void set_type(::proto::GeoGrid_Location_ContactPools_Type value)
unsigned int GetId() const
Get the pool id.
void set_id(::google::protobuf::int64 value)
Interface and implementation for SegmentedVector class.
float GetAge() const
Get the age.
A Geographic grid of simulation region contains Locations that in turn contain an index to the Contac...
void set_to(::google::protobuf::int64 value)
Basic exception class: needed to prevent clang-tidy warning "thrown exception type is not nothrow cop...
::proto::GeoGrid_Person * add_persons()
Container that stores objects "almost contiguously" (in a chain of blocks) and guarantees that pointe...
Definition of ContactPool Id Type.
void WriteCoordinate(const Coordinate &coordinate, proto::GeoGrid_Location_Coordinate *protoCoordinate)
Create a ProtoBuf Coordinate containing all the info needed to reconstruct a Coordinate..
Namespace for the geographic and demograhic classes.
const Coordinate GetCoordinate() const
Gets the Coordinate of this Location.
void WriteContactPool(stride::ContactPool *contactPool, proto::GeoGrid_Location_ContactPools_ContactPool *protoContactPool)
Create a ProtoBuf ContactPool containing all the info needed to reconstruct a ContactPool.
void set_population(::google::protobuf::int64 value)
boost::geometry::model::point< double, 2, boost::geometry::cs::geographic< boost::geometry::degree >> Coordinate
unsigned int GetPopCount() const
Gets the absolute population.
GeoGridProtoWriter()
Construct the GeoGridProtoWriter.
::proto::GeoGrid_Location_ContactPools * add_contactpools()
std::set< stride::Person * > m_persons_found
The persons found when looping over the ContactPools.
Location for use within the GeoGrid, contains Coordinate and index to ContactPools.
Store and handle person data.
void set_name(const ::std::string &value)
void Write(GeoGrid &geoGrid, std::ostream &stream) override
Write the GeoGrid to the ostream in Protobuf format.
void set_longitude(double value)
Namespace to manage types of ContactPool.
void WriteLocation(Location &location, proto::GeoGrid_Location *protoLocation)
Create a ProtoBuf Location containing all the info needed to reconstruct a Location.
const std::vector< std::pair< Location *, double > > & CRefOutgoingCommutes() const
References outgoing commute Locations + fraction of commutes to that Location.