Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
tpl_ca_update_scheme.H File Reference

Phase 13 update-scheme strategies for Aleph::CA. More...

#include <array>
#include <concepts>
#include <cstddef>
#include <cstdint>
#include <random>
#include <span>
#include <type_traits>
#include <utility>
#include <ah-errors.H>
#include <ca-rng.H>
#include <ca-traits.H>
#include <tpl_ca_concepts.H>
#include <tpl_ca_neighborhood.H>
Include dependency graph for tpl_ca_update_scheme.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Aleph::CA::ca_scheme_detail::is_tile< O >
 Detect whether O is a Tile<W, H> instantiation. More...
 
struct  Aleph::CA::ca_scheme_detail::is_tile< Tile< W, H > >
 
struct  Aleph::CA::Synchronous_Update< Order >
 Classical double-buffer synchronous update. More...
 
struct  Aleph::CA::Sequential_Update< Order >
 In-place sequential update (no double buffer). More...
 
struct  Aleph::CA::Random_Asynchronous_Update< Engine_Type >
 Pick one cell at random per sub-step, update it in place. More...
 
struct  Aleph::CA::Block_Synchronous_Update< BlockSize, Order >
 Synchronous update over rotating sub-blocks. More...
 
struct  Aleph::CA::Margolus_Update
 Margolus 2×2 partition update for reversible CAs. More...
 

Namespaces

namespace  Aleph
 Main namespace for Aleph-w library functions.
 
namespace  Aleph::CA
 
namespace  Aleph::CA::ca_scheme_detail
 

Functions

template<typename Coord , typename Cb >
void Aleph::CA::ca_scheme_detail::for_each_coord_1d (const ca_size_t n0, Cb &&cb)
 Iterate every coordinate of a rank-1 lattice in row order.
 
template<typename Coord , typename Cb >
void Aleph::CA::ca_scheme_detail::for_each_coord_2d_row (const ca_size_t n0, const ca_size_t n1, Cb &&cb)
 Iterate every coordinate of a rank-2 lattice in row-major order.
 
template<typename Coord , typename Cb >
void Aleph::CA::ca_scheme_detail::for_each_coord_2d_col (const ca_size_t n0, const ca_size_t n1, Cb &&cb)
 Iterate every coordinate of a rank-2 lattice in column-major order.
 
template<std::size_t W, std::size_t H, typename Coord , typename Cb >
void Aleph::CA::ca_scheme_detail::for_each_coord_2d_tile (const ca_size_t n0, const ca_size_t n1, Cb &&cb)
 Iterate a rank-2 lattice in H × W tiles (cache-friendly).
 
template<typename Coord , typename Cb >
void Aleph::CA::ca_scheme_detail::for_each_coord_3d_row (const ca_size_t n0, const ca_size_t n1, const ca_size_t n2, Cb &&cb)
 Iterate every coordinate of a rank-3 lattice in row-major order.
 
template<typename Order , typename Lattice , typename Cb >
void Aleph::CA::ca_scheme_detail::for_each_coord (const Lattice &lat, Cb &&cb)
 Visit every coordinate of lat honouring the chosen Order.
 
template<typename Lattice >
ca_size_t Aleph::CA::ca_scheme_detail::cell_count (const Lattice &lat) noexcept
 Total cell count of a lattice (product of extents).
 
template<std::size_t Rank>
Coord_Vec< Rank > Aleph::CA::ca_scheme_detail::coord_from_hash (std::uint64_t h, const std::array< ca_size_t, Rank > &ext) noexcept
 Decode a 64-bit hash into a coordinate uniformly drawn over extents.
 

Variables

template<typename O >
constexpr bool Aleph::CA::ca_scheme_detail::is_tile_v = is_tile<O>::value
 

Detailed Description

Phase 13 update-scheme strategies for Aleph::CA.

An update scheme is a strategy that decouples what to compute (the rule and the neighborhood) from how the cells are visited (synchronous double-buffer, sequential in-place, random asynchronous, block-synchronous, Margolus). Combining Lattice × Rule × Update_Scheme exposes the full spectrum of CA update orders without forcing a new engine per scheme.

Catalogue:

  • Synchronous_Update<Order> — the classical double-buffer sweep, equivalent to Synchronous_Engine. Used as the default.
  • Sequential_Update<Order> — in-place sweep (no double buffer); the natural fit for Bak-Tang-Wiesenfeld sandpile and similar relaxation models.
  • Random_Asynchronous_Update<Engine> — pick one cell at random per sub-step, perform n sub-steps per step(). Reproducible via a master seed, even across thread schedulings.
  • Block_Synchronous_Update<BlockSize, Order> — block-based double buffering: rotate which block is updated each step.
  • Margolus_Update — alternates the 2×2 block partition origin between (0,0) and (1,1) on consecutive steps; enables canonical reversible CAs (Critters, BBM, TM Gas).

Every scheme declares two compile-time tags consumed by the Phase 13 engine to size buffers correctly:

static constexpr bool requires_double_buffer;
static constexpr bool requires_block_rule;
Author
Leandro Rabindranath Leon

Definition in file tpl_ca_update_scheme.H.