45# include <gtest/gtest.h>
70 std::array<std::size_t, 2>
extents { 0, 0 };
71 std::array<T, 16> cells { };
73 static std::size_t dimension()
76 std::size_t
size(std::size_t d)
const {
return extents[d]; }
78 T at(
const coord_type & c)
const
80 return cells[c[0] *
extents[1] + c[1]];
83 void set(
const coord_type & c,
const T & v)
85 cells[c[0] *
extents[1] + c[1]] = v;
90 struct Mock_Neighborhood
93 static constexpr std::size_t rank_v = 2;
94 static constexpr std::size_t size_v = 8;
96 std::size_t radius()
const {
return 1; }
97 std::size_t
size()
const {
return size_v; }
100 static void for_each_offset(
const coord_type &,
F &&)
107 template <
typename S>
108 S operator()(
S s)
const {
return s; }
110 template <
typename S>
136 struct Not_A_Lattice {};
139 struct Not_A_Neighborhood {};
149 for (std::size_t i = 0; i <
lat.cells.size(); ++i)
170 EXPECT_EQ(
r(
static_cast<std::uint8_t
>(42)),
static_cast<std::uint8_t
>(42));
Common typedefs and tag types for the Cellular Automata module.
Shape (per-axis sizes) of an mdspan, mixing compile-time and run-time extents.
constexpr extents() noexcept
All-static-or-default-initialised extents (dynamic axes start at 0).
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
std::span< const T > Neighbor_View
Read-only view over a contiguous range of neighbour values.
std::array< ca_index_t, N > Coord_Vec
Default coordinate vector.
Main namespace for Aleph-w library functions.
size_t size(Node *root) noexcept
std::decay_t< typename HeadC::Item_Type > T
Iterate the lattice in column-major (Fortran) order.
Out-of-range neighbours behave as if the lattice ended.
Out-of-range coordinates mirror back into the lattice.
Iterate the lattice in row-major (C) order.
The lattice wraps around on every axis.
C++20 concepts for the Cellular Automata module.