22 #include <unordered_map> 34 template <
typename Policy,
typename... F>
54 void AddLocation(std::shared_ptr<Location> location);
72 double startRadius = 10.0)
const;
84 std::set<const Location*>
LocationsInBox(
double long1,
double lat1,
double long2,
double lat2)
const;
90 std::vector<Location*>
TopK(
size_t k)
const;
94 template <
typename Policy,
typename F>
98 template <
typename Policy>
std::vector< const Location * > LocationsInRadius(const Location &start, double radius) const
Search for locations in radius (in km) around start.
std::vector< std::shared_ptr< Location >>::iterator iterator
Id
Enumerates the ContactPool types.
stride::Population * GetPopulation() const
Get the Population associated with this GeoGrid.
A GeoAggregator that has to be called with a functor.
GeoGrid operator=(const GeoGrid &)=delete
No copy assignment.
iterator end()
Iterator to the end of the Location storage.
std::vector< std::shared_ptr< Location >>::const_iterator const_iterator
bool m_finalized
Internal KdTree for quick spatial lookup.
const_iterator cbegin() const
Const Iterator to first Location.
iterator begin()
Iterator to first Location.
void AddLocation(std::shared_ptr< Location > location)
Adds a location to this GeoGrid.
GeoGrid(stride::Population *population)
GeoGrid and associated Population.
std::vector< std::shared_ptr< Location > > m_locations
< Container for Locations in GeoGrid.
std::set< const Location * > LocationsInBox(double long1, double lat1, double long2, double lat2) const
Gets the locations in a rectangle determined by the two coordinates (long1, lat1) and (long2...
void Finalize()
Disables the addLocation method and builds the kdtree.
A Geographic grid of simulation region contains Locations that in turn contain an index to the Contac...
std::shared_ptr< Location > & operator[](size_t index)
Gets a Location by index, doesn't performs a range check.
std::vector< Location * > TopK(size_t k) const
Gets the K biggest (in population count) locations of this GeoGrid.
std::unordered_map< unsigned int, unsigned int > m_id_to_index
Stores pointer to Popluation, but does not take ownership.
Key Data structure: container for (a) all individuals in the population (b) the ContactPoolSys wchich...
size_t size() const
Gets current size of Location storage.
Definition of ContactPool Id Type.
Namespace for the geographic and demograhic classes.
GeoAggregator< Policy, F > BuildAggregator(F functor, typename Policy::Args &&args) const
Build a GeoAggregator with a predefined functor and given args for the Policy.
std::shared_ptr< Location > GetById(unsigned int id) const
Gets a Location by Id and check if the Id exists.
A GeoAggregator constructed with a functor.
std::vector< stride::ContactPool * > GetNearbyPools(stride::ContactType::Id id, const Location &start, double startRadius=10.0) const
Find contactpools in startRadius (in km) around start and, if none are found, double the radius and s...
void CheckFinalized(const std::string &functionName) const
< Checks whether the GeoGrid is finalized i.e. certain operations can(not) be used.
stride::Population * m_population
Is the GeoGrid finalized (ready for use) yet?
Location for use within the GeoGrid, contains Coordinate and index to ContactPools.
Namespace for the simulator and related classes.
const std::shared_ptr< Location > & operator[](size_t index) const
Gets a Location by index, doesn't performs a range check.
const_iterator cend() const
Const iterator to the end of the Location storage.