Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::CA::Composite_Rule< Rules > Class Template Reference

Sequential composition of one or more rules. More...

#include <tpl_ca_rule.H>

Public Member Functions

constexpr Composite_Rule (Rules... rs)
 Construct a sequential composition of rules.
 
template<typename State >
constexpr State operator() (const State &current, Neighbor_View< State > neighbours) const
 Apply every composed rule to the same neighbour view.
 

Private Attributes

std::tuple< Rules... > rules_
 

Detailed Description

template<typename... Rules>
class Aleph::CA::Composite_Rule< Rules >

Sequential composition of one or more rules.

Composite_Rule<R1, R2, ..., Rn> applies R1 first, then R2 on the resulting state, and so on. The neighbour view passed to every stage is the same (read at the start of the step), which is the standard semantics for layered totalistic rules.

Template Parameters
Rulesrule types applied from left to right.

Definition at line 455 of file tpl_ca_rule.H.

Constructor & Destructor Documentation

◆ Composite_Rule()

template<typename... Rules>
constexpr Aleph::CA::Composite_Rule< Rules >::Composite_Rule ( Rules...  rs)
inlineexplicitconstexpr

Construct a sequential composition of rules.

Parameters
[in]rsrules applied from left to right.
Exceptions
Anyexception thrown while moving/copying rules.

Definition at line 465 of file tpl_ca_rule.H.

Member Function Documentation

◆ operator()()

template<typename... Rules>
template<typename State >
constexpr State Aleph::CA::Composite_Rule< Rules >::operator() ( const State &  current,
Neighbor_View< State >  neighbours 
) const
inlineconstexpr

Apply every composed rule to the same neighbour view.

Template Parameters
Statecell state type.
Parameters
[in]currentcurrent centre-cell state.
[in]neighboursread-only neighbour values.
Returns
state after all rules have been applied in sequence.
Exceptions
Anyexception thrown by a composed rule.

Definition at line 476 of file tpl_ca_rule.H.

References Aleph::blossom_maximum_cardinality_matching(), r, and Aleph::CA::Composite_Rule< Rules >::rules_.

Member Data Documentation

◆ rules_

template<typename... Rules>
std::tuple<Rules...> Aleph::CA::Composite_Rule< Rules >::rules_
private

Definition at line 457 of file tpl_ca_rule.H.

Referenced by Aleph::CA::Composite_Rule< Rules >::operator()().


The documentation for this class was generated from the following file: