Utopia 2
Framework for studying models of complex & adaptive systems.
Loading...
Searching...
No Matches
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

namespace  Utopia
 
namespace  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.
 
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.
 

Enumerations

enum class  Utopia::Shuffle { Utopia::Shuffle::on , Utopia::Shuffle::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
 
template<class Tuple , std::size_t... I>
constexpr decltype(autoUtopia::make_tuple_from_tuple_impl (Tuple &&t, std::index_sequence< I... >)
 Helper function to create a tuple from a tuple using an index sequence.
 
template<class Tuple >
constexpr decltype(autoUtopia::make_tuple_from_tuple (Tuple &&t)
 Helper function to create a tuple from a tuple.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
template<class Rule , class Container , bool sync = impl::entity_t<Container>::is_sync()>
std::enable_if_t< sync, voidUtopia::apply_rule (const Rule &rule, const Container &container)
 Apply a rule synchronously on the state of all entities of a container.
 
template<bool shuffle = true, class Rule , class Container , bool sync = impl::entity_t<Container>::is_sync()>
std::enable_if_t< not sync &&not shuffle, voidUtopia::apply_rule (const Rule &rule, const Container &container)
 Apply a rule on asynchronous states without prior shuffling.
 
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, voidUtopia::apply_rule (const Rule &rule, const Container &container, RNG &&rng)
 Apply a rule on asynchronous states with prior shuffling.