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

Synchronous double-buffered engine for cellular automata. More...

#include <array>
#include <concepts>
#include <cstddef>
#include <functional>
#include <span>
#include <type_traits>
#include <utility>
#include <ca-traits.H>
#include <tpl_ca_concepts.H>
#include <tpl_ca_neighborhood.H>
Include dependency graph for tpl_ca_engine.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_engine_detail::is_tile< O >
 Detect whether O is a Tile<W, H> instantiation. More...
 
struct  Aleph::CA::ca_engine_detail::is_tile< Tile< W, H > >
 
class  Aleph::CA::Synchronous_Engine< Lattice, Rule, Neighborhood, Order >
 Synchronous double-buffered engine. More...
 

Namespaces

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

Functions

template<typename Coord , typename F >
void Aleph::CA::ca_engine_detail::iterate_1d (ca_size_t n0, F &&f)
 1D row-major iteration callback f(coord).
 
template<typename Coord , typename F >
void Aleph::CA::ca_engine_detail::iterate_2d_row_major (ca_size_t n0, ca_size_t n1, F &&f)
 2D row-major iteration.
 
template<typename Coord , typename F >
void Aleph::CA::ca_engine_detail::iterate_2d_column_major (ca_size_t n0, ca_size_t n1, F &&f)
 2D column-major iteration.
 
template<std::size_t W, std::size_t H, typename Coord , typename F >
void Aleph::CA::ca_engine_detail::iterate_2d_tile (const ca_size_t n0, const ca_size_t n1, F &&f)
 2D tiled iteration with tile size H along axis 0 and W along axis 1.
 
template<typename Coord , typename F >
void Aleph::CA::ca_engine_detail::iterate_3d_row_major (const ca_size_t n0, const ca_size_t n1, const ca_size_t n2, F &&f)
 3D row-major iteration.
 

Variables

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

Detailed Description

Synchronous double-buffered engine for cellular automata.

Synchronous_Engine<Lattice, Rule, Neighborhood, Order> is the Phase 3 core of Aleph::CA. It owns a current / next pair of lattices (with O(1) swap) and applies the rule to every cell in the order chosen by Order (RowMajor by default; Tile<W, H> for a cache-friendly 2D schedule).

Design constraints:

  • The neighbour values needed by the rule are gathered into a stack buffer of compile-time size Neighborhood::size_v. No heap allocation happens inside step().
  • frame() only exposes the current buffer; the engine never lets the caller mistake next for current.
  • The optional pre/post-step hooks are stored as std::function and invoked synchronously around each step(). Phase 7 will replace them with a richer Observer concept.
Author
Leandro Rabindranath Leon

Definition in file tpl_ca_engine.H.