13#include "concepts.hpp"
22 int constexpr inline num_extra_vertices()
const {
return 0; }
30 template <
class Graph>
31 void operator()([[maybe_unused]]
typename Graph::vertex_descriptor s, [[maybe_unused]] Graph &
graph,
43 int constexpr inline num_extra_vertices()
const {
return 1; }
51 template <
class Graph>
54 using edge_property =
typename Graph::edge_property;
55 int num_land_vertices = grid.width() * grid.height();
56 int sink = num_land_vertices;
57 assert(
graph.num_vertices() ==
sink + 1 );
67 int constexpr inline num_extra_vertices()
const {
return 0; }
75 template <
class Graph>
78 using edge_property =
typename Graph::edge_property;
79 auto width = grid.width();
80 auto height = grid.height();
81 int symmetricIndex = 0;
86 symmetricIndex = s + width * (height - 1);
89 else if (s >= (height - 1) * width)
91 symmetricIndex = s - (height - 1) * width;
94 else if (s % width == 0)
96 symmetricIndex = s + width - 1;
99 else if ((s + 1) % width == 0)
101 symmetricIndex = s - width + 1;
Individuals can not escape the landscape's borders.
Definition bound_policy.hpp:20
void operator()(typename Graph::vertex_descriptor s, Graph &graph, const two_dimensional auto &grid) const
Does nothing as by default the bounding box is reflective.
Definition bound_policy.hpp:31
Individuals can migrate out of the landscape to a sink vertex, but can not come back.
Definition bound_policy.hpp:40
void operator()(typename Graph::vertex_descriptor s, Graph &graph, const two_dimensional auto &grid) const
Connect source vertex s to a sink vertex if on the border.
Definition bound_policy.hpp:52
The 2D landscape becomes a 3D torus connecting opposed borders.
Definition bound_policy.hpp:65
void operator()(typename Graph::vertex_descriptor s, Graph &graph, const two_dimensional auto &grid) const
Connect edges of source vertex s in a graph given a spatial grid.
Definition bound_policy.hpp:76
Concept to represent a 2D spatial grid.
Definition concepts.hpp:96
Geospatial data formatting and processing.
Definition geography.hpp:17
Definition concepts.hpp:31