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

Adaptor: apply a mono-field rule to field I, leave the other fields unchanged. More...

#include <tpl_ca_multi_field_rule.H>

Public Member Functions

constexpr Field_Slice_Rule (Inner inner)
 Wrap a mono-field rule.
 
template<typename FieldsTuple >
FieldsTuple operator() (const FieldsTuple &cur, const Field_Neighbor_Views_Tuple< FieldsTuple > &nb) const
 Pure-form invocation.
 
template<typename FieldsTuple , std::size_t Rank>
FieldsTuple operator() (const FieldsTuple &cur, const Field_Neighbor_Views_Tuple< FieldsTuple > &nb, const Cell_Context< Rank > &ctx) const
 Contextual-form invocation.
 

Private Attributes

Inner inner_
 

Detailed Description

template<std::size_t I, typename Inner>
class Aleph::CA::Field_Slice_Rule< I, Inner >

Adaptor: apply a mono-field rule to field I, leave the other fields unchanged.

Lets the user reuse any existing RuleLike (Game of Life, outer-totalistic, continuous, lookup, ...) on a single channel of a multi-field lattice without touching the other channels. The inner rule sees only field I's current value and field I's neighbours.

Template Parameters
Iindex of the targeted field.
Innermono-field rule type.

Definition at line 181 of file tpl_ca_multi_field_rule.H.

Constructor & Destructor Documentation

◆ Field_Slice_Rule()

template<std::size_t I, typename Inner >
constexpr Aleph::CA::Field_Slice_Rule< I, Inner >::Field_Slice_Rule ( Inner  inner)
inlineexplicitconstexpr

Wrap a mono-field rule.

Parameters
[in]innermono-field rule (consumed by move).

Definition at line 189 of file tpl_ca_multi_field_rule.H.

Member Function Documentation

◆ operator()() [1/2]

Pure-form invocation.

Template Parameters
FieldsTuplelattice's std::tuple<Fields...>.
Parameters
[in]curcurrent per-field values.
[in]nbper-field neighbour views.
Returns
tuple where field I is replaced by inner(cur, nb) and the other fields keep their current values.

Definition at line 200 of file tpl_ca_multi_field_rule.H.

References Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::Field_Slice_Rule< I, Inner >::inner_, and out.

◆ operator()() [2/2]

template<std::size_t I, typename Inner >
template<typename FieldsTuple , std::size_t Rank>
FieldsTuple Aleph::CA::Field_Slice_Rule< I, Inner >::operator() ( const FieldsTuple &  cur,
const Field_Neighbor_Views_Tuple< FieldsTuple > &  nb,
const Cell_Context< Rank > &  ctx 
) const
inline

Contextual-form invocation.

Forwards the context to inner when it accepts it.

Definition at line 214 of file tpl_ca_multi_field_rule.H.

References Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::Field_Slice_Rule< I, Inner >::inner_, and out.

Member Data Documentation

◆ inner_


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