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

Cellular automata lattice with pluggable boundary policies. More...

#include <cstddef>
#include <limits>
#include <type_traits>
#include <utility>
#include <ah-errors.H>
#include <ca-traits.H>
#include <tpl_ca_concepts.H>
Include dependency graph for tpl_ca_lattice.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_lattice_detail::is_constant_boundary< B >
 True iff B is a ConstantBoundary<T, V>. More...
 
struct  Aleph::CA::ca_lattice_detail::is_constant_boundary< ConstantBoundary< T, V > >
 
class  Aleph::CA::Lattice< Storage, Boundary >
 Lattice that adds boundary-aware access on top of a storage. More...
 

Namespaces

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

Functions

ca_size_t Aleph::CA::ca_lattice_detail::magnitude (const ca_index_t c) noexcept
 
ca_size_t Aleph::CA::ca_lattice_detail::wrap_into_range (ca_index_t c, const ca_size_t n) noexcept
 Wrap a signed coordinate into [0, n) with positive modulo.
 
ca_size_t Aleph::CA::ca_lattice_detail::reflect_into_range (const ca_index_t c, const ca_size_t n) noexcept
 Reflect a signed coordinate into [0, n) (no-repeat triangle wave).
 
template<typename Storage , typename Boundary >
void Aleph::CA::swap (Lattice< Storage, Boundary > &a, Lattice< Storage, Boundary > &b) noexcept(noexcept(a.swap(b)))
 Free-function swap so the lattice plays nicely with std::swap.
 

Variables

template<typename B >
constexpr bool Aleph::CA::ca_lattice_detail::is_constant_boundary_v = is_constant_boundary<B>::value
 

Detailed Description

Cellular automata lattice with pluggable boundary policies.

Provides Aleph::CA::Lattice<Storage, Boundary> — a thin layer on top of any CA::Lattice-conformant storage that adds boundary-aware access via at_safe(coord). The Boundary tag type drives the resolution of out-of-range coordinates at compile time:

  • OpenBoundary — out-of-range cells read as state_type{}.
  • ToroidalBoundary — coordinates wrap around on every axis.
  • ReflectiveBoundary — coordinates mirror back into the lattice (no-repeat reflection).
  • ConstantBoundary<T, V> — out-of-range cells read as V (Dirichlet condition).
  • NeumannBoundary — coordinates clamp to the nearest in-range cell (zero-gradient).

Strict access (at, set) goes straight through the storage and retains the storage's bounds-checking. Use at_safe only when the caller may legitimately provide out-of-range coordinates (e.g., a neighbourhood iterating across a corner).

Author
Leandro Rabindranath Leon

Definition in file tpl_ca_lattice.H.