|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Phase 14 multi-field cellular automata lattice (AoS / SoA). More...
#include <array>#include <concepts>#include <cstddef>#include <tuple>#include <type_traits>#include <utility>#include <ah-errors.H>#include <ca-traits.H>#include <tpl_ca_concepts.H>#include <tpl_ca_lattice.H>#include <tpl_ca_storage.H>Go to the source code of this file.
Classes | |
| struct | Aleph::CA::Layout_AoS |
Layout tag: each cell is a std::tuple<Fields...> inside a single contiguous storage. More... | |
| struct | Aleph::CA::Layout_SoA |
| Layout tag: one contiguous storage per field. More... | |
| class | Aleph::CA::Multi_Field_Lattice< Layout, Boundary, Rank, Fields > |
| Multi-field lattice with selectable storage layout. More... | |
Namespaces | |
| namespace | Aleph |
| Main namespace for Aleph-w library functions. | |
| namespace | Aleph::CA |
| namespace | Aleph::CA::ca_mf_detail |
Concepts | |
| concept | Aleph::CA::MultiFieldLatticeLike |
| Concept: a lattice that exposes the multi-field interface. | |
Typedefs | |
| template<std::size_t... I> | |
| using | Aleph::CA::ca_mf_detail::index_seq = std::index_sequence< I... > |
| Index sequence helper. | |
| template<std::size_t Rank, typename Boundary , typename... Fields> | |
| using | Aleph::CA::ca_mf_detail::soa_storages = std::tuple< Lattice< Dense_Cell_Storage< Fields, Rank >, Boundary >... > |
| Per-field SoA storage tuple type. | |
| template<typename... Fields> | |
| using | Aleph::CA::ca_mf_detail::aos_cell = std::tuple< Fields... > |
| AoS cell type. | |
| template<std::size_t Rank, typename Boundary , typename... Fields> | |
| using | Aleph::CA::ca_mf_detail::aos_lattice = Lattice< Dense_Cell_Storage< aos_cell< Fields... >, Rank >, Boundary > |
| AoS lattice type. | |
Functions | |
| template<typename Layout , typename Boundary , std::size_t Rank, typename... Fields> | |
| void | Aleph::CA::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. | |
Phase 14 multi-field cellular automata lattice (AoS / SoA).
A multi-field lattice keeps several typed fields per cell that evolve as a coupled system: temperature + concentration, prey + predator, susceptible + infected + recovered, and so on. The same logical lattice is exposed in two interchangeable layouts controlled by a tag template parameter:
Layout_AoS (Array of Structs): the cell is a std::tuple<Fields...> stored in a single Dense_Cell_Storage. Cache-friendly when every field is read together (small grids, tightly coupled rules).Layout_SoA (Struct of Arrays): one independent Dense_Cell_Storage<Field, Rank> per field, wrapped in a Lattice with the chosen boundary policy. Vectorisable, the natural choice for large grids and rules that touch one field at a time. Each per-field buffer can also be handed to the legacy mono-field engines through field<I>().Both layouts share a uniform field-indexed access surface:
const auto u = lat.template at<0>(coord); lat.template set<1>(coord, new_v); const auto safe_w = lat.template at_safe<2>(coord);
The boundary policy is shared across fields. The lattice rank is fixed at compile time (typical values: 1, 2, 3).
Definition in file tpl_ca_multi_field_lattice.H.