Utopia  2
Framework for studying models of complex & adaptive systems.
Classes | Namespaces | Typedefs | Enumerations | Functions
apply.hh File Reference
#include <type_traits>
#include <vector>
#include "parallel.hh"
#include "state.hh"
#include "zip.hh"
Include dependency graph for apply.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Utopia::rule_invoke_result< State, Rule, Args >
 Helper class for checking rule signatures and return types. More...
 

Namespaces

 Utopia
 
 Utopia::impl
 

Typedefs

template<class Container >
using Utopia::impl::entity_t = typename Container::value_type::element_type
 Return the element type of any container holding pointers to entities. More...
 
template<typename State , typename Rule , typename... Args>
using Utopia::rule_invoke_result_t = typename rule_invoke_result< State, Rule, Args... >::type
 Helper definition to query the rule result type. More...
 

Enumerations

enum class  Utopia::Shuffle { Utopia::on , Utopia::off }
 Switch for enabling/disabling shuffling the cells for asynchronous updates. More...
 

Functions

template<typename State , typename Rule , typename... Args>
constexpr bool Utopia::is_void_rule ()
 Helper function to check if the rule returns void More...
 
template<class Tuple , std::size_t... I>
constexpr decltype(auto) Utopia::make_tuple_from_tuple_impl (Tuple &&t, std::index_sequence< I... >)
 Helper function to create a tuple from a tuple using an index sequence. More...
 
template<class Tuple >
constexpr decltype(auto) Utopia::make_tuple_from_tuple (Tuple &&t)
 Helper function to create a tuple from a tuple. More...
 
template<Update mode, class Rule , class ContTarget , class... ContArgs, typename std::enable_if_t< mode==Update::sync, int > = 0, typename std::enable_if_t< impl::entity_t< ContTarget >::mode==Update::manual, int > = 0>
void Utopia::apply_rule (Rule &&rule, const ContTarget &cont_target, ContArgs &&... cont_args)
 Sequential overload. More...
 
template<Update mode, class Rule , class ContTarget , class... ContArgs, typename std::enable_if_t< mode==Update::sync, int > = 0, typename std::enable_if_t< impl::entity_t< ContTarget >::mode==Update::manual, int > = 0>
void Utopia::apply_rule (const Utopia::ExecPolicy policy, Rule &&rule, const ContTarget &cont_target, ContArgs &&... cont_args)
 Apply a rule synchronously to manually updated states. More...
 
template<Update mode, Shuffle shuffle = Shuffle::on, class Rule , class ContTarget , class... ContArgs, typename std::enable_if_t< mode==Update::async, int > = 0, typename std::enable_if_t< impl::entity_t< ContTarget >::mode==Update::manual, int > = 0, typename std::enable_if_t< shuffle==Shuffle::off, int > = 0>
void Utopia::apply_rule (Rule &&rule, const ContTarget &cont_target, ContArgs &&... cont_args)
 Sequential case overload. More...
 
template<Update mode, Shuffle shuffle = Shuffle::on, class Rule , class ContTarget , class... ContArgs, typename std::enable_if_t< mode==Update::async, int > = 0, typename std::enable_if_t< impl::entity_t< ContTarget >::mode==Update::manual, int > = 0, typename std::enable_if_t< shuffle==Shuffle::off, int > = 0>
void Utopia::apply_rule (const Utopia::ExecPolicy policy, Rule &&rule, const ContTarget &cont_target, ContArgs &&... cont_args)
 Apply a rule asynchronously to manually updated states. More...
 
template<Update mode, Shuffle shuffle = Shuffle::on, class Rule , class ContTarget , class RNG , class... ContArgs, typename std::enable_if_t< mode==Update::async, int > = 0, typename std::enable_if_t< impl::entity_t< ContTarget >::mode==Update::manual, int > = 0, typename std::enable_if_t< shuffle==Shuffle::on, int > = 0>
void Utopia::apply_rule (Rule &&rule, const ContTarget &cont_target, RNG &&rng, ContArgs &&... cont_args)
 Sequential case overload. More...
 
template<Update mode, Shuffle shuffle = Shuffle::on, class Rule , class ContTarget , class RNG , class... ContArgs, typename std::enable_if_t< mode==Update::async, int > = 0, typename std::enable_if_t< impl::entity_t< ContTarget >::mode==Update::manual, int > = 0, typename std::enable_if_t< shuffle==Shuffle::on, int > = 0>
void Utopia::apply_rule (const Utopia::ExecPolicy policy, Rule &&rule, const ContTarget &cont_target, RNG &&rng, ContArgs &&... cont_args)
 Apply a rule asynchronously and shuffled to manually updated states. More...
 
template<class Rule , class Container , bool sync = impl::entity_t<Container>::is_sync()>
std::enable_if_t< sync, void > Utopia::apply_rule (const Rule &rule, const Container &container)
 Apply a rule synchronously on the state of all entities of a container. More...
 
template<bool shuffle = true, class Rule , class Container , bool sync = impl::entity_t<Container>::is_sync()>
std::enable_if_t< not sync &&not shuffle, void > Utopia::apply_rule (const Rule &rule, const Container &container)
 Apply a rule on asynchronous states without prior shuffling. More...
 
template<bool shuffle = true, class Rule , class Container , class RNG , bool sync = impl::entity_t<Container>::is_sync()>
std::enable_if_t< not sync &&shuffle, void > Utopia::apply_rule (const Rule &rule, const Container &container, RNG &&rng)
 Apply a rule on asynchronous states with prior shuffling. More...