Utopia 2
Framework for studying models of complex & adaptive systems.
|
Functions | |
template<typename Graph , typename Iter , typename Rule > | |
void | apply_async (Iter it_begin, Iter it_end, Graph &&g, Rule &&rule) |
Apply a rule asynchronously. | |
template<typename Iter , typename Graph , typename Rule > | |
void | apply_sync (Iter it_begin, Iter it_end, Graph &&g, Rule &&rule) |
Apply a rule synchronously. | |
template<IterateOver iterate_over, typename Graph > | |
decltype(auto) | iterator_pair (const Graph &g) |
Get an iterator pair over selected graph entities. | |
template<IterateOver iterate_over, typename Graph , typename EntityDesc > | |
decltype(auto) | iterator_pair (EntityDesc e, const Graph &g) |
Get an iterator pair over selected graph entities. | |
void Utopia::GraphUtils::apply_async | ( | Iter | it_begin, |
Iter | it_end, | ||
Graph && | g, | ||
Rule && | rule | ||
) |
Apply a rule asynchronously.
This helper function applies a rule to a range of entities that is given through an iterator pair one after the other.
Iter | The iterator type |
Graph | The graph type |
Rule | The rule type |
it_begin | The begin of the graph entity iterator range. |
it_end | The end of the graph entity iterator range. |
g | The graph |
rule | The rule function to be applied to each element within the iterator range. |
void Utopia::GraphUtils::apply_sync | ( | Iter | it_begin, |
Iter | it_end, | ||
Graph && | g, | ||
Rule && | rule | ||
) |
Apply a rule synchronously.
This helper function applies a rule to a range of entities that is given through an iterator pair. A state cache is created that stores the returned states of the rule function. After the rule was applied to each graph entity within the iterator range the cached states are moved to the actual states of the graph entities, thus, updating their states synchronously.
Iter | The iterator type |
Graph | The graph type |
Rule | The rule type |
it_begin | The begin of the graph entity iterator range. |
it_end | The end of the graph entity iterator range. |
g | The graph |
rule | The rule function to be applied to each element within the iterator range. |
decltype(auto) Utopia::GraphUtils::iterator_pair | ( | const Graph & | g | ) |
Get an iterator pair over selected graph entities.
iterate_over | Specify over which graph entities to iterate Valid options: |
Graph | The graph type |
g | The graph |
decltype(auto) Utopia::GraphUtils::iterator_pair | ( | EntityDesc | e, |
const Graph & | g | ||
) |
Get an iterator pair over selected graph entities.
This function returns the iterator pair wrt. another graph entity. For example iteration over neighbors (adjacent_vertices) needs a references vertex.
iterate_over | Specify over which graph entities to iterate over Valid options:
|
Graph | The graph type |
EntityDesc | The graph entity descriptor that is the reference point for the iteration. |
e | The graph entity that serves as reference |
g | The graph |