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

Adapt a regular cell rule (with empty neighborhood) to a block rule. More...

#include <tpl_ca_block_rule.H>

Public Member Functions

constexpr Cell_Rule_As_Block_Rule (Cell_Rule cr)
 Wrap cr as a block rule.
 
template<typename State >
constexpr Block_2x2< State > operator() (const Block_2x2< State > &in) const
 Apply the wrapped rule to every cell of the 2×2 block.
 

Private Attributes

Cell_Rule cell_
 

Detailed Description

template<typename Cell_Rule>
class Aleph::CA::Cell_Rule_As_Block_Rule< Cell_Rule >

Adapt a regular cell rule (with empty neighborhood) to a block rule.

Wraps a RuleLike cell rule whose transition depends only on its own state and applies it independently to every cell of the block. This is the trivial bridge that makes simple per-cell updates available to any Block_Rule consumer (e.g. Margolus_Update).

The wrapped rule must be invocable as cell_rule(state) returning the next state, mirroring an "outer 0-arg" (no neighbours) form.

Template Parameters
Cell_Rulewrapped cell-rule type.

Definition at line 347 of file tpl_ca_block_rule.H.

Constructor & Destructor Documentation

◆ Cell_Rule_As_Block_Rule()

template<typename Cell_Rule >
constexpr Aleph::CA::Cell_Rule_As_Block_Rule< Cell_Rule >::Cell_Rule_As_Block_Rule ( Cell_Rule  cr)
inlineexplicitconstexpr

Wrap cr as a block rule.

Parameters
[in]crcell rule (consumed by move).
Exceptions
Anyexception thrown by Cell_Rule's move constructor.

Definition at line 356 of file tpl_ca_block_rule.H.

Member Function Documentation

◆ operator()()

template<typename Cell_Rule >
template<typename State >
constexpr Block_2x2< State > Aleph::CA::Cell_Rule_As_Block_Rule< Cell_Rule >::operator() ( const Block_2x2< State > &  in) const
inlineconstexpr

Apply the wrapped rule to every cell of the 2×2 block.

Template Parameters
Statecell state type.
Parameters
[in]incurrent 2×2 block.
Returns
next 2×2 block.
Exceptions
Anyexception propagated by the wrapped cell rule.

Definition at line 365 of file tpl_ca_block_rule.H.

References Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::Cell_Rule_As_Block_Rule< Cell_Rule >::cell_, and out.

Member Data Documentation

◆ cell_


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