|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Namespaces | |
| namespace | Bench |
| namespace | ca_async_engine_detail |
| namespace | ca_block_rule_detail |
| namespace | ca_checkpoint_detail |
| namespace | ca_checkpoint_flags |
Bitset values used in Checkpoint_Header::flags (v2+). | |
| namespace | ca_continuous_detail |
| namespace | ca_dot_detail |
| namespace | ca_engine_detail |
| namespace | ca_ffmpeg_detail |
| namespace | ca_frame_stream_detail |
| namespace | ca_ghost_detail |
| namespace | ca_gif_detail |
| namespace | ca_hashlife_detail |
| namespace | ca_html_detail |
| namespace | ca_io_detail |
| namespace | ca_ising_detail |
| namespace | ca_lattice_detail |
| namespace | ca_metrics_detail |
| namespace | ca_mf_detail |
| namespace | ca_mf_engine_detail |
| namespace | ca_mf_rule_detail |
| namespace | ca_neighborhood_detail |
| namespace | ca_npy_detail |
| namespace | ca_parallel_detail |
| namespace | ca_png_detail |
| namespace | ca_rule_detail |
| namespace | ca_scheme_detail |
| namespace | ca_stream_detail |
| namespace | ca_svg_detail |
| namespace | ca_tikz_detail |
| namespace | ca_tiling_detail |
| namespace | ca_vtk_detail |
| namespace | Reproductions |
Classes | |
| class | Activity_Observer |
| Records the number of cells that changed across each step. More... | |
| class | Ascii_Frame_Sink |
| Stream sink that writes textual frames to an output stream. More... | |
| struct | Ascii_Render_Options |
| Options for textual CA rendering. More... | |
| class | Async_Checkpoint_Writer |
| Background writer pumping snapshots onto a dedicated thread. More... | |
| class | Async_Engine |
| Update-scheme aware engine. More... | |
| class | BBM_Rule |
| Fredkin–Toffoli Billiard Ball Machine block rule. More... | |
| class | Bench_Timer |
| Tiny start/stop wall-clock timer. More... | |
| struct | Binary_ANSI24_Palette |
| ANSI 24-bit colour palette for binary frames. More... | |
| struct | Binary_ASCII_Palette |
| Default binary text palette. More... | |
| struct | Binary_Cell_Pattern |
| Binary pattern shared by RLE, plaintext and Life formats. More... | |
| struct | Binary_DOT_Palette |
| Default binary DOT fill-colour palette. More... | |
| struct | Binary_Gray_Mapper |
| Default binary grayscale mapper. More... | |
| struct | Binary_RGB_Mapper |
| Default binary RGB mapper. More... | |
| struct | Binary_Tikz_Palette |
| Default binary TikZ palette. More... | |
| class | Bit_Cell_Storage |
Bit-packed row-major storage for N-dimensional binary CAs. More... | |
| struct | Block_Partition_2D |
2D blocked partitioning into a grid of parts_y x parts_x. More... | |
| struct | Block_Synchronous_Update |
| Synchronous update over rotating sub-blocks. More... | |
| struct | Cell_Context |
| Per-cell context handed to rules that need to know "where" and "when" they are firing. More... | |
| class | Cell_Rule_As_Block_Rule |
| Adapt a regular cell rule (with empty neighborhood) to a block rule. More... | |
| struct | Checkpoint_Header |
Public on-disk header surfaced by inspect_checkpoint. More... | |
| struct | Checkpoint_Options |
User-tunable knobs for save_checkpoint. More... | |
| struct | Column_Partition |
| Column partitioning along the last axis. More... | |
| struct | ColumnMajor |
| Iterate the lattice in column-major (Fortran) order. More... | |
| class | Composite_Frame_Sink |
| Fan-out sink that forwards every frame to several sinks. More... | |
| class | Composite_Observer |
| Variadic adaptor that fan-outs notifications to many observers. More... | |
| class | Composite_Rule |
| Sequential composition of one or more rules. More... | |
| struct | ConstantBoundary |
| Constant-value boundary. More... | |
| class | Continuous_Rule |
| Scalar continuous rule driven by a real convolution kernel. More... | |
| class | Critters_Rule |
| Critters reversible CA block rule. More... | |
| struct | CSV_Options |
| Options controlling CSV output and input. More... | |
| class | Custom_Neighborhood |
| User-supplied list of offsets for arbitrary connectivity. More... | |
| class | Dense_Cell_Storage |
Row-major dense storage for N-dimensional cellular automata. More... | |
| class | Density_Observer |
Records the count of cells in tracked_state per step. More... | |
| class | Directory_Frame_Sink |
| Directory-backed sink for CA frames. More... | |
| class | Dot_Frame_Sink |
| Path-pattern sink that writes GraphViz DOT frames. More... | |
| struct | DOT_Render_Options |
| DOT rendering options. More... | |
| class | Entropy_Observer |
| Records the Shannon entropy of the state distribution. More... | |
| class | Ffmpeg_Frame_Sink |
| Frame sink that streams PPM frames into ffmpeg. More... | |
| struct | Ffmpeg_Options |
Options for Ffmpeg_Frame_Sink. More... | |
| class | Field_Slice_Rule |
Adaptor: apply a mono-field rule to field I, leave the other fields unchanged. More... | |
| class | FitzHugh_Nagumo_Rule |
| FitzHugh-Nagumo excitable-media rule. More... | |
| class | Forest_Fire_Rule |
| Forest-fire rule (Drossel & Schwabl, 1992). More... | |
| struct | Frame_Stream_Options |
| Options for directory-backed frame streams. More... | |
| struct | Game_Of_Life_Functor |
| Functor implementing Conway's Game of Life canonical rule (B3/S23). More... | |
| class | Ghost_Lattice |
Lattice with Halo ghost layers around the user-visible cells. More... | |
| class | Gif_Frame_Sink |
| Sink that buffers frames and writes an animated GIF on flush. More... | |
| struct | GIF_Write_Options |
| Options for animated GIF output. More... | |
| class | Graph_Lattice |
| Graph lattice: one cell per node + precomputed adjacency. More... | |
| class | Graph_Synchronous_Engine |
| Synchronous double-buffered engine for graph CAs. More... | |
| class | Gray_Scott_Rule |
| Gray-Scott reaction-diffusion rule. More... | |
| struct | Grid_Snapshot |
| Dense numeric snapshot used by CSV and JSON readers. More... | |
| class | Hashlife_Engine |
| Hashlife engine for outer-totalistic binary cellular automata. More... | |
| struct | Hex_Axial |
Axial integer coordinates (q, r) of a hex cell. More... | |
| struct | Hex_Cube |
Cube coordinates (x, y, z) with the constraint x+y+z = 0. More... | |
| class | Hex_Lattice |
| Hexagonal lattice with axial accessors over a 2D storage. More... | |
| class | Hex_Neighborhood |
| Six-neighbour hex pattern in axial coordinates over a 2D lattice. More... | |
| struct | Hex_Offset |
Offset coordinates (col, row) for visualisation. More... | |
| class | History_Cell |
| Cell state carrying a fixed-depth ring buffer of past values. More... | |
| class | History_Rule |
Rule adapter for History_Cell<State, Depth>. More... | |
| class | HTML_Player_Frame_Sink |
| Sink that writes a self-contained HTML playback file. More... | |
| struct | HTML_Player_Options |
| Options for generated HTML players. More... | |
| class | Ising_Glauber_Rule |
| Ising rule with Glauber single-spin-flip dynamics. More... | |
| class | Ising_Metropolis_Rule |
| Ising rule with Metropolis–Hastings single-spin-flip dynamics. More... | |
| class | JSON_Frame_Stream_Writer |
| Streaming JSON writer for CA trajectories. More... | |
| struct | JSON_Write_Options |
| Options controlling JSON snapshot output. More... | |
| class | Kernel2D |
| Dense odd-sized 2-D convolution kernel. More... | |
| class | Lattice |
| Lattice that adds boundary-aware access on top of a storage. More... | |
| struct | Layout_AoS |
Layout tag: each cell is a std::tuple<Fields...> inside a single contiguous storage. More... | |
| struct | Layout_SoA |
| Layout tag: one contiguous storage per field. More... | |
| class | Lookup_Rule |
Precomputed transition table for (self, neighbours...). More... | |
| struct | Margolus_Update |
| Margolus 2×2 partition update for reversible CAs. More... | |
| class | Moore |
Moore (Chebyshev) neighborhood of radius R in N dimensions. More... | |
| class | Multi_Field_Engine |
| Synchronous double-buffered engine for multi-field lattices. More... | |
| class | Multi_Field_Lattice |
| Multi-field lattice with selectable storage layout. More... | |
| struct | NetPBM_Write_Options |
| Options controlling NetPBM output. More... | |
| struct | NeumannBoundary |
| Zero-gradient (Neumann) boundary. More... | |
| class | Npy_Frame_Sink |
Path-pattern sink that writes one .npy file per frame. More... | |
| class | Null_Neighborhood |
| Placeholder neighbourhood for engines that drive block rules. More... | |
| struct | OpenBoundary |
| Out-of-range neighbours behave as if the lattice ended. More... | |
| struct | Outer_Totalistic_Binary_Rule |
| Outer-totalistic binary rule encoded as two 9-bit bitmasks. More... | |
| class | Outer_Totalistic_Rule |
Rule whose next state depends on (current, alive_count). More... | |
| struct | Parallel_Engine_Config |
Configuration for Parallel_Synchronous_Engine. More... | |
| class | Parallel_Synchronous_Engine |
| Parallel synchronous double-buffered engine. More... | |
| class | Per_Thread_RNG |
| Master seed dispenser for stochastic CA rules. More... | |
| class | Periodic_Checkpoint_Observer |
Observer that auto-saves the engine state every every steps to a templated path. More... | |
| struct | Plaintext_Write_Options |
| Options controlling Life plaintext output. More... | |
| class | Png_Frame_Sink |
| Path-pattern sink that writes one PNG file per accepted frame. More... | |
| class | Probabilistic_Rule |
| Reproducible stochastic rule wrapper (Phase 8). More... | |
| struct | Random_Asynchronous_Update |
| Pick one cell at random per sub-step, update it in place. More... | |
| struct | Range1D |
Half-open integer interval [begin, end). More... | |
| struct | Reaction_Diffusion_Cell |
| Two-field state for reaction-diffusion cellular automata. More... | |
| struct | Rect_Tikz_Options |
| TikZ rendering options for rectangular frames. More... | |
| struct | ReflectiveBoundary |
| Out-of-range coordinates mirror back into the lattice. More... | |
| struct | Resume_Token |
Resume handle returned by load_checkpoint_into. More... | |
| struct | RGB8 |
| RGB byte triplet used by PPM exporters. More... | |
| struct | RLE_Write_Options |
| Options controlling Conway RLE output. More... | |
| struct | Row_Partition |
| Row partitioning along axis 0. More... | |
| struct | RowMajor |
| Iterate the lattice in row-major (C) order. More... | |
| class | Sampling_Observer |
Snapshots the lattice every period steps. More... | |
| class | Schelling_Rule |
| Local approximation of the Schelling segregation model. More... | |
| struct | Sequential_Update |
| In-place sequential update (no double buffer). More... | |
| class | SIR_Rule |
| SIR epidemic transition rule. More... | |
| class | Stationary_Detector |
| Detects fixed points and short cycles via frame hashing. More... | |
| class | Svg_Frame_Sink |
| Path-pattern sink that writes one SVG file per accepted frame. More... | |
| struct | SVG_Render_Options |
| SVG rendering options. More... | |
| class | Synchronous_Engine |
| Synchronous double-buffered engine. More... | |
| struct | Synchronous_Update |
| Classical double-buffer synchronous update. More... | |
| struct | Tile |
Iterate a 2D lattice in W x H tiles. More... | |
| struct | Tile2D_Range |
| 2D tile descriptor: a rectangle in axis-0 / axis-1 coordinates. More... | |
| class | Tile_Cache |
| Out-of-core 2D tile cache with LRU eviction. More... | |
| struct | Tile_Cache_Stats |
Statistics surfaced by Tile_Cache::stats(). More... | |
| class | TM_Gas_Rule |
| Toffoli–Margolus (TM) lattice-gas block rule. More... | |
| struct | ToroidalBoundary |
| The lattice wraps around on every axis. More... | |
| class | Totalistic_Rule |
| Rule whose next state depends on the sum of every cell in the neighbourhood (including the centre). More... | |
| struct | Tri_Coord |
Coordinates of a triangular cell as (i, j) integers. More... | |
| class | Triangular_Lattice |
| Triangular lattice with parity helpers over a 2D storage. More... | |
| class | Triangular_Neighborhood |
| Three edge-neighbours over a 2D lattice with parity coupling. More... | |
| class | Von_Neumann |
Von Neumann (L1) neighborhood of radius R in N dimensions. More... | |
| class | VTK_Frame_Sink |
| Path-pattern sink that writes VTK legacy frames. More... | |
| struct | VTK_Write_Options |
| Options for VTK legacy output. More... | |
| class | X11_Frame_Sink |
| Live X11 frame sink. More... | |
| struct | X11_Viewer_Options |
| Options for the live X11 viewer. More... | |
Concepts | |
| concept | Has_Master_Seed |
| Concept: rule type that exposes a master RNG seed. | |
| concept | Checkpointable_Lattice |
| Concept: lattice exposing the standard CA layout interface. | |
| concept | Checkpointable_Engine |
| Concept: engine that exposes the minimum surface needed by checkpoint save/load. | |
| concept | Frame_Sink |
| Concept implemented by sinks that consume CA frames. | |
| concept | ObserverLike |
| Concept satisfied by any cellular-automaton observer. | |
| concept | Block_Rule_2x2 |
| A rule that maps a 2×2 block to a 2×2 block. | |
| concept | CellState |
| A type usable as the value stored inside a cell. | |
| concept | Coord |
A coordinate type with N integral components. | |
| concept | LatticeLike |
| Storage + topology that carries the cell values. | |
| concept | NeighborhoodLike |
| Connectivity pattern around a coordinate. | |
| concept | BasicRuleLike |
| Pure local transition function (Phase 0–7 signature). | |
| concept | ContextualRuleLike |
| Context-aware local transition function (Phase 8). | |
| concept | RuleLike |
| Local transition function (any supported signature). | |
| concept | HasRefreshHalo |
Detect whether a lattice exposes a refresh_halo() method (the hallmark of a Ghost_Lattice or any other halo-aware variant). | |
| concept | HexRenderable |
Detect whether a lattice exposes the hexagonal-grid query interface (rows(), cols(), at_axial(Hex_Axial)) used by the SVG and TikZ hex renderers. | |
| concept | TriRenderable |
Detect whether a lattice exposes the triangular-grid query interface (rows(), cols(), at_tri(Tri_Coord)) used by the SVG and TikZ triangular renderers. | |
| concept | GraphRuleLike |
| Concept satisfied by graph rules. | |
| concept | MultiFieldLatticeLike |
| Concept: a lattice that exposes the multi-field interface. | |
| concept | BasicMultiFieldRule |
| Concept: a pure multi-field rule. | |
| concept | ContextualMultiFieldRule |
| Concept: a contextual multi-field rule. | |
| concept | MultiFieldRuleLike |
| Concept: any supported multi-field rule signature. | |
Typedefs | |
| using | Game_Of_Life_Engine = Synchronous_Engine< Lattice< Dense_Cell_Storage< int, 2 >, ToroidalBoundary >, Game_Of_Life_Rule, Moore< 2, 1 > > |
| Game-of-Life engine type alias (toroidal, integer cells). | |
| using | Wolfram_1D_Engine = Synchronous_Engine< Lattice< Dense_Cell_Storage< int, 1 >, OpenBoundary >, Lookup_Rule< 2, 2 >, Custom_Neighborhood< 1, 2 > > |
| 1D Wolfram engine type alias (open boundary, integer cells). | |
| using | RLE_Pattern = Binary_Cell_Pattern |
| Backwards-readable alias for Conway RLE patterns. | |
| using | ca_index_t = std::ptrdiff_t |
| Signed coordinate component used by lattices and neighborhoods. | |
| using | ca_size_t = std::size_t |
| Unsigned size component used for extents and counts. | |
| template<std::size_t N> | |
| using | Coord_Vec = std::array< ca_index_t, N > |
| Default coordinate vector. | |
| template<std::size_t N> | |
| using | Offset_Vec = Coord_Vec< N > |
Default offset vector (aliases Coord_Vec). | |
| template<typename T > | |
| using | Neighbor_View = std::span< const T > |
| Read-only view over a contiguous range of neighbour values. | |
| using | PeriodicBoundary = ToroidalBoundary |
Alias for ToroidalBoundary using the HPC "periodic" terminology. | |
| template<typename T , T V> | |
| using | DirichletBoundary = ConstantBoundary< T, V > |
Alias for ConstantBoundary<T, V> using the "Dirichlet" name. | |
| template<typename State > | |
| using | Block_2x2 = std::array< State, 4 > |
| Fixed-size 2×2 block of cell values used by Margolus rules. | |
| template<typename FieldsTuple > | |
| using | Field_Neighbor_Views_Tuple = typename ca_mf_rule_detail::neighbor_view_tuple< FieldsTuple >::type |
std::tuple<Neighbor_View<F>...> for the field tuple std::tuple<F...>. | |
| using | Game_Of_Life_Rule = Outer_Totalistic_Rule< Game_Of_Life_Functor > |
| Outer-totalistic rule type implementing Conway's Game of Life. | |
Enumerations | |
| enum class | Frame_Output_Format { PGM , PPM , RLE , CSV , JSON , TikZ } |
File format used by Directory_Frame_Sink. More... | |
| enum class | Forest_Cell : std::uint8_t { EMPTY = 0 , TREE = 1 , BURNING = 2 } |
| Discrete states of the forest-fire automaton. More... | |
| enum class | SIR_Cell : std::uint8_t { S = 0 , I = 1 , R = 2 } |
| Discrete states of the SIR automaton. More... | |
| enum class | Schelling_Cell : std::uint8_t { EMPTY = 0 , TYPE_A = 1 , TYPE_B = 2 } |
| Discrete states of the Schelling automaton. More... | |
Functions | |
| template<typename Lattice , typename Palette > requires requires(Palette &&p, const typename Lattice::state_type &v) { { p(v) } -> std::convertible_to<std::string>; } | |
| void | render_ascii (std::ostream &out, const Lattice &frame, Palette &&palette, const Ascii_Render_Options &opts={}) |
| Render a rank-2 frame as text. | |
| template<typename Lattice , typename Palette > requires requires(Palette &&p, const typename Lattice::state_type &v) { { p(v) } -> std::convertible_to<std::string>; } | |
| std::string | render_ascii_string (const Lattice &frame, Palette &&palette, const Ascii_Render_Options &opts={}) |
| Return the text rendering of a rank-2 frame. | |
| template<typename Lattice > | |
| void | render_ascii (std::ostream &out, const Lattice &frame, const Ascii_Render_Options &opts={}) |
| Render using the default binary ASCII palette. | |
| template<typename Lattice > | |
| std::string | render_ascii_string (const Lattice &frame, const Ascii_Render_Options &opts={}) |
| Return a default binary ASCII rendering. | |
| template<typename Palette > | |
| Ascii_Frame_Sink (std::ostream &, Palette, Ascii_Render_Options={}, bool=true) -> Ascii_Frame_Sink< Palette > | |
| template<typename F > | |
| double | bench_seconds (F &&f) |
Run f() once and return the wall-clock time it took, in seconds. | |
| const char * | format_throughput (double cells_per_second) |
| Format a "cells per second" rate as "X.XX M cells/s". | |
| Checkpoint_Header | inspect_checkpoint (const std::filesystem::path &path) |
| Read just the header from a checkpoint file. | |
| template<typename Engine > requires Checkpointable_Engine<Engine> | |
| void | save_checkpoint (Engine &engine, const std::filesystem::path &path, const Checkpoint_Options &options={}) |
| Write a complete engine snapshot to disk atomically. | |
| template<typename Engine > requires Checkpointable_Engine<Engine> | |
| Resume_Token | load_checkpoint_into (Engine &engine, const std::filesystem::path &path) |
| Restore an engine's state in-place from a checkpoint file. | |
| template<typename Engine > requires Checkpointable_Engine<Engine> | |
| void | save_delta_checkpoint (Engine &engine, const std::vector< std::uint8_t > &baseline, const std::uint64_t base_step, const std::filesystem::path &path, const Checkpoint_Options &options={}) |
| Write a delta checkpoint relative to a previous payload. | |
| template<typename Engine > requires Checkpointable_Engine<Engine> | |
| Resume_Token | apply_delta_checkpoint (Engine &engine, const std::filesystem::path &path) |
| Apply a delta checkpoint to the engine's current state. | |
| template<typename Graph , typename Palette > requires requires(const Graph &g, std::size_t n, Palette &&p, const typename Graph::state_type &v) { g.size(); g.neighbours(n); g.at_node(n); { p(v) } -> std::convertible_to<std::string>; } | |
| void | render_graph_lattice_dot (std::ostream &out, const Graph &graph, Palette &&palette, const DOT_Render_Options &opts={}) |
| Render a graph CA frame as GraphViz DOT. | |
| template<typename Graph , typename Palette > | |
| std::string | render_graph_lattice_dot_string (const Graph &graph, Palette &&palette, const DOT_Render_Options &opts={}) |
| Return a graph frame rendered as DOT. | |
| template<typename Palette > | |
| Dot_Frame_Sink (std::filesystem::path, Palette, DOT_Render_Options={}, std::size_t=6) -> Dot_Frame_Sink< Palette > | |
| Game_Of_Life_Engine | make_gol_engine (ca_size_t rows, ca_size_t cols) |
| Build a Conway's Game of Life engine of the given shape. | |
| Game_Of_Life_Engine | make_gol_engine (Lattice< Dense_Cell_Storage< int, 2 >, ToroidalBoundary > initial) |
| Build a Game of Life engine seeded with an explicit lattice. | |
| Wolfram_1D_Engine | make_wolfram_engine (std::uint8_t rule_no, ca_size_t width) |
| Build a 1D elementary Wolfram engine of the given width. | |
| Wolfram_1D_Engine | make_wolfram_engine (std::uint8_t rule_no, Lattice< Dense_Cell_Storage< int, 1 >, OpenBoundary > initial) |
| Build a 1D elementary Wolfram engine from an initial row. | |
| template<typename Mapper > | |
| Ffmpeg_Frame_Sink (std::filesystem::path, Mapper, Ffmpeg_Options={}) -> Ffmpeg_Frame_Sink< Mapper > | |
| std::filesystem::path | format_step_path (const std::filesystem::path &pattern, const std::size_t step, const std::size_t zero_pad=6) |
| Format a step-indexed file path. | |
| void | write_gif (std::ostream &out, const Array< ca_gif_detail::Frame > &frames, const GIF_Write_Options &opts={}) |
| Write a sequence of RGB frames as an animated GIF. | |
| template<typename Mapper > | |
| Gif_Frame_Sink (std::filesystem::path, Mapper, GIF_Write_Options={}) -> Gif_Frame_Sink< Mapper > | |
| template<typename Mapper > | |
| HTML_Player_Frame_Sink (std::filesystem::path, Mapper, HTML_Player_Options={}) -> HTML_Player_Frame_Sink< Mapper > | |
| template<typename Lattice > | |
| void | write_rle (std::ostream &out, const Lattice &frame, const RLE_Write_Options &opts={}, const typename Lattice::state_type &dead=typename Lattice::state_type{}) |
| Write a 2D frame in Conway RLE format. | |
| template<typename Lattice > | |
| std::string | write_rle_string (const Lattice &frame, const RLE_Write_Options &opts={}, const typename Lattice::state_type &dead=typename Lattice::state_type{}) |
| Return a frame encoded as Conway RLE. | |
| RLE_Pattern | read_rle (std::istream &in) |
| Read a Conway RLE pattern. | |
| RLE_Pattern | read_rle_string (const std::string &s) |
| Read a Conway RLE pattern from a string. | |
| template<typename Lattice > | |
| void | load_binary_pattern (const Binary_Cell_Pattern &pattern, Lattice &frame, const typename Lattice::state_type &alive=static_cast< typename Lattice::state_type >(1), const typename Lattice::state_type &dead=typename Lattice::state_type{}, const ca_index_t origin_row=0, const ca_index_t origin_col=0) |
| Fill a lattice from a binary pattern. | |
| template<typename Lattice > | |
| Lattice | make_lattice_from_pattern (const Binary_Cell_Pattern &pattern, const typename Lattice::state_type &alive=static_cast< typename Lattice::state_type >(1), const typename Lattice::state_type &dead=typename Lattice::state_type{}) |
| Construct a lattice with the exact dimensions of a pattern. | |
| template<typename Lattice > | |
| void | write_plaintext (std::ostream &out, const Lattice &frame, const Plaintext_Write_Options &opts={}, const typename Lattice::state_type &dead=typename Lattice::state_type{}) |
Write a Life plaintext (.cells) pattern. | |
| template<typename Lattice > | |
| std::string | write_plaintext_string (const Lattice &frame, const Plaintext_Write_Options &opts={}, const typename Lattice::state_type &dead=typename Lattice::state_type{}) |
| Return a Life plaintext document. | |
| Binary_Cell_Pattern | read_plaintext (std::istream &in) |
Read a Life plaintext (.cells) pattern. | |
| Binary_Cell_Pattern | read_plaintext_string (const std::string &s) |
| Read a Life plaintext pattern from a string. | |
| template<typename Lattice > | |
| void | write_life_106 (std::ostream &out, const Lattice &frame, const typename Lattice::state_type &dead=typename Lattice::state_type{}) |
| Write a Life 1.06 file. | |
| Binary_Cell_Pattern | read_life_106 (std::istream &in) |
| Read a Life 1.06 pattern. | |
| template<typename Lattice > | |
| void | write_life_105 (std::ostream &out, const Lattice &frame, const std::string &comment={}, const typename Lattice::state_type &dead=typename Lattice::state_type{}) |
| Write a Life 1.05 file. | |
| Binary_Cell_Pattern | read_life_105 (std::istream &in) |
| Read a Life 1.05 pattern. | |
| template<typename Lattice > | |
| void | write_csv (std::ostream &out, const Lattice &frame, const CSV_Options &opts={}) |
| Write a numeric CSV snapshot. | |
| template<typename T > | |
| Grid_Snapshot< T > | read_csv_snapshot (std::istream &in, const CSV_Options &opts={}) |
| Read a numeric CSV snapshot. | |
| template<typename Lattice , typename T > | |
| Lattice | make_lattice_from_snapshot (const Grid_Snapshot< T > &snap) |
| Construct a lattice from a numeric snapshot. | |
| template<typename Lattice > | |
| void | write_json (std::ostream &out, const Lattice &frame, const JSON_Write_Options &opts={}) |
| Write a JSON snapshot. | |
| template<typename T > | |
| Grid_Snapshot< T > | read_json_snapshot (std::istream &in) |
Read a JSON numeric snapshot produced by write_json. | |
| template<typename Lattice , typename Mapper > requires requires(Mapper &&m, const typename Lattice::state_type &v) { { m(v) } -> std::convertible_to<std::uint8_t>; } | |
| void | write_pgm (std::ostream &out, const Lattice &frame, Mapper &&mapper, const NetPBM_Write_Options &opts={}) |
Write a binary PGM (P5) image. | |
| template<typename Lattice > | |
| void | write_pgm (std::ostream &out, const Lattice &frame, const NetPBM_Write_Options &opts={}) |
Write a binary PGM (P5) image using the default binary mapper. | |
| template<typename Lattice , typename Mapper > requires requires(Mapper &&m, const typename Lattice::state_type &v) { { m(v) } -> std::convertible_to<RGB8>; } | |
| void | write_ppm (std::ostream &out, const Lattice &frame, Mapper &&mapper, const NetPBM_Write_Options &opts={}) |
Write a binary PPM (P6) image. | |
| template<typename Lattice > | |
| void | write_ppm (std::ostream &out, const Lattice &frame, const NetPBM_Write_Options &opts={}) |
Write a binary PPM (P6) image using the default binary mapper. | |
| expected< RLE_Pattern, std::string > | try_read_rle (std::istream &in) |
Non-throwing variant of read_rle. | |
| expected< RLE_Pattern, std::string > | try_read_rle_string (const std::string &s) |
Non-throwing variant of read_rle_string. | |
| expected< Binary_Cell_Pattern, std::string > | try_read_plaintext (std::istream &in) |
Non-throwing variant of read_plaintext. | |
| expected< Binary_Cell_Pattern, std::string > | try_read_life_105 (std::istream &in) |
Non-throwing variant of read_life_105. | |
| expected< Binary_Cell_Pattern, std::string > | try_read_life_106 (std::istream &in) |
Non-throwing variant of read_life_106. | |
| template<class T > | |
| expected< Grid_Snapshot< T >, std::string > | try_read_csv_snapshot (std::istream &in, const CSV_Options &opts={}) |
Non-throwing variant of read_csv_snapshot. | |
| template<typename T = double> | |
| constexpr Kernel2D< T, 3, 3 > | laplacian_5p_kernel () noexcept |
| Return the 5-point discrete Laplacian kernel. | |
| template<typename T = double> | |
| constexpr Kernel2D< T, 3, 3 > | laplacian_9p_kernel () noexcept |
| Return the isotropic 9-point discrete Laplacian kernel. | |
| template<typename T = double> | |
| constexpr Kernel2D< T, 3, 3 > | mean_3x3_kernel () noexcept |
| Return a 3x3 mean filter. | |
| template<typename T = double> | |
| constexpr Kernel2D< T, 5, 5 > | mean_5x5_kernel () noexcept |
| Return a 5x5 mean filter. | |
| template<typename T = double> | |
| constexpr Kernel2D< T, 3, 3 > | sobel_x_kernel () noexcept |
| Return the horizontal Sobel gradient kernel. | |
| template<typename T = double> | |
| constexpr Kernel2D< T, 3, 3 > | sobel_y_kernel () noexcept |
| Return the vertical Sobel gradient kernel. | |
| template<typename T = double> | |
| constexpr Kernel2D< T, 3, 3 > | gaussian_3x3_kernel () noexcept |
| Return the separable 3x3 Gaussian blur kernel. | |
| template<typename T = double> | |
| constexpr Kernel2D< T, 5, 5 > | gaussian_5x5_kernel () noexcept |
| Return the separable 5x5 Gaussian blur kernel. | |
| template<typename Lattice , typename F > | |
| void | for_each_cell (const Lattice &lat, F &&f) |
| Visit every cell of a lattice in canonical row-major order. | |
| template<typename Lattice > | |
| ca_size_t | count_state (const Lattice &lat, const typename Lattice::state_type &s) |
| template<typename Lattice > | |
| ca_size_t | count_alive (const Lattice &lat) |
| template<typename Lattice > | |
| ca_size_t | total_cells (const Lattice &lat) noexcept |
| template<typename Lattice > | |
| double | density (const Lattice &lat, const typename Lattice::state_type &s) |
| template<typename Lattice > | |
| double | alive_density (const Lattice &lat) |
| template<typename Lattice > | |
| Array< ca_size_t > | state_histogram (const Lattice &lat, std::size_t max_state) |
Count occurrences of every integer state in [0, max_state). | |
| template<typename Lattice > | |
| double | shannon_entropy (const Lattice &lat, std::size_t max_state) |
Shannon entropy in nats of the [0, max_state) distribution. | |
| template<typename Lattice > | |
| std::uint64_t | frame_hash (const Lattice &lat) |
| Deterministic 64-bit FNV-1a hash of the lattice cells. | |
| template<typename Lattice > | |
| bool | frames_equal (const Lattice &a, const Lattice &b) |
| template<typename Lattice > | |
| ca_size_t | cell_diff_count (const Lattice &a, const Lattice &b) |
| template<typename Lattice > | |
| void | write_npy (std::ostream &out, const Lattice &frame) |
Write a lattice frame as a NumPy .npy array. | |
| template<typename... Observers> | |
| auto | make_composite_observer (Observers &&...observers) |
Build a Composite_Observer with deduced ownership semantics. | |
| template<typename Engine , typename Observer > | |
| void | attach_observer (Engine &engine, Observer &observer) |
| Plug an observer into an engine's pre/post-step hooks. | |
| template<typename Engine , typename Observer > | |
| void | attach_observer_graph (Engine &engine, Observer &observer) |
Attach an observer to engines without a lattice_type alias. | |
| template<typename Lattice , typename Mapper > requires requires(Mapper &&m, const typename Lattice::state_type &v) { { m(v) } -> std::convertible_to<RGB8>; } | |
| void | write_png (std::ostream &out, const Lattice &frame, Mapper &&mapper) |
| Write a rank-2 frame as an 8-bit RGB PNG image. | |
| template<typename Lattice > | |
| void | write_png (std::ostream &out, const Lattice &frame) |
| Write a frame as PNG using the default binary RGB mapper. | |
| template<typename Mapper > | |
| Png_Frame_Sink (std::filesystem::path, Mapper, std::size_t=6) -> Png_Frame_Sink< Mapper > | |
| constexpr std::uint64_t | splitmix64 (std::uint64_t x) noexcept |
| 64-bit SplitMix hash. | |
| constexpr std::uint64_t | mix_seed (const std::uint64_t a, const std::uint64_t b) noexcept |
| Combine two 64-bit values into a single deterministic hash. | |
| template<std::size_t Rank> | |
| constexpr std::uint64_t | cell_key_from_coord (const Coord_Vec< Rank > &c) noexcept |
| Hash a cell coordinate into a stable 64-bit key. | |
| template<std::size_t Rank> | |
| constexpr std::uint64_t | cell_seed (const std::uint64_t master_seed, const std::size_t step, const Coord_Vec< Rank > &coord) noexcept |
| Build a deterministic per-cell seed. | |
| template<std::size_t Rank> | |
| constexpr std::uint64_t | cell_seed (const std::uint64_t master_seed, const Cell_Context< Rank > &ctx) noexcept |
Build a deterministic per-cell seed from a Cell_Context. | |
| constexpr std::uint64_t | thread_step_seed (const std::uint64_t master_seed, const std::size_t thread_id, const std::size_t step) noexcept |
Build a deterministic seed from (master, thread_id, step). | |
| template<typename Engine > | |
| double | uniform_unit (Engine &eng) |
Map a 64-bit RNG output to a uniform value in [0, 1). | |
| template<typename Engine > | |
| std::size_t | uniform_int (Engine &eng, const std::size_t lo, const std::size_t hi) |
Sample a uniform integer in [lo, hi] (inclusive). | |
| template<typename Lattice , typename Palette > requires requires(Palette &&p, const typename Lattice::state_type &v) { { p(v) } -> std::convertible_to<RGB8>; } | |
| void | render_lattice_svg (std::ostream &out, const Lattice &frame, Palette &&palette, const SVG_Render_Options &opts={}, const typename Lattice::state_type &dead_state=typename Lattice::state_type{}) |
| Render a supported rank-2 CA frame as SVG. | |
| template<typename Lattice > | |
| void | render_lattice_svg (std::ostream &out, const Lattice &frame, const SVG_Render_Options &opts={}, const typename Lattice::state_type &dead_state=typename Lattice::state_type{}) |
| Render a frame as SVG using the default binary RGB mapper. | |
| template<typename Lattice , typename Palette > requires requires(Palette &&p, const typename Lattice::state_type &v) { { p(v) } -> std::convertible_to<RGB8>; } | |
| std::string | render_lattice_svg_string (const Lattice &frame, Palette &&palette, const SVG_Render_Options &opts={}, const typename Lattice::state_type &dead_state=typename Lattice::state_type{}) |
| Return a frame rendered as SVG. | |
| template<typename Palette > | |
| Svg_Frame_Sink (std::filesystem::path, Palette, SVG_Render_Options={}, std::size_t=6) -> Svg_Frame_Sink< Palette > | |
| template<typename Lattice , typename Palette > requires requires(Palette &&p, const typename Lattice::state_type &v) { { p(v) } -> std::convertible_to<std::string>; } | |
| void | render_rect_lattice_tikz (std::ostream &out, const Lattice &frame, Palette &&palette, const Rect_Tikz_Options &opts={}) |
| Render a rectangular 2D frame as a TikZ picture. | |
| template<typename Lattice , typename Palette > requires requires(Palette &&p, const typename Lattice::state_type &v) { { p(v) } -> std::convertible_to<std::string>; } | |
| std::string | render_rect_lattice_tikz (const Lattice &frame, Palette &&palette, const Rect_Tikz_Options &opts={}) |
| Return a rectangular frame rendered as TikZ. | |
| template<typename Lattice , typename Palette > requires requires(Palette &&p, const typename Lattice::state_type &v) { { p(v) } -> std::convertible_to<std::string>; } | |
| void | render_lattice_tikz (std::ostream &out, const Lattice &frame, Palette &&palette, const Rect_Tikz_Options &opts={}) |
| Render any supported 2D CA lattice as TikZ. | |
| template<typename Lattice , typename Palette > requires requires(Palette &&p, const typename Lattice::state_type &v) { { p(v) } -> std::convertible_to<std::string>; } | |
| std::string | render_lattice_tikz (const Lattice &frame, Palette &&palette, const Rect_Tikz_Options &opts={}) |
| Return any supported 2D CA lattice rendered as TikZ. | |
| template<typename Lattice > | |
| void | render_lattice_tikz (std::ostream &out, const Lattice &frame, const Rect_Tikz_Options &opts={}) |
| Render with the default binary palette. | |
| template<typename Lattice > | |
| std::string | render_lattice_tikz (const Lattice &frame, const Rect_Tikz_Options &opts={}) |
| Return a TikZ picture using the default binary palette. | |
| constexpr Range1D | split_range_balanced (const ca_size_t n, const ca_size_t parts, const ca_size_t idx) noexcept |
Balanced split of [0, n) into parts contiguous ranges. | |
| constexpr bool | should_run_sequential (const ca_size_t cells, const ca_size_t num_partitions, const ca_size_t min_cells) noexcept |
| Decide whether a workload should run sequentially. | |
| constexpr std::uint64_t | morton_encode_2d (const std::uint32_t x, const std::uint32_t y) noexcept |
Morton (Z-order) encoding of (x, y). | |
| constexpr std::uint64_t | morton_encode_3d (const std::uint32_t x, const std::uint32_t y, const std::uint32_t z) noexcept |
Morton (Z-order) encoding of (x, y, z). | |
| template<typename Lattice > | |
| void | write_vtk_legacy (std::ostream &out, const Lattice &frame, const VTK_Write_Options &opts={}) |
Write a 2D or 3D lattice as VTK legacy STRUCTURED_POINTS. | |
| template<typename Mapper > | |
| X11_Frame_Sink (Mapper, X11_Viewer_Options={}) -> X11_Frame_Sink< Mapper > | |
| template<std::size_t N> | |
| void | swap (Bit_Cell_Storage< N > &a, Bit_Cell_Storage< N > &b) noexcept |
| Free-function swap so the storage plays nicely with std::swap. | |
| template<typename Rule , typename State , std::size_t Rank> | |
| State | apply_rule (const Rule &r, const State &s, Neighbor_View< State > v, const Cell_Context< Rank > &ctx) |
| Invoke a rule, optionally forwarding the per-cell context. | |
| template<typename F , typename Kernel > | |
| Continuous_Rule< F, Kernel > | make_continuous_rule (F f, Kernel k, typename Kernel::value_type dt=typename Kernel::value_type{1}, typename Kernel::value_type min_value=-std::numeric_limits< typename Kernel::value_type >::infinity(), typename Kernel::value_type max_value=std::numeric_limits< typename Kernel::value_type >::infinity()) |
Helper factory for Continuous_Rule. | |
| template<std::size_t Depth, typename F > | |
| History_Rule< Depth, F > | make_history_rule (F f) |
Helper factory for History_Rule. | |
| template<typename Storage , typename Boundary , std::size_t Halo> | |
| void | swap (Ghost_Lattice< Storage, Boundary, Halo > &a, Ghost_Lattice< Storage, Boundary, Halo > &b) noexcept(noexcept(a.swap(b))) |
Free-function swap so Ghost_Lattice works with std::swap. | |
| template<typename T > | |
| void | swap (Graph_Lattice< T > &a, Graph_Lattice< T > &b) noexcept |
| Free-function swap so the lattice plays nicely with std::swap. | |
| Array< Array< std::size_t > > | make_grid_graph_adjacency (std::size_t rows, std::size_t cols, bool periodic=false) |
| Build the adjacency of a 2D 4-neighbour grid graph. | |
| Array< Array< std::size_t > > | make_path_graph_adjacency (std::size_t n, bool cycle=false) |
Build the adjacency of a path graph with n nodes. | |
| std::string | format_rule (const Outer_Totalistic_Binary_Rule &r) |
Format a rule as a Conway-style Bxxx/Sxxx string. | |
| std::optional< Outer_Totalistic_Binary_Rule > | parse_rule (const std::string &s) |
Parse a B.../S... (or Wolfram S/B) rule string. | |
| constexpr Hex_Offset | axial_to_offset_even_r (Hex_Axial a) noexcept |
| Axial -> offset (even-r convention: even rows are shifted right). | |
| constexpr Hex_Axial | offset_to_axial_even_r (Hex_Offset o) noexcept |
| Offset (even-r) -> axial. | |
| constexpr Hex_Offset | axial_to_offset_odd_r (Hex_Axial a) noexcept |
| Axial -> offset (odd-r convention: odd rows are shifted right). | |
| constexpr Hex_Axial | offset_to_axial_odd_r (Hex_Offset o) noexcept |
| Offset (odd-r) -> axial. | |
| constexpr Hex_Cube | axial_to_cube (Hex_Axial a) noexcept |
| Axial -> cube. | |
| constexpr Hex_Axial | cube_to_axial (Hex_Cube c) noexcept |
| Cube -> axial. | |
| constexpr ca_size_t | hex_distance (Hex_Axial a, Hex_Axial b) noexcept |
| Hex distance between two axial coordinates. | |
| std::array< double, 2 > | axial_to_pixel_pointy (Hex_Axial a, double radius) noexcept |
| Pointy-top pixel coordinates of an axial cell. | |
| std::array< double, 2 > | axial_to_pixel_flat (Hex_Axial a, double radius) noexcept |
| Flat-top pixel coordinates of an axial cell. | |
| template<typename Lattice , typename Palette > | |
| void | render_hex_lattice_tikz (std::ostream &os, const Lattice &lat, Palette &&palette, double radius=0.5, bool pointy_top=true) |
| Render a hex frame as a stand-alone TikZ picture. | |
| template<typename Lattice , typename Palette > | |
| std::string | render_hex_lattice_tikz (const Lattice &lat, Palette &&palette, double radius=0.5, bool pointy_top=true) |
Returns a std::string instead of writing to a stream. | |
| template<typename Storage , typename Boundary > | |
| void | 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. | |
| template<typename Layout , typename Boundary , std::size_t Rank, typename... Fields> | |
| void | swap (Multi_Field_Lattice< Layout, Boundary, Rank, Fields... > &a, Multi_Field_Lattice< Layout, Boundary, Rank, Fields... > &b) noexcept |
Free-function swap so the lattice plays nicely with std::swap. | |
| template<typename Rule , typename FieldsTuple , std::size_t Rank> | |
| FieldsTuple | apply_multi_field_rule (const Rule &r, const FieldsTuple &cur, const Field_Neighbor_Views_Tuple< FieldsTuple > &nb, const Cell_Context< Rank > &ctx) |
| Invoke a multi-field rule with optional context forwarding. | |
| template<typename Nbh , typename L , typename T > | |
| void | gather_neighbors (const Nbh &nh, const L &lat, const typename L::coord_type ¢er, std::span< T > out) |
Populate out[0..nh.size()) with neighbour values of center. | |
| constexpr Lookup_Rule< 2, 2 > | make_wolfram_elementary_rule (std::uint8_t rule_no) noexcept |
Build the elementary 1D Wolfram rule rule_no (0..255) as a Lookup_Rule<2, 2> over neighbourhood {-1, +1}. | |
| constexpr Game_Of_Life_Rule | make_game_of_life_rule () noexcept |
| Build the canonical Game of Life rule. | |
| template<typename T , std::size_t N> | |
| void | swap (Dense_Cell_Storage< T, N > &a, Dense_Cell_Storage< T, N > &b) noexcept |
| Free-function swap so the storage plays nicely with std::swap. | |
| constexpr int | tri_parity (const Tri_Coord &c) noexcept |
| constexpr bool | tri_is_up (const Tri_Coord &c) noexcept |
| constexpr bool | tri_is_down (const Tri_Coord &c) noexcept |
| std::array< double, 2 > | tri_pixel_centre (const Tri_Coord &c, const double side) noexcept |
Cartesian centre of a triangle in (i, j) units. | |
| template<typename Lattice , typename Palette > | |
| void | render_triangular_lattice_tikz (std::ostream &os, const Lattice &lat, Palette &&palette, const double side=1.0) |
| Render a triangular frame as a TikZ picture. | |
| template<typename Lattice , typename Palette > | |
| std::string | render_triangular_lattice_tikz (const Lattice &lat, Palette &&palette, double side=1.0) |
Returns a std::string instead of writing to a stream. | |
Variables | |
| constexpr Outer_Totalistic_Binary_Rule | Conway_Life |
Conway's Game of Life: B3/S23. | |
| constexpr Outer_Totalistic_Binary_Rule | HighLife |
Nathan Thompson's HighLife: B36/S23 (replicators). | |
| constexpr Outer_Totalistic_Binary_Rule | Day_And_Night |
Bays' Day & Night: B3678/S34678 (self-complementary). | |
| constexpr Outer_Totalistic_Binary_Rule | Seeds |
Seeds: B2/S (every live cell dies, two neighbours produce a birth). | |
| using Aleph::CA::Block_2x2 = typedef std::array<State, 4> |
Fixed-size 2×2 block of cell values used by Margolus rules.
Layout: block[0] = NW, block[1] = NE, block[2] = SW, block[3] = SE.
| State | cell state type. |
Definition at line 82 of file tpl_ca_block_rule.H.
| using Aleph::CA::ca_index_t = typedef std::ptrdiff_t |
Signed coordinate component used by lattices and neighborhoods.
Signed because neighborhoods produce negative offsets.
Definition at line 60 of file ca-traits.H.
| using Aleph::CA::ca_size_t = typedef std::size_t |
Unsigned size component used for extents and counts.
Definition at line 63 of file ca-traits.H.
| using Aleph::CA::Coord_Vec = typedef std::array<ca_index_t, N> |
Default coordinate vector.
| N | number of axes. |
Definition at line 69 of file ca-traits.H.
Alias for ConstantBoundary<T, V> using the "Dirichlet" name.
| T | cell state type. |
| V | imposed value on the out-of-range cells. |
Definition at line 170 of file ca-traits.H.
| using Aleph::CA::Field_Neighbor_Views_Tuple = typedef typename ca_mf_rule_detail::neighbor_view_tuple<FieldsTuple>::type |
std::tuple<Neighbor_View<F>...> for the field tuple std::tuple<F...>.
Definition at line 98 of file tpl_ca_multi_field_rule.H.
| using Aleph::CA::Game_Of_Life_Engine = typedef Synchronous_Engine<Lattice<Dense_Cell_Storage<int, 2>, ToroidalBoundary>, Game_Of_Life_Rule, Moore<2, 1> > |
Game-of-Life engine type alias (toroidal, integer cells).
Definition at line 67 of file ca-engine-utils.H.
Outer-totalistic rule type implementing Conway's Game of Life.
Definition at line 515 of file tpl_ca_rule.H.
Read-only view over a contiguous range of neighbour values.
A Neighbor_View<T> is a thin std::span<const T> populated by gather_neighbors (see tpl_ca_neighborhood.H) on a stack buffer. Rules consume it without owning the underlying memory.
| T | cell state type. |
Definition at line 90 of file ca-traits.H.
| using Aleph::CA::Offset_Vec = typedef Coord_Vec<N> |
Default offset vector (aliases Coord_Vec).
Used by neighborhoods to express signed displacements that are added to a lattice coordinate. The type is identical to Coord_Vec<N>; the alias exists to make intent explicit at call sites.
Definition at line 79 of file ca-traits.H.
Alias for ToroidalBoundary using the HPC "periodic" terminology.
Definition at line 163 of file ca-traits.H.
| using Aleph::CA::Wolfram_1D_Engine = typedef Synchronous_Engine<Lattice<Dense_Cell_Storage<int, 1>, OpenBoundary>, Lookup_Rule<2, 2>, Custom_Neighborhood<1, 2> > |
1D Wolfram engine type alias (open boundary, integer cells).
Definition at line 106 of file ca-engine-utils.H.
|
strong |
Discrete states of the forest-fire automaton.
Encoded as a small integer so that the rule plays nicely with any integral cell type (std::uint8_t, int, ...).
| Enumerator | |
|---|---|
| EMPTY | Empty ground cell. |
| TREE | Healthy tree. |
| BURNING | Tree currently on fire (lasts exactly one step). |
Definition at line 89 of file tpl_ca_stochastic_rules.H.
File format used by Directory_Frame_Sink.
| Enumerator | |
|---|---|
| PGM | binary NetPBM grayscale ( |
| PPM | binary NetPBM RGB ( |
| RLE | Conway RLE ( |
| CSV | numeric CSV ( |
| JSON | JSON snapshot ( |
| TikZ | TikZ picture ( |
Definition at line 91 of file ca-frame-stream.H.
|
strong |
Discrete states of the Schelling automaton.
| Enumerator | |
|---|---|
| EMPTY | Vacant cell. |
| TYPE_A | Agent of type A. |
| TYPE_B | Agent of type B. |
Definition at line 572 of file tpl_ca_stochastic_rules.H.
|
strong |
Discrete states of the SIR automaton.
| Enumerator | |
|---|---|
| S | Susceptible. |
| I | Infected (and infectious). |
| R | Recovered (and immune). |
Definition at line 218 of file tpl_ca_stochastic_rules.H.
[0, 1] of cells whose value differs from state_type{}. Convenience for binary CAs. Definition at line 223 of file ca-metrics.H.
References alive_density(), Aleph::blossom_maximum_cardinality_matching(), count_alive(), and total_cells().
Referenced by alive_density(), TEST(), and TEST().
| Resume_Token Aleph::CA::apply_delta_checkpoint | ( | Engine & | engine, |
| const std::filesystem::path & | path | ||
| ) |
Apply a delta checkpoint to the engine's current state.
The caller must have already loaded the baseline snapshot (the one referenced by header.delta_base_step) into the engine, typically via load_checkpoint_into. This function then overlays the per-cell mutations recorded in the delta file.
| Engine | engine type satisfying Checkpointable_Engine. |
| [in,out] | engine | engine to mutate in place. |
| [in] | path | delta checkpoint path. |
step_count is the target step recorded in the delta file). | std::runtime_error | when the file is not a delta, when metadata disagrees with the engine, or on short reads. |
Definition at line 1156 of file ca-checkpoint.H.
References ah_runtime_error_if, apply_delta_checkpoint(), Aleph::CA::Checkpoint_Header::cell_count, Aleph::diff(), engine, Aleph::CA::Checkpoint_Header::engine_type_hash, Aleph::CA::Checkpoint_Header::extents, Aleph::CA::Checkpoint_Header::flags, Aleph::CA::Checkpoint_Header::has_rng, Aleph::CA::Resume_Token::header, inspect_checkpoint(), k, Aleph::CA::Checkpoint_Header::master_seed, Aleph::CA::Checkpoint_Header::payload_size, Aleph::CA::Checkpoint_Header::rank, Aleph::CA::Resume_Token::source_path, Aleph::CA::Checkpoint_Header::state_type_size, Aleph::CA::Checkpoint_Header::step_count, and value.
Referenced by apply_delta_checkpoint(), and TEST().
|
inline |
Invoke a multi-field rule with optional context forwarding.
Mirrors the role of apply_rule in the mono-field path: the contextual signature is preferred when supported; otherwise the pure signature is used.
| Rule | rule type. |
| FieldsTuple | field tuple type. |
| Rank | lattice rank. |
| [in] | r | rule instance. |
| [in] | cur | current per-field values tuple. |
| [in] | nb | per-field neighbour views tuple. |
| [in] | ctx | per-cell context (forwarded to the rule when accepted). |
Definition at line 153 of file tpl_ca_multi_field_rule.H.
References Aleph::blossom_maximum_cardinality_matching(), and r.
|
inline |
Invoke a rule, optionally forwarding the per-cell context.
When the rule supports the (state, neighbours, ctx) signature (ContextualRuleLike), the context is forwarded; otherwise the function falls back to the legacy (state, neighbours) form. This helper is the single dispatch point used by every CA engine in the module so adding new contextual rules never requires touching the engines.
| Rule | rule type satisfying RuleLike. |
| State | cell state type. |
| Rank | lattice dimension. |
| [in] | r | rule instance. |
| [in] | s | current state of the centre cell. |
| [in] | v | neighbour view (gathered upstream). |
| [in] | ctx | per-cell context (step, coord). |
| Any | exception thrown by the rule. |
Definition at line 225 of file tpl_ca_concepts.H.
References r.
Referenced by Aleph::CA::Synchronous_Update< Order >::apply(), Aleph::CA::Sequential_Update< Order >::apply(), Aleph::CA::Random_Asynchronous_Update< Engine_Type >::apply(), Aleph::CA::Block_Synchronous_Update< BlockSize, Order >::apply(), Aleph::CA::Synchronous_Engine< Lattice, Rule, Neighborhood, Order >::step(), Aleph::CA::Graph_Synchronous_Engine< Lattice, Rule >::step(), TEST(), TEST(), and Aleph::CA::Parallel_Synchronous_Engine< Lattice, Rule, Neighborhood, Order >::update_cell().
| Aleph::CA::Ascii_Frame_Sink | ( | std::ostream & | , |
| Palette | , | ||
| Ascii_Render_Options | = {}, |
||
| bool | = true |
||
| ) | -> Ascii_Frame_Sink< Palette > |
Plug an observer into an engine's pre/post-step hooks.
Captures observer by reference: the caller owns the observer's lifetime, which must outlive the engine. The wiring uses the existing on_pre_step / on_post_step hooks, so the parallel engine and the graph engine are supported transparently.
| [in,out] | engine | engine instance. |
| [in,out] | observer | observer instance to wire. |
| Any | exception thrown by engine hook registration. |
Definition at line 262 of file ca-observer.H.
References Aleph::blossom_maximum_cardinality_matching(), and engine.
Referenced by main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
Attach an observer to engines without a lattice_type alias.
This overload is intended for Graph_Synchronous_Engine; it captures the observer by reference and deduces the frame type in the hook lambdas.
| [in,out] | engine | engine instance. |
| [in,out] | observer | observer instance; must outlive callbacks. |
| Any | exception thrown by engine hook registration. |
Definition at line 292 of file ca-observer.H.
References Aleph::blossom_maximum_cardinality_matching(), and engine.
Axial -> cube.
Definition at line 180 of file tpl_ca_hex_lattice.H.
Referenced by hex_distance(), and TEST().
|
inlineconstexprnoexcept |
Axial -> offset (even-r convention: even rows are shifted right).
Definition at line 151 of file tpl_ca_hex_lattice.H.
References col.
Referenced by TEST().
|
inlineconstexprnoexcept |
Axial -> offset (odd-r convention: odd rows are shifted right).
Definition at line 166 of file tpl_ca_hex_lattice.H.
References col.
Referenced by TEST().
|
inlinenoexcept |
Flat-top pixel coordinates of an axial cell.
Returns the centre of the hex assuming flat-top tiling.
| [in] | a | axial coords. |
| [in] | radius | hex circumradius. |
{x, y} Cartesian centre. Definition at line 235 of file tpl_ca_hex_lattice.H.
References Aleph::blossom_maximum_cardinality_matching(), and y.
Referenced by render_hex_lattice_tikz().
|
inlinenoexcept |
Pointy-top pixel coordinates of an axial cell.
Returns the centre of the hex with the given axial coords assuming pointy-top tiling and circumradius radius. Axis 0 (r) maps to Y growing downward; axis 1 (q) maps to X growing rightward.
| [in] | a | axial coords. |
| [in] | radius | hex circumradius (centre-to-vertex distance). |
{x, y} Cartesian centre, in the same units as radius. Definition at line 217 of file tpl_ca_hex_lattice.H.
References Aleph::blossom_maximum_cardinality_matching(), and y.
Referenced by Aleph::CA::ca_svg_detail::hex_points(), render_hex_lattice_tikz(), and TEST().
Run f() once and return the wall-clock time it took, in seconds.
The functor's return value is discarded. Use this when the work is large enough that a single sample is meaningful. For repeatable microbenches at the µs scale, average several invocations manually.
| F | invocable type, callable as f(). |
| [in] | f | functor to time. |
f(). Definition at line 111 of file ca-bench.H.
References Aleph::CA::Bench_Timer::elapsed_seconds().
Referenced by main().
a and b differ. Both lattices must have the same extents. Definition at line 386 of file ca-metrics.H.
References ah_length_error_if, Aleph::CA::Lattice< Storage, Boundary >::at(), Aleph::blossom_maximum_cardinality_matching(), cell_diff_count(), Aleph::diff(), Aleph::CA::Lattice< Storage, Boundary >::extents(), k, and Aleph::CA::Lattice< Storage, Boundary >::size().
Referenced by cell_diff_count(), Aleph::CA::Activity_Observer< Lattice >::on_step_end(), TEST(), and TEST().
|
inlineconstexprnoexcept |
Hash a cell coordinate into a stable 64-bit key.
The hash depends only on the coordinate components; rank is folded into the avalanche through splitmix64. Two coordinates produce the same key iff every component matches.
| Rank | coordinate rank. |
| [in] | c | cell coordinate. |
| This | function does not throw. |
Definition at line 115 of file ca-rng.H.
References Aleph::blossom_maximum_cardinality_matching(), h, and splitmix64().
|
inlineconstexprnoexcept |
Build a deterministic per-cell seed from a Cell_Context.
| Rank | coordinate rank (deduced from ctx). |
| [in] | master_seed | user-controlled root seed. |
| [in] | ctx | per-cell context produced by the engine. |
| This | function does not throw. |
Definition at line 160 of file ca-rng.H.
References Aleph::blossom_maximum_cardinality_matching().
|
inlineconstexprnoexcept |
Build a deterministic per-cell seed.
Given a master seed, a step index and a cell coordinate, returns a 64-bit value that uniquely identifies this (master, step, coord) triple. The mixing avalanche makes the output statistically independent across consecutive (step, coord) triples.
| Rank | coordinate rank. |
| [in] | master_seed | user-controlled root seed. |
| [in] | step | step index that is being evaluated. |
| [in] | coord | cell coordinate. |
| This | function does not throw. |
Definition at line 141 of file ca-rng.H.
References Aleph::blossom_maximum_cardinality_matching(), and splitmix64().
state_type{}. Definition at line 188 of file ca-metrics.H.
References Aleph::blossom_maximum_cardinality_matching(), count_alive(), and for_each_cell().
Referenced by alive_density(), count_alive(), TEST(), and TEST().
|
inline |
s. Definition at line 175 of file ca-metrics.H.
References Aleph::blossom_maximum_cardinality_matching(), count_state(), and for_each_cell().
Referenced by count_state(), density(), Aleph::CA::Density_Observer< State >::on_step_begin(), Aleph::CA::Density_Observer< State >::on_step_end(), TEST(), TEST(), and TEST().
[0, 1] of cells in state s. Returns 0 for empty lattices. Definition at line 212 of file ca-metrics.H.
References Aleph::blossom_maximum_cardinality_matching(), count_state(), density(), and total_cells().
Referenced by density(), Aleph::CA::Reproductions::fit_log_log_histogram(), seed_random(), TEST(), TEST(), and TEST().
| Aleph::CA::Dot_Frame_Sink | ( | std::filesystem::path | , |
| Palette | , | ||
| DOT_Render_Options | = {}, |
||
| std::size_t | = 6 |
||
| ) | -> Dot_Frame_Sink< Palette > |
| Aleph::CA::Ffmpeg_Frame_Sink | ( | std::filesystem::path | , |
| Mapper | , | ||
| Ffmpeg_Options | = {} |
||
| ) | -> Ffmpeg_Frame_Sink< Mapper > |
Visit every cell of a lattice in canonical row-major order.
Calls f(value) once per cell. Works for the rectangular ranks (1, 2, 3) and for graph lattices (any type that exposes at_node(size_t)).
| Lattice | lattice type satisfying LatticeLike. |
| F | invocable with the cell state_type. |
| [in] | lat | lattice to traverse. |
| [in] | f | functor applied to every cell value. |
Definition at line 133 of file ca-metrics.H.
References Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::Lattice< Storage, Boundary >::rank, and Aleph::HTList::size().
Referenced by count_alive(), count_state(), frame_hash(), state_histogram(), and TEST().
|
inline |
Format a rule as a Conway-style Bxxx/Sxxx string.
| r | the rule to format. |
Definition at line 145 of file tpl_ca_hashlife.H.
References r.
Referenced by TEST().
|
inline |
Format a step-indexed file path.
Replaces either {step} or {} in pattern with a zero-padded decimal representation of step. If no placeholder is present the pattern is returned unchanged, which is useful for single-file sinks.
| [in] | pattern | path pattern. |
| [in] | step | simulation step. |
| [in] | zero_pad | minimum width of the step field. |
Definition at line 212 of file ca-frame-stream.H.
References Aleph::CA::ca_frame_stream_detail::format_step_path().
Referenced by Aleph::CA::Dot_Frame_Sink< Palette >::accept(), Aleph::CA::Npy_Frame_Sink::accept(), Aleph::CA::Png_Frame_Sink< Mapper >::accept(), Aleph::CA::VTK_Frame_Sink::accept(), and Aleph::CA::Svg_Frame_Sink< Palette >::accept().
Format a "cells per second" rate as "X.XX M cells/s".
Helper used by the bench example to pretty-print throughput numbers in a small table. Rates above one giga-cell are reported as G.
| [in] | cells_per_second | raw rate in cells / s. |
Definition at line 126 of file ca-bench.H.
References Aleph::blossom_maximum_cardinality_matching().
Referenced by main().
Deterministic 64-bit FNV-1a hash of the lattice cells.
Visits cells in canonical row-major order and folds their byte representation into a running FNV-1a 64-bit hash. The result is stable across runs, builds and machines with the same endianness for any trivially copyable state_type. The cell-by-cell layout guarantees that two lattices that compare equal hash to the same value.
| [in] | lat | lattice to hash. |
Definition at line 311 of file ca-metrics.H.
References Aleph::blossom_maximum_cardinality_matching(), for_each_cell(), frame_hash(), and h.
Referenced by frame_hash(), Aleph::CA::Stationary_Detector::on_step_begin(), Aleph::CA::Stationary_Detector::on_step_end(), TEST(), TEST(), TEST(), and TEST().
true iff a and b have identical extents and values. Definition at line 323 of file ca-metrics.H.
References Aleph::CA::Lattice< Storage, Boundary >::at(), Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::Lattice< Storage, Boundary >::extents(), k, and Aleph::CA::Lattice< Storage, Boundary >::size().
Referenced by expect_engine_equivalence(), main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
inline |
Populate out[0..nh.size()) with neighbour values of center.
The caller owns the buffer (typically a std::array<T, N> on the stack). Order matches nh.for_each_offset. Out-of-range neighbours are resolved by the lattice's boundary policy via at_safe.
| [in] | nh | neighborhood instance. |
| [in] | lat | lattice to read from. |
| [in] | center | center coordinate. |
| [out] | out | buffer of at least nh.size() cells. |
| std::length_error | if out is smaller than nh.size(). |
Definition at line 569 of file tpl_ca_neighborhood.H.
References ah_length_error_if, Aleph::blossom_maximum_cardinality_matching(), and out.
Referenced by Aleph::CA::Synchronous_Update< Order >::apply(), Aleph::CA::Sequential_Update< Order >::apply(), Aleph::CA::Random_Asynchronous_Update< Engine_Type >::apply(), Aleph::CA::Block_Synchronous_Update< BlockSize, Order >::apply(), Aleph::CA::Synchronous_Engine< Lattice, Rule, Neighborhood, Order >::step(), TEST(), TEST(), TEST(), and Aleph::CA::Parallel_Synchronous_Engine< Lattice, Rule, Neighborhood, Order >::update_cell().
Return the separable 3x3 Gaussian blur kernel.
| T | numeric weight type. |
| This | function does not throw. |
Definition at line 408 of file ca-kernels.H.
References Aleph::blossom_maximum_cardinality_matching().
Return the separable 5x5 Gaussian blur kernel.
| T | numeric weight type. |
| This | function does not throw. |
Definition at line 422 of file ca-kernels.H.
References Aleph::blossom_maximum_cardinality_matching().
| Aleph::CA::Gif_Frame_Sink | ( | std::filesystem::path | , |
| Mapper | , | ||
| GIF_Write_Options | = {} |
||
| ) | -> Gif_Frame_Sink< Mapper > |
Hex distance between two axial coordinates.
Computed via the cube representation: (|dx| + |dy| + |dz|) / 2, which equals the minimum number of unit hex steps from a to b.
Definition at line 198 of file tpl_ca_hex_lattice.H.
References axial_to_cube(), and Aleph::blossom_maximum_cardinality_matching().
| Aleph::CA::HTML_Player_Frame_Sink | ( | std::filesystem::path | , |
| Mapper | , | ||
| HTML_Player_Options | = {} |
||
| ) | -> HTML_Player_Frame_Sink< Mapper > |
|
inline |
Read just the header from a checkpoint file.
Accepts both format_version = 1 (Phase 15) and format_version = 2 (Phase 17). v1 readers see v2-only fields as zero; flags / payload metadata are then synthesised from the defaults (uncompressed, full snapshot).
| [in] | path | checkpoint file to inspect. |
| std::runtime_error | on missing file, bad magic, version mismatch or short read. |
Definition at line 515 of file ca-checkpoint.H.
References ah_runtime_error_if, Aleph::and, Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::Checkpoint_Header::format_version, and h.
Referenced by apply_delta_checkpoint(), load_checkpoint_into(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
Return the 5-point discrete Laplacian kernel.
Stencil:
| T | numeric weight type. |
Kernel2D<T, 3, 3> with zero total mass. | This | function does not throw. |
Definition at line 323 of file ca-kernels.H.
References Aleph::blossom_maximum_cardinality_matching().
Return the isotropic 9-point discrete Laplacian kernel.
Stencil:
| T | numeric weight type. |
Kernel2D<T, 3, 3> with zero total mass. | This | function does not throw. |
Definition at line 343 of file ca-kernels.H.
References Aleph::blossom_maximum_cardinality_matching().
|
inline |
Fill a lattice from a binary pattern.
The destination is cleared to dead, then all pattern live cells are stamped as alive at (origin_row, origin_col).
| Lattice | 2D lattice type. |
| [in] | pattern | source binary pattern. |
| [in,out] | frame | destination lattice. |
| [in] | alive | state assigned to live pattern cells. |
| [in] | dead | state used to clear the frame. |
| [in] | origin_row | row offset in the destination. |
| [in] | origin_col | column offset in the destination. |
| std::domain_error | if the pattern does not fit. |
Definition at line 809 of file ca-io.H.
References load_binary_pattern().
Referenced by load_binary_pattern().
| Resume_Token Aleph::CA::load_checkpoint_into | ( | Engine & | engine, |
| const std::filesystem::path & | path | ||
| ) |
Restore an engine's state in-place from a checkpoint file.
Accepts both v1 (Phase 15) and v2 (Phase 17) files; compressed and uncompressed payloads are handled transparently. Delta files (flags & delta) are not accepted here — use apply_delta_checkpoint for those.
The engine must have been built with extents that match the snapshot. The function rebuilds the lattice contents cell-by-cell, restores the step counter and forwards the recorded master seed to the rule when both sides expose the Has_Master_Seed contract.
| Engine | engine type satisfying Checkpointable_Engine. |
| [in,out] | engine | engine to populate. |
| [in] | path | checkpoint file path. |
| std::runtime_error | on bad magic, version mismatch, type hash mismatch, extents mismatch, short read or attempts to load a delta file with this entry point. |
Definition at line 998 of file ca-checkpoint.H.
References ah_runtime_error_if, engine, Aleph::CA::Checkpoint_Header::engine_type_hash, Aleph::CA::Checkpoint_Header::extents, Aleph::CA::Checkpoint_Header::flags, Aleph::CA::Checkpoint_Header::has_rng, Aleph::CA::Resume_Token::header, inspect_checkpoint(), load_checkpoint_into(), Aleph::CA::Checkpoint_Header::master_seed, Aleph::CA::Checkpoint_Header::rank, Aleph::CA::Resume_Token::source_path, Aleph::CA::Checkpoint_Header::state_type_size, and Aleph::CA::Checkpoint_Header::step_count.
Referenced by LLVMFuzzerTestOneInput(), load_checkpoint_into(), main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
inline |
Build a Composite_Observer with deduced ownership semantics.
Lvalue arguments are stored as references, so later state changes remain visible through the original observer objects. Rvalue arguments are moved into and owned by the composite.
| Observers | deduced observer argument types. |
| [in] | observers | observer objects or references. |
| Any | exception thrown while constructing the composite. |
Definition at line 234 of file ca-observer.H.
References Aleph::blossom_maximum_cardinality_matching().
Referenced by TEST().
| Continuous_Rule< F, Kernel > Aleph::CA::make_continuous_rule | ( | F | f, |
| Kernel | k, | ||
| typename Kernel::value_type | dt = typename Kernel::value_type{1}, |
||
| typename Kernel::value_type | min_value = -std::numeric_limits<typename Kernel::value_type>::infinity(), |
||
| typename Kernel::value_type | max_value = std::numeric_limits<typename Kernel::value_type>::infinity() |
||
| ) |
Helper factory for Continuous_Rule.
| F | callable rule body. |
| Kernel | kernel type. |
| [in] | f | transition functor. |
| [in] | k | convolution kernel. |
| [in] | dt | explicit Euler time step. |
| [in] | min_value | minimum accepted next state. |
| [in] | max_value | maximum accepted next state. |
Continuous_Rule. | Any | exception thrown by the constructor. |
Definition at line 247 of file tpl_ca_continuous_rules.H.
|
inlineconstexprnoexcept |
Build the canonical Game of Life rule.
| This | function does not throw. |
Definition at line 522 of file tpl_ca_rule.H.
Referenced by LLVMFuzzerTestOneInput(), main(), main(), main(), make_gol_engine(), make_gol_engine(), run_engine_equivalence(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
inline |
Build a Conway's Game of Life engine of the given shape.
All cells start dead. To stamp a pattern before stepping, build a Lattice initial(...) and pass it to the seeded overload.
| [in] | rows | number of rows (axis 0). |
| [in] | cols | number of columns (axis 1). |
Definition at line 82 of file ca-engine-utils.H.
References Aleph::blossom_maximum_cardinality_matching(), cols, make_game_of_life_rule(), and rows.
Referenced by aleph_ca_create_gol_engine_v1(), and main().
|
inline |
Build a Game of Life engine seeded with an explicit lattice.
Use this overload when the initial pattern must be stamped before the first step().
| [in] | initial | lattice that becomes the current frame. |
Definition at line 99 of file ca-engine-utils.H.
References Aleph::blossom_maximum_cardinality_matching(), and make_game_of_life_rule().
|
inline |
Build the adjacency of a 2D 4-neighbour grid graph.
Node id n = i * cols + j for cell (i, j). Each interior node has four neighbours (up, down, left, right). When periodic is set the boundaries wrap (every node has exactly four neighbours).
| [in] | rows | grid rows. |
| [in] | cols | grid cols. |
| [in] | periodic | toroidal boundaries when true. |
rows * cols entries.Definition at line 445 of file tpl_ca_graph_automaton.H.
References Aleph::Array< T >::append(), Aleph::blossom_maximum_cardinality_matching(), cols, row, and rows.
| History_Rule< Depth, F > Aleph::CA::make_history_rule | ( | F | f | ) |
Helper factory for History_Rule.
| Depth | history depth. |
| F | transition functor type. |
| [in] | f | transition functor. |
History_Rule. | Any | exception thrown by the constructor. |
Definition at line 832 of file tpl_ca_continuous_rules.H.
References Aleph::blossom_maximum_cardinality_matching().
|
inline |
Construct a lattice with the exact dimensions of a pattern.
| Lattice | 2D lattice type constructible from extents and value. |
| [in] | pattern | source binary pattern. |
| [in] | alive | state assigned to live cells. |
| [in] | dead | state assigned to dead cells. |
Definition at line 843 of file ca-io.H.
References make_lattice_from_pattern().
Referenced by make_lattice_from_pattern().
|
inline |
Construct a lattice from a numeric snapshot.
| Lattice | 2D lattice type. |
| T | snapshot scalar type. |
| [in] | snap | source snapshot. |
static_cast<state_type> converted cells.Definition at line 1283 of file ca-io.H.
References Aleph::blossom_maximum_cardinality_matching(), make_lattice_from_snapshot(), r, and Aleph::CA::Lattice< Storage, Boundary >::set().
Referenced by make_lattice_from_snapshot().
|
inline |
Build the adjacency of a path graph with n nodes.
Node k is adjacent to k-1 and k+1 (when those exist). When cycle is true, the path closes into a ring (every node has exactly two neighbours).
| [in] | n | number of nodes. |
| [in] | cycle | close into a cycle when true. |
n entries. Definition at line 488 of file tpl_ca_graph_automaton.H.
References Aleph::and, Aleph::Array< T >::append(), and Aleph::blossom_maximum_cardinality_matching().
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
inlineconstexprnoexcept |
Build the elementary 1D Wolfram rule rule_no (0..255) as a Lookup_Rule<2, 2> over neighbourhood {-1, +1}.
The standard Wolfram code orders patterns as (left, self, right) with bit weight (left << 2) | (self << 1) | (right << 0) and packs the next-state bits into rule_no. Our Lookup_Rule uses (self, left, right) with weight (self << 2) | (left << 1) | right. This factory rewrites the table accordingly.
| [in] | rule_no | Wolfram rule number, in [0, 255]. |
| This | function does not throw. |
Definition at line 304 of file tpl_ca_rule.H.
References Aleph::blossom_maximum_cardinality_matching().
Referenced by make_wolfram_engine(), make_wolfram_engine(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
inline |
Build a 1D elementary Wolfram engine of the given width.
The lattice starts at zero everywhere. Stamp the impulse(s) before invoking step() through the second overload, or by building the initial lattice yourself and using the Synchronous_Engine constructor directly.
| [in] | rule_no | Wolfram elementary rule number, [0, 255]. |
| [in] | width | number of cells along the single axis. |
Definition at line 124 of file ca-engine-utils.H.
References Aleph::blossom_maximum_cardinality_matching(), and make_wolfram_elementary_rule().
|
inline |
Build a 1D elementary Wolfram engine from an initial row.
| [in] | rule_no | Wolfram elementary rule number, [0, 255]. |
| [in] | initial | lattice that becomes the current frame. |
Definition at line 140 of file ca-engine-utils.H.
References Aleph::blossom_maximum_cardinality_matching(), and make_wolfram_elementary_rule().
Return a 3x3 mean filter.
| T | numeric weight type. |
1/9. | This | function does not throw. |
Definition at line 357 of file ca-kernels.H.
References Aleph::blossom_maximum_cardinality_matching(), and w.
Return a 5x5 mean filter.
| T | numeric weight type. |
1/25. | This | function does not throw. |
Definition at line 370 of file ca-kernels.H.
References Aleph::blossom_maximum_cardinality_matching(), and w.
|
inlineconstexprnoexcept |
Combine two 64-bit values into a single deterministic hash.
| [in] | a | first input. |
| [in] | b | second input. |
| This | function does not throw. |
Definition at line 97 of file ca-rng.H.
References splitmix64().
Referenced by Aleph::CA::Random_Asynchronous_Update< Engine_Type >::apply().
|
inlineconstexprnoexcept |
Morton (Z-order) encoding of (x, y).
Interleaves the bits of x and y. Useful as a sort key for visiting 2D cells in a cache-friendly order (cells close in Euclidean distance map to close indices). Phase-5 leaves the engine using row partitioning by default; this helper is exposed as a building block for higher-dimensional schedulers.
| [in] | x | first coordinate (axis 0). |
| [in] | y | second coordinate (axis 1). |
Definition at line 375 of file ca-tiling.H.
References Aleph::CA::ca_tiling_detail::spread_bits_2(), and y.
Referenced by TEST().
|
inlineconstexprnoexcept |
Morton (Z-order) encoding of (x, y, z).
Same idea as morton_encode_2d but interleaving three streams of bits, suitable for 3D CAs. Inputs are clamped to 21 bits each so the result fits in std::uint64_t.
| [in] | x | first coordinate. |
| [in] | y | second coordinate. |
| [in] | z | third coordinate. |
Definition at line 392 of file ca-tiling.H.
References Aleph::CA::ca_tiling_detail::spread_bits_3(), and y.
|
inlineconstexprnoexcept |
Offset (even-r) -> axial.
Definition at line 159 of file tpl_ca_hex_lattice.H.
References Aleph::blossom_maximum_cardinality_matching().
Referenced by Aleph::CA::Hex_Lattice< Storage, Boundary >::at_offset_even_r(), Aleph::CA::Hex_Lattice< Storage, Boundary >::set_offset_even_r(), and TEST().
|
inlineconstexprnoexcept |
Offset (odd-r) -> axial.
Definition at line 173 of file tpl_ca_hex_lattice.H.
References Aleph::blossom_maximum_cardinality_matching().
Referenced by TEST().
|
inline |
Parse a B.../S... (or Wolfram S/B) rule string.
Accepts mixed case and tolerates surrounding whitespace.
| s | rule string (e.g. "B3/S23" or "23/3"). |
std::nullopt on syntactic error. Definition at line 168 of file tpl_ca_hashlife.H.
References Aleph::and, and Aleph::blossom_maximum_cardinality_matching().
Referenced by Aleph::CA::Hashlife_Engine::parse_rule_field(), and TEST().
| Aleph::CA::Png_Frame_Sink | ( | std::filesystem::path | , |
| Mapper | , | ||
| std::size_t | = 6 |
||
| ) | -> Png_Frame_Sink< Mapper > |
|
inline |
Read a numeric CSV snapshot.
The reader supports rectangular, delimiter-separated numeric matrices. Quoting is intentionally not implemented because CA snapshots are plain numeric grids.
| T | target scalar type. |
| [in,out] | in | input stream. |
| [in] | opts | CSV options. |
| std::domain_error | if rows have inconsistent widths or a scalar cannot be parsed. |
Definition at line 1242 of file ca-io.H.
References read_csv_snapshot().
Referenced by read_csv_snapshot().
|
inline |
Read a JSON numeric snapshot produced by write_json.
This intentionally small parser handles the deterministic schema emitted by this header. It supports integer and floating-point numeric cell values, but not arbitrary user JSON.
| T | target scalar type. |
| [in,out] | in | input stream. |
| std::domain_error | on malformed JSON or shape mismatch. |
Definition at line 1370 of file ca-io.H.
References ah_domain_error_if, Aleph::and, Aleph::blossom_maximum_cardinality_matching(), cols, Aleph::CA::Grid_Snapshot< T >::height, read_json_snapshot(), and rows.
Referenced by read_json_snapshot().
|
inline |
Read a Life 1.05 pattern.
Supports the common #P x y block dialect with * or O live cells and . dead cells. Multiple blocks are merged and then normalised.
| [in,out] | in | input stream. |
| std::domain_error | on malformed input. |
Definition at line 1106 of file ca-io.H.
References ah_domain_error_if, ah_domain_error_unless, Aleph::and, Aleph::Array< T >::append(), Aleph::blossom_maximum_cardinality_matching(), col, Aleph::CA::Binary_Cell_Pattern::comments, read_life_105(), and row.
Referenced by LLVMFuzzerTestOneInput(), read_life_105(), TEST(), TEST(), TEST(), and try_read_life_105().
|
inline |
Read a Life 1.06 pattern.
Coordinates may be negative; the returned pattern is normalised while preserving the original minimum coordinate in origin_row/col.
| [in,out] | in | input stream. |
| std::domain_error | on malformed input. |
Definition at line 1007 of file ca-io.H.
References ah_domain_error_if, ah_domain_error_unless, Aleph::and, Aleph::Array< T >::append(), Aleph::blossom_maximum_cardinality_matching(), col, Aleph::CA::Binary_Cell_Pattern::comments, read_life_106(), and row.
Referenced by LLVMFuzzerTestOneInput(), read_life_106(), TEST(), TEST(), TEST(), and try_read_life_106().
|
inline |
Read a Life plaintext (.cells) pattern.
Lines beginning with ! are comments. O, o and * are live; . is dead. Whitespace inside rows is ignored.
| [in,out] | in | input stream. |
| std::domain_error | on invalid row characters. |
Definition at line 919 of file ca-io.H.
References ah_domain_error_unless, Aleph::CA::Binary_Cell_Pattern::alive, Aleph::Array< T >::append(), Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::Binary_Cell_Pattern::comments, Aleph::CA::Binary_Cell_Pattern::height, r, read_plaintext(), row, rows, and Aleph::CA::Binary_Cell_Pattern::width.
Referenced by read_plaintext(), read_plaintext_string(), TEST(), and try_read_plaintext().
|
inline |
Read a Life plaintext pattern from a string.
| [in] | s | plaintext document. |
Definition at line 961 of file ca-io.H.
References Aleph::blossom_maximum_cardinality_matching(), read_plaintext(), and read_plaintext_string().
Referenced by read_plaintext_string(), TEST(), and TEST().
|
inline |
Read a Conway RLE pattern.
Accepts comments, mixed whitespace, b/. dead cells and o/A live cells. Dimensions come from the required x = ..., y = ... header.
| [in,out] | in | input stream. |
| std::domain_error | on malformed RLE. |
Definition at line 691 of file ca-io.H.
References ah_domain_error_if, ah_domain_error_unless, ah_overflow_error_if, Aleph::CA::Binary_Cell_Pattern::alive, Aleph::and, Aleph::Array< T >::append(), Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::Binary_Cell_Pattern::comments, Aleph::CA::Binary_Cell_Pattern::height, k, Aleph::CA::Binary_Cell_Pattern::name, read_rle(), Aleph::CA::Binary_Cell_Pattern::rule, Aleph::CA::Binary_Cell_Pattern::width, and y.
Referenced by read_rle(), read_rle_string(), and try_read_rle().
|
inline |
Read a Conway RLE pattern from a string.
| [in] | s | RLE document. |
Definition at line 785 of file ca-io.H.
References Aleph::blossom_maximum_cardinality_matching(), read_rle(), and read_rle_string().
Referenced by LLVMFuzzerTestOneInput(), read_rle_string(), TEST(), TEST(), TEST(), TEST(), TEST(), and try_read_rle_string().
|
inline |
Render using the default binary ASCII palette.
| Lattice | 2D lattice type. |
| [in,out] | out | output stream. |
| [in] | frame | frame to render. |
| [in] | opts | rendering options. |
Definition at line 257 of file ca-ascii.H.
|
inline |
Render a rank-2 frame as text.
palette(cell) must return a string glyph. Coordinates are emitted in row-major order.
| Lattice | 2D lattice type. |
| Palette | invocable state_type -> std::string. |
| [in,out] | out | output stream. |
| [in] | frame | frame to render. |
| [in] | palette | state-to-text mapper. |
| [in] | opts | rendering options. |
| std::runtime_error | on stream write failure. |
Definition at line 168 of file ca-ascii.H.
Referenced by Aleph::CA::Ascii_Frame_Sink< Palette >::accept(), and main().
|
inline |
Return a default binary ASCII rendering.
| Lattice | 2D lattice type. |
| [in] | frame | frame to render. |
| [in] | opts | rendering options. |
Definition at line 270 of file ca-ascii.H.
|
inline |
Return the text rendering of a rank-2 frame.
| Lattice | 2D lattice type. |
| Palette | invocable state_type -> std::string. |
| [in] | frame | frame to render. |
| [in] | palette | state-to-text mapper. |
| [in] | opts | rendering options. |
Definition at line 237 of file ca-ascii.H.
Referenced by TEST().
|
inline |
Render a graph CA frame as GraphViz DOT.
| Graph | graph lattice type. |
| Palette | invocable state_type -> std::string. |
| [in,out] | out | output stream. |
| [in] | graph | graph lattice frame. |
| [in] | palette | state-to-fill-colour mapper. |
| [in] | opts | rendering options. |
| std::runtime_error | on stream write failure. |
Definition at line 146 of file ca-dot.H.
Referenced by Aleph::CA::Dot_Frame_Sink< Palette >::accept(), and main().
|
inline |
Return a graph frame rendered as DOT.
| Graph | graph lattice type. |
| Palette | invocable state_type -> std::string. |
| [in] | graph | graph lattice frame. |
| [in] | palette | state-to-fill-colour mapper. |
| [in] | opts | rendering options. |
| Any | exception propagated by the underlying render_graph_lattice_dot call (e.g. std::runtime_error on stringstream write failure, or exceptions thrown by the palette). |
Definition at line 207 of file ca-dot.H.
Referenced by TEST().
|
inline |
Returns a std::string instead of writing to a stream.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 357 of file tpl_ca_hex_lattice.H.
References Aleph::blossom_maximum_cardinality_matching(), and render_hex_lattice_tikz().
|
inline |
Render a hex frame as a stand-alone TikZ picture.
Produces a TikZ tikzpicture body with one filled hexagon per cell, coloured according to a user-supplied palette functor that maps a state_type to a TikZ colour (LaTeX colour name).
The output is appended to os. The caller is responsible for wrapping the LaTeX preamble (\documentclass, \usepackage{tikz}) if a stand-alone document is desired.
| Lattice | hex lattice type. |
| Palette | invocable state_type -> std::string palette. |
| [in,out] | os | stream to write to. |
| [in] | lat | hex lattice. |
| [in] | palette | colour mapping. |
| [in] | radius | hex circumradius (default 0.5cm). |
| [in] | pointy_top | use pointy-top orientation (default true). |
Definition at line 330 of file tpl_ca_hex_lattice.H.
References axial_to_pixel_flat(), axial_to_pixel_pointy(), Aleph::blossom_maximum_cardinality_matching(), and r.
Referenced by main(), render_hex_lattice_tikz(), and TEST().
|
inline |
Render a frame as SVG using the default binary RGB mapper.
| Lattice | lattice type. |
| [in,out] | out | output stream. |
| [in] | frame | frame to render. |
| [in] | opts | rendering options. |
| [in] | dead_state | state skipped when opts.omit_dead_cells is true. |
| Any | exception propagated by render_lattice_svg. |
|
inline |
Render a supported rank-2 CA frame as SVG.
Rectangular frames produce <rect> cells. Hex_Lattice and Triangular_Lattice frames produce exact <polygon> cells.
| [in,out] | out | output stream. |
| [in] | frame | frame to render. |
| [in] | palette | state-to-colour mapper. |
| [in] | opts | rendering options. |
| [in] | dead_state | state skipped when omit_dead_cells is true. |
| std::domain_error | if cell_size <= 0. |
| std::runtime_error | on stream write failure. |
Definition at line 205 of file ca-svg.H.
Referenced by Aleph::CA::Svg_Frame_Sink< Palette >::accept(), and main().
|
inline |
Return a frame rendered as SVG.
| [in] | frame | frame to render. |
| [in] | palette | state-to-colour mapper. |
| [in] | opts | rendering options. |
| [in] | dead_state | state skipped when opts.omit_dead_cells is true. |
| Any | exception propagated by render_lattice_svg. |
Definition at line 344 of file ca-svg.H.
Referenced by TEST().
|
inline |
|
inline |
|
inline |
|
inline |
Render any supported 2D CA lattice as TikZ.
Hexagonal and triangular lattice wrappers reuse their specialised renderers. All other rank-2 lattices use the rectangular renderer.
| Lattice | lattice type. |
| Palette | invocable state_type -> std::string. |
| [in,out] | out | output stream. |
| [in] | frame | lattice frame. |
| [in] | palette | state-to-colour mapper. |
| [in] | opts | rectangular options used for rectangular frames. |
Definition at line 225 of file ca-tikz.H.
Referenced by TEST(), and Aleph::CA::Directory_Frame_Sink::write_one().
|
inline |
|
inline |
Render a rectangular 2D frame as a TikZ picture.
palette(cell) must return a TikZ colour expression. Coordinates are rendered with row 0 at the top (y=-1cm in the picture options).
| Lattice | 2D lattice type. |
| Palette | invocable state_type -> std::string. |
| [in,out] | out | output stream. |
| [in] | frame | lattice frame. |
| [in] | palette | state-to-colour mapper. |
| [in] | opts | rendering options. |
| std::domain_error | if cell_size <= 0. |
| std::runtime_error | on stream write failure. |
|
inline |
Returns a std::string instead of writing to a stream.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 227 of file tpl_ca_triangular_lattice.H.
References Aleph::blossom_maximum_cardinality_matching(), and render_triangular_lattice_tikz().
|
inline |
Render a triangular frame as a TikZ picture.
Each triangle is drawn as a rotated equilateral polygon with side side, coloured by the user-supplied palette functor. The orientation is set automatically from the cell parity.
| Lattice | triangular lattice type. |
| Palette | state_type -> std::string colour mapping. |
| [in,out] | os | stream to write to. |
| [in] | lat | lattice to render. |
| [in] | palette | colour mapping. |
| [in] | side | triangle side length (default 1). |
Definition at line 202 of file tpl_ca_triangular_lattice.H.
References Aleph::blossom_maximum_cardinality_matching(), tri_is_up(), and tri_pixel_centre().
Referenced by main(), render_triangular_lattice_tikz(), and TEST().
| void Aleph::CA::save_checkpoint | ( | Engine & | engine, |
| const std::filesystem::path & | path, | ||
| const Checkpoint_Options & | options = {} |
||
| ) |
Write a complete engine snapshot to disk atomically.
The frame is serialised cell-by-cell in row-major order, then optionally DEFLATE-compressed (when options.compress). The file is first emitted to <path>.tmp.<pid>.<rand>, fsync'd and finally renamed onto path. A crash before the rename leaves any previous path intact.
Two checkpoints of the same engine state always produce identical bytes when the same options are used, so the format remains reproducible across runs.
| Engine | engine type satisfying Checkpointable_Engine. |
| [in] | engine | engine whose state is captured. |
| [in] | path | destination file path. Parent directories must already exist (the function does not mkdir -p). |
| [in] | options | optional knobs (compression, dir-fsync). Defaults preserve Phase-15 raw output but keep sync_dir = true for crash safety. |
| std::runtime_error | on file open, stream write, fsync or rename failure. |
Lattice::rank <= 3. Higher ranks fail at compile time via static_assert.Definition at line 955 of file ca-checkpoint.H.
References save_checkpoint().
Referenced by Aleph::CA::Periodic_Checkpoint_Observer< Engine >::on_step_end(), save_checkpoint(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
| void Aleph::CA::save_delta_checkpoint | ( | Engine & | engine, |
| const std::vector< std::uint8_t > & | baseline, | ||
| const std::uint64_t | base_step, | ||
| const std::filesystem::path & | path, | ||
| const Checkpoint_Options & | options = {} |
||
| ) |
Write a delta checkpoint relative to a previous payload.
Compares the current engine frame against the raw byte payload of the baseline snapshot and persists only the cells whose byte representation differs. The file references the baseline via its step number (base_step) so consumers know which file to load first.
Delta payload layout (uncompressed view, repeats n times):
When options.compress is set, the entire delta block is DEFLATE-compressed in one go (same as a full snapshot).
| Engine | engine type satisfying Checkpointable_Engine. |
| [in] | engine | engine whose state will be diffed. |
| [in] | baseline | raw byte payload of the previous snapshot (typically captured at the time the baseline was written). The size must equal cell_count * sizeof(state). |
| [in] | base_step | step number of the baseline checkpoint. |
| [in] | path | destination file path. |
| [in] | options | optional knobs (compression, dir-fsync). |
| std::runtime_error | on size mismatch or write failure. |
Definition at line 1082 of file ca-checkpoint.H.
References save_delta_checkpoint().
Referenced by save_delta_checkpoint(), and TEST().
Shannon entropy in nats of the [0, max_state) distribution.
Returns 0 when the lattice is empty or every cell holds the same state. Uses natural logarithms; multiply by 1 / log(2) to obtain bits.
| [in] | lat | lattice to evaluate. |
| [in] | max_state | exclusive upper bound on state values. |
H = -Σ p_i ln(p_i). Definition at line 276 of file ca-metrics.H.
References Aleph::blossom_maximum_cardinality_matching(), h, shannon_entropy(), and state_histogram().
Referenced by Aleph::CA::Entropy_Observer< MaxState >::on_step_begin(), Aleph::CA::Entropy_Observer< MaxState >::on_step_end(), shannon_entropy(), TEST(), and TEST().
|
inlineconstexprnoexcept |
Decide whether a workload should run sequentially.
Returns true when the workload is small enough that the cost of scheduling work onto a thread pool would dominate the actual cell updates. The heuristic is intentionally tunable from the call site rather than baked in: small grids on a deep pool benefit from this cutoff, and larger grids should always parallelise.
| [in] | cells | total cell count to update. |
| [in] | num_partitions | number of partitions that would be spawned. |
| [in] | min_cells | minimum work per partition before parallelisation pays off. |
true when the workload should be executed sequentially. Definition at line 163 of file ca-tiling.H.
References Aleph::blossom_maximum_cardinality_matching().
Referenced by Aleph::CA::Parallel_Synchronous_Engine< Lattice, Rule, Neighborhood, Order >::effective_partitions(), and TEST().
Return the horizontal Sobel gradient kernel.
| T | numeric weight type. |
Kernel2D<T, 3, 3> detecting changes along the column axis. | This | function does not throw. |
Definition at line 384 of file ca-kernels.H.
References Aleph::blossom_maximum_cardinality_matching().
Return the vertical Sobel gradient kernel.
| T | numeric weight type. |
Kernel2D<T, 3, 3> detecting changes along the row axis. | This | function does not throw. |
Definition at line 396 of file ca-kernels.H.
References Aleph::blossom_maximum_cardinality_matching().
|
inlineconstexprnoexcept |
Balanced split of [0, n) into parts contiguous ranges.
The first n % parts ranges receive one extra index, so that the size disparity between any two ranges never exceeds 1. This is the classic "block-cyclic" balance used by OpenMP static. The function is total: passing parts == 0 yields the single full range and passing idx >= parts yields an empty range. This mirrors the default behaviour of std::partition_point-style helpers and is the cleanest way to handle pool-size-dependent loops at compile time.
| [in] | n | total number of indices to split. |
| [in] | parts | desired number of partitions (0 is treated as 1). |
| [in] | idx | partition index in [0, parts). |
idx.Definition at line 127 of file ca-tiling.H.
References Aleph::blossom_maximum_cardinality_matching().
Referenced by Aleph::CA::Row_Partition< Rank >::slab(), Aleph::CA::Column_Partition< Rank >::slab(), TEST(), TEST(), TEST(), and Aleph::CA::Block_Partition_2D::tile().
|
inlineconstexprnoexcept |
64-bit SplitMix hash.
Stateless mixing function used as the building block for every deterministic seed derivation in the CA module. Identical to the reference SplitMix64 step of Vigna's xoroshiro family.
| [in] | x | input value. |
x. | This | function does not throw. |
Definition at line 82 of file ca-rng.H.
Referenced by cell_key_from_coord(), cell_seed(), Aleph::CA::ca_scheme_detail::coord_from_hash(), mix_seed(), TEST(), thread_step_seed(), and Aleph::CA::ca_checkpoint_detail::type_hash().
Count occurrences of every integer state in [0, max_state).
Useful for non-binary CAs that work over a small discrete state set. Cells whose state is outside the range are silently ignored.
| [in] | lat | lattice to inspect. |
| [in] | max_state | exclusive upper bound on the state values. |
max_state with the count for each state. Definition at line 241 of file ca-metrics.H.
References Aleph::and, Aleph::blossom_maximum_cardinality_matching(), for_each_cell(), S, and state_histogram().
Referenced by shannon_entropy(), state_histogram(), and TEST().
| Aleph::CA::Svg_Frame_Sink | ( | std::filesystem::path | , |
| Palette | , | ||
| SVG_Render_Options | = {}, |
||
| std::size_t | = 6 |
||
| ) | -> Svg_Frame_Sink< Palette > |
|
inlinenoexcept |
Free-function swap so the storage plays nicely with std::swap.
| [in,out] | a | first storage. |
| [in,out] | b | second storage. |
| N | number of axes. |
Definition at line 291 of file tpl_ca_bit_storage.H.
|
inlinenoexcept |
Free-function swap so the storage plays nicely with std::swap.
Definition at line 333 of file tpl_ca_storage.H.
|
inlinenoexcept |
Free-function swap so Ghost_Lattice works with std::swap.
| [in,out] | a | first lattice. |
| [in,out] | b | second lattice. |
| Storage | backing storage type. |
| Boundary | boundary tag. |
| Halo | halo thickness. |
Definition at line 562 of file tpl_ca_ghost_lattice.H.
|
inlinenoexcept |
Free-function swap so the lattice plays nicely with std::swap.
Definition at line 269 of file tpl_ca_graph_automaton.H.
|
inlinenoexcept |
Free-function swap so the lattice plays nicely with std::swap.
| [in,out] | a | first lattice. |
| [in,out] | b | second lattice. |
| Storage | storage type. |
| Boundary | boundary tag type. |
Definition at line 309 of file tpl_ca_lattice.H.
|
inlinenoexcept |
Free-function swap so the lattice plays nicely with std::swap.
Definition at line 433 of file tpl_ca_multi_field_lattice.H.
|
inlineconstexprnoexcept |
Build a deterministic seed from (master, thread_id, step).
Useful for the alternative "per-thread substream" strategy in which the rule reuses the same engine for every cell visited by a single worker. This trades determinism across thread counts for raw speed; the per-cell strategy provided by cell_seed() should be preferred whenever cross-scheduling reproducibility is required.
| [in] | master_seed | user-controlled root seed. |
| [in] | thread_id | stable identifier for the worker. |
| [in] | step | step index being evaluated. |
| This | function does not throw. |
Definition at line 180 of file ca-rng.H.
References Aleph::blossom_maximum_cardinality_matching(), and splitmix64().
Referenced by Aleph::CA::Per_Thread_RNG< Engine >::for_thread_step().
Definition at line 204 of file ca-metrics.H.
References Aleph::blossom_maximum_cardinality_matching(), and total_cells().
Referenced by alive_density(), density(), Aleph::CA::Density_Observer< State >::on_step_begin(), Aleph::CA::Density_Observer< State >::on_step_end(), and total_cells().
c is a down triangle. Definition at line 110 of file tpl_ca_triangular_lattice.H.
References tri_parity().
Referenced by TEST().
c is an up triangle. Definition at line 104 of file tpl_ca_triangular_lattice.H.
References tri_parity().
Referenced by render_triangular_lattice_tikz(), TEST(), tri_pixel_centre(), and Aleph::CA::ca_svg_detail::tri_points().
Definition at line 97 of file tpl_ca_triangular_lattice.H.
References Aleph::blossom_maximum_cardinality_matching().
Referenced by TEST(), tri_is_down(), and tri_is_up().
|
inlinenoexcept |
Cartesian centre of a triangle in (i, j) units.
Each row i is offset vertically by i * height, where height = side * sqrt(3) / 2. Columns are spaced horizontally by side / 2. Up and down triangles inside the same row share their y baseline; their centres are vertically displaced by ±height / 6 (the centroid offset of a unit triangle).
| [in] | c | triangle coords. |
| [in] | side | triangle side length. |
{x, y} Cartesian centroid. Definition at line 127 of file tpl_ca_triangular_lattice.H.
References Aleph::blossom_maximum_cardinality_matching(), tri_is_up(), and y.
Referenced by render_triangular_lattice_tikz(), TEST(), and Aleph::CA::ca_svg_detail::tri_points().
|
inline |
Non-throwing variant of read_csv_snapshot.
Reads a numeric CSV snapshot from the stream. Returns the parsed snapshot on success or an error message on failure. Unlike read_csv_snapshot, this function never throws.
| T | target scalar type. |
| [in,out] | in | input stream. |
| [in] | opts | CSV parsing options. |
expected<Grid_Snapshot<T>, std::string>: snapshot on success, error message on failure.Definition at line 1793 of file ca-io.H.
References try_read_csv_snapshot().
Referenced by try_read_csv_snapshot().
|
inline |
Non-throwing variant of read_life_105.
Reads a Life 1.05 pattern from the stream. Returns the parsed pattern on success or an error message on failure. Unlike read_life_105, this function never throws.
| [in,out] | in | input stream. |
expected<Binary_Cell_Pattern, std::string>: pattern on success, error message on failure.Definition at line 1746 of file ca-io.H.
References Aleph::blossom_maximum_cardinality_matching(), read_life_105(), and try_read_life_105().
Referenced by TEST(), TEST(), and try_read_life_105().
|
inline |
Non-throwing variant of read_life_106.
Reads a Life 1.06 pattern from the stream. Returns the parsed pattern on success or an error message on failure. Unlike read_life_106, this function never throws.
| [in,out] | in | input stream. |
expected<Binary_Cell_Pattern, std::string>: pattern on success, error message on failure.Definition at line 1768 of file ca-io.H.
References Aleph::blossom_maximum_cardinality_matching(), read_life_106(), and try_read_life_106().
Referenced by main(), TEST(), TEST(), and try_read_life_106().
|
inline |
Non-throwing variant of read_plaintext.
Reads a Life plaintext pattern from the stream. Returns the parsed pattern on success or an error message on failure. Unlike read_plaintext, this function never throws.
| [in,out] | in | input stream. |
expected<Binary_Cell_Pattern, std::string>: pattern on success, error message on failure.Definition at line 1724 of file ca-io.H.
References Aleph::blossom_maximum_cardinality_matching(), read_plaintext(), and try_read_plaintext().
Referenced by TEST(), and try_read_plaintext().
|
inline |
Non-throwing variant of read_rle.
Reads a Conway RLE pattern from the stream. Returns the parsed pattern on success or an error message on failure. Unlike read_rle, this function never throws.
| [in,out] | in | input stream. |
expected<RLE_Pattern, std::string>: pattern on success, error message on failure.Definition at line 1680 of file ca-io.H.
References Aleph::blossom_maximum_cardinality_matching(), read_rle(), and try_read_rle().
Referenced by main(), TEST(), and try_read_rle().
|
inline |
Non-throwing variant of read_rle_string.
Parses a Conway RLE pattern from a string. Returns the parsed pattern on success or an error message on failure. Unlike read_rle_string, this function never throws.
| [in] | s | RLE document. |
expected<RLE_Pattern, std::string>: pattern on success, error message on failure.Definition at line 1702 of file ca-io.H.
References read_rle_string(), and try_read_rle_string().
Referenced by TEST(), TEST(), TEST(), and try_read_rle_string().
|
inline |
Sample a uniform integer in [lo, hi] (inclusive).
Provided for portability of the stochastic rules; mirrors the semantics of std::uniform_int_distribution<std::size_t>(lo, hi) but uses our uniform_unit so the bit pattern is reproducible across vendors.
| Engine | RNG engine type. |
| [in,out] | eng | RNG engine; advanced by one draw. |
| [in] | lo | lower bound (inclusive). |
| [in] | hi | upper bound (inclusive); must satisfy lo <= hi. |
[lo, hi]. | Any | exception thrown by eng(). |
Definition at line 231 of file ca-rng.H.
References Aleph::blossom_maximum_cardinality_matching(), and uniform_unit().
Map a 64-bit RNG output to a uniform value in [0, 1).
Implementation-defined components of std::uniform_real_distribution vary across standard library vendors, so we provide a small portable converter that uses the top 53 bits of eng(). The output is bit-exact across platforms when fed the same engine state.
| Engine | RNG engine type whose result_type is at least 53 bits wide. |
| [in,out] | eng | RNG engine; advanced by one draw. |
[0, 1). | Any | exception thrown by eng(). |
Definition at line 206 of file ca-rng.H.
References Aleph::blossom_maximum_cardinality_matching().
Referenced by Aleph::CA::Forest_Fire_Rule< Engine >::operator()(), Aleph::CA::SIR_Rule< Engine >::operator()(), Aleph::CA::Ising_Glauber_Rule< Engine >::operator()(), Aleph::CA::Ising_Metropolis_Rule< Engine >::operator()(), Aleph::CA::Schelling_Rule< Engine >::operator()(), TEST(), and uniform_int().
|
inline |
Write a numeric CSV snapshot.
Each lattice row becomes one CSV record. Values are emitted with operator<<.
| Lattice | 2D lattice type. |
| [in,out] | out | output stream. |
| [in] | frame | lattice frame. |
| [in] | opts | CSV options. |
| std::runtime_error | on stream write failure. |
Definition at line 1207 of file ca-io.H.
References write_csv().
Referenced by TEST(), TEST(), write_csv(), and Aleph::CA::Directory_Frame_Sink::write_one().
|
inline |
Write a sequence of RGB frames as an animated GIF.
| [in,out] | out | output stream. |
| [in] | frames | RGB frames, all with identical dimensions. |
| [in] | opts | GIF options. |
| std::domain_error | if no frames are supplied or dimensions differ. |
| std::runtime_error | on stream write failure. |
Definition at line 253 of file ca-gif.H.
Referenced by Aleph::CA::Gif_Frame_Sink< Mapper >::flush().
|
inline |
Write a JSON snapshot.
Schema:
| Lattice | 2D lattice type. |
| [in,out] | out | output stream. |
| [in] | frame | lattice frame. |
| [in] | opts | JSON options. |
| std::runtime_error | on stream write failure. |
Definition at line 1314 of file ca-io.H.
References write_json().
Referenced by Aleph::CA::JSON_Frame_Stream_Writer::accept(), TEST(), TEST(), write_json(), and Aleph::CA::Directory_Frame_Sink::write_one().
|
inline |
Write a Life 1.05 file.
The writer emits one #P 0 0 block that covers the full frame. Live cells use *; dead cells use ..
| Lattice | 2D lattice type. |
| [in,out] | out | output stream. |
| [in] | frame | lattice frame. |
| [in] | comment | optional #D comment text. |
| [in] | dead | state considered dead. |
| std::runtime_error | on stream write failure. |
Definition at line 1072 of file ca-io.H.
References write_life_105().
Referenced by TEST(), and write_life_105().
|
inline |
Write a Life 1.06 file.
Live cells are emitted as col row integer coordinate pairs.
| Lattice | 2D lattice type. |
| [in,out] | out | output stream. |
| [in] | frame | lattice frame. |
| [in] | dead | state considered dead. |
| std::runtime_error | on stream write failure. |
Definition at line 981 of file ca-io.H.
References write_life_106().
Referenced by TEST(), and write_life_106().
Write a lattice frame as a NumPy .npy array.
The lattice rank becomes the NumPy array rank and the payload is emitted in row-major order.
| Lattice | lattice type with an arithmetic state type. |
| [in,out] | out | output stream. |
| [in] | frame | frame to write. |
| std::runtime_error | on stream write failure. |
Definition at line 151 of file ca-npy.H.
References ah_domain_error_if, ah_runtime_error_if, Aleph::blossom_maximum_cardinality_matching(), out, and Aleph::CA::ca_npy_detail::shape_tuple().
Referenced by Aleph::CA::Npy_Frame_Sink::accept(), main(), and TEST().
|
inline |
Write a binary PGM (P5) image using the default binary mapper.
| Lattice | 2D lattice type. |
| [in,out] | out | output stream. |
| [in] | frame | lattice frame. |
| [in] | opts | NetPBM options. |
Definition at line 1475 of file ca-io.H.
References write_pgm().
|
inline |
Write a binary PGM (P5) image.
mapper(cell) must return a grayscale byte. The top lattice row is the first image row.
| Lattice | 2D lattice type. |
| Mapper | invocable state_type -> uint8_t. |
| [in,out] | out | output stream. |
| [in] | frame | lattice frame. |
| [in] | mapper | grayscale mapper. |
| [in] | opts | NetPBM options. |
| std::runtime_error | on stream write failure. |
Definition at line 1444 of file ca-io.H.
References write_pgm().
Referenced by TEST(), Aleph::CA::Directory_Frame_Sink::write_one(), write_pgm(), and write_pgm().
|
inline |
Write a Life plaintext (.cells) pattern.
| Lattice | 2D lattice type. |
| [in,out] | out | output stream. |
| [in] | frame | lattice frame. |
| [in] | opts | plaintext options. |
| [in] | dead | state considered dead. |
| std::runtime_error | on stream write failure. |
Definition at line 867 of file ca-io.H.
References write_plaintext().
Referenced by write_plaintext().
|
inline |
Return a Life plaintext document.
| Lattice | 2D lattice type. |
| [in] | frame | lattice frame. |
| [in] | opts | plaintext options. |
| [in] | dead | state considered dead. |
Definition at line 897 of file ca-io.H.
References write_plaintext_string().
Referenced by TEST(), and write_plaintext_string().
|
inline |
Write a rank-2 frame as an 8-bit RGB PNG image.
mapper(cell) must return an RGB8 colour. The function writes a complete PNG stream to out without closing it.
| [in,out] | out | output stream. |
| [in] | frame | frame to encode. |
| [in] | mapper | state-to-RGB mapper. |
| std::domain_error | if the frame has zero width or height. |
| std::runtime_error | on stream write failure. |
Definition at line 171 of file ca-png.H.
References m.
Referenced by Aleph::CA::Png_Frame_Sink< Mapper >::accept(), TEST(), TEST(), Aleph::CA::Reproductions::write_gray_scott_png(), and write_png().
|
inline |
Write a binary PPM (P6) image using the default binary mapper.
| Lattice | 2D lattice type. |
| [in,out] | out | output stream. |
| [in] | frame | lattice frame. |
| [in] | opts | NetPBM options. |
Definition at line 1529 of file ca-io.H.
References write_ppm().
|
inline |
Write a binary PPM (P6) image.
mapper(cell) must return an RGB8 triplet.
| [in,out] | out | output stream. |
| [in] | frame | lattice frame. |
| [in] | mapper | RGB mapper. |
| [in] | opts | NetPBM options. |
| std::runtime_error | on stream write failure. |
Definition at line 1496 of file ca-io.H.
References write_ppm().
Referenced by Aleph::CA::Ffmpeg_Frame_Sink< Mapper >::accept(), main(), TEST(), Aleph::CA::Directory_Frame_Sink::write_one(), write_ppm(), and write_ppm().
|
inline |
Write a 2D frame in Conway RLE format.
A cell is considered alive when it differs from dead. With the default options, the complete frame dimensions are preserved in the RLE header. Set opts.trim_dead_border for compact pattern output.
| Lattice | 2D lattice type. |
| [in,out] | out | output stream. |
| [in] | frame | lattice frame. |
| [in] | opts | RLE formatting options. |
| [in] | dead | state considered dead. |
| std::runtime_error | on stream write failure. |
Definition at line 575 of file ca-io.H.
References write_rle().
Referenced by Aleph::CA::Directory_Frame_Sink::write_one(), and write_rle().
|
inline |
Return a frame encoded as Conway RLE.
| Lattice | 2D lattice type. |
| [in] | frame | lattice frame. |
| [in] | opts | RLE formatting options. |
| [in] | dead | state considered dead. |
Definition at line 668 of file ca-io.H.
References write_rle_string().
Referenced by TEST(), TEST(), and write_rle_string().
|
inline |
Write a 2D or 3D lattice as VTK legacy STRUCTURED_POINTS.
Axis mapping follows VTK convention: CA axis 0 maps to Y in 2D and Z in 3D, while the last CA axis maps to X.
| Lattice | rank-2 or rank-3 lattice type with arithmetic state. |
| [in,out] | out | output stream. |
| [in] | frame | frame to write. |
| [in] | opts | VTK options. |
| std::runtime_error | on stream write failure. |
Definition at line 119 of file ca-vtk.H.
Referenced by Aleph::CA::VTK_Frame_Sink::accept(), main(), and TEST().
| Aleph::CA::X11_Frame_Sink | ( | Mapper | , |
| X11_Viewer_Options | = {} |
||
| ) | -> X11_Frame_Sink< Mapper > |
|
inlineconstexpr |
Conway's Game of Life: B3/S23.
Definition at line 123 of file tpl_ca_hashlife.H.
Referenced by INSTANTIATE_TEST_SUITE_P(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
inlineconstexpr |
Bays' Day & Night: B3678/S34678 (self-complementary).
Definition at line 132 of file tpl_ca_hashlife.H.
Referenced by TEST().
|
inlineconstexpr |
Nathan Thompson's HighLife: B36/S23 (replicators).
Definition at line 127 of file tpl_ca_hashlife.H.
|
inlineconstexpr |
Seeds: B2/S (every live cell dies, two neighbours produce a birth).
Definition at line 137 of file tpl_ca_hashlife.H.
Referenced by TEST().