Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::CA::Triangular_Lattice< Storage, Boundary > Class Template Reference

Triangular lattice with parity helpers over a 2D storage. More...

#include <tpl_ca_triangular_lattice.H>

Inheritance diagram for Aleph::CA::Triangular_Lattice< Storage, Boundary >:
[legend]
Collaboration diagram for Aleph::CA::Triangular_Lattice< Storage, Boundary >:
[legend]

Public Types

using base_type = Lattice< Storage, Boundary >
 
using state_type = typename base_type::state_type
 
using coord_type = typename base_type::coord_type
 
using extents_type = typename base_type::extents_type
 
- Public Types inherited from Aleph::CA::Lattice< Storage, Boundary >
using storage_type = Storage
 
using boundary_type = Boundary
 
using state_type = typename Storage::state_type
 
using coord_type = typename Storage::coord_type
 
using extents_type = typename Storage::extents_type
 

Public Member Functions

ca_size_t rows () const noexcept
 < inherit constructors
 
ca_size_t cols () const noexcept
 Number of columns (axis 1).
 
state_type at_tri (Tri_Coord c) const
 
void set_tri (Tri_Coord c, const state_type &v)
 Write cell value at triangular coords (i, j) (strict).
 
state_type at_tri_safe (Tri_Coord c) const
 Boundary-aware read at triangular coords.
 
- Public Member Functions inherited from Aleph::CA::Lattice< Storage, Boundary >
 Lattice ()=default
 Construct an empty lattice (no cells allocated).
 
 Lattice (const extents_type &extents, const state_type &init=state_type{})
 Construct a lattice with the given extents and initial value.
 
 Lattice (Storage &&s) noexcept(std::is_nothrow_move_constructible_v< Storage >)
 Wrap an existing storage by move.
 
ca_size_t size () const noexcept
 
ca_size_t size (std::size_t d) const
 
const extents_type & extents () const noexcept
 
state_type at (const coord_type &c) const
 Strict access: throws if c is out of range.
 
void set (const coord_type &c, const state_type &v)
 Strict write: throws if c is out of range.
 
state_type at_safe (coord_type c) const
 Boundary-aware read.
 
const Storage & storage () const noexcept
 Direct read access to the underlying storage (read-only).
 
Storage & storage () noexcept
 Direct read-write access to the underlying storage.
 
void fill (const state_type &value)
 Set every cell to value.
 
void swap (Lattice &other) noexcept(noexcept(store_.swap(other.store_)))
 O(1) swap.
 

Static Public Attributes

static constexpr std::size_t rank = base_type::rank
 
- Static Public Attributes inherited from Aleph::CA::Lattice< Storage, Boundary >
static constexpr std::size_t rank = Storage::rank
 

Additional Inherited Members

- Static Public Member Functions inherited from Aleph::CA::Lattice< Storage, Boundary >
static constexpr std::size_t dimension () noexcept
 

Detailed Description

template<typename Storage, typename Boundary = OpenBoundary>
class Aleph::CA::Triangular_Lattice< Storage, Boundary >

Triangular lattice with parity helpers over a 2D storage.

Inherits the full Lattice API. Iteration order, double buffering and engine integration work the same way as for any rectangular lattice; the only difference is that the rule should consume Triangular_Neighborhood (three edge-neighbours, parity-aware) rather than Moore / Von Neumann.

Template Parameters
Storagestorage type (rank 2) satisfying LatticeLike.
Boundaryboundary tag, default OpenBoundary.

Definition at line 150 of file tpl_ca_triangular_lattice.H.

Member Typedef Documentation

◆ base_type

template<typename Storage , typename Boundary = OpenBoundary>
using Aleph::CA::Triangular_Lattice< Storage, Boundary >::base_type = Lattice<Storage, Boundary>

Definition at line 155 of file tpl_ca_triangular_lattice.H.

◆ coord_type

template<typename Storage , typename Boundary = OpenBoundary>
using Aleph::CA::Triangular_Lattice< Storage, Boundary >::coord_type = typename base_type::coord_type

Definition at line 157 of file tpl_ca_triangular_lattice.H.

◆ extents_type

template<typename Storage , typename Boundary = OpenBoundary>
using Aleph::CA::Triangular_Lattice< Storage, Boundary >::extents_type = typename base_type::extents_type

Definition at line 158 of file tpl_ca_triangular_lattice.H.

◆ state_type

template<typename Storage , typename Boundary = OpenBoundary>
using Aleph::CA::Triangular_Lattice< Storage, Boundary >::state_type = typename base_type::state_type

Definition at line 156 of file tpl_ca_triangular_lattice.H.

Member Function Documentation

◆ at_tri()

template<typename Storage , typename Boundary = OpenBoundary>
state_type Aleph::CA::Triangular_Lattice< Storage, Boundary >::at_tri ( Tri_Coord  c) const
inline
Returns
cell value at triangular coords (i, j) (strict).

Definition at line 170 of file tpl_ca_triangular_lattice.H.

References Aleph::CA::Lattice< Storage, Boundary >::at(), Aleph::CA::Tri_Coord::i, and Aleph::CA::Tri_Coord::j.

◆ at_tri_safe()

template<typename Storage , typename Boundary = OpenBoundary>
state_type Aleph::CA::Triangular_Lattice< Storage, Boundary >::at_tri_safe ( Tri_Coord  c) const
inline

Boundary-aware read at triangular coords.

Definition at line 182 of file tpl_ca_triangular_lattice.H.

References Aleph::CA::Lattice< Storage, Boundary >::at_safe(), Aleph::CA::Tri_Coord::i, and Aleph::CA::Tri_Coord::j.

◆ cols()

template<typename Storage , typename Boundary = OpenBoundary>
ca_size_t Aleph::CA::Triangular_Lattice< Storage, Boundary >::cols ( ) const
inlinenoexcept

Number of columns (axis 1).

Definition at line 167 of file tpl_ca_triangular_lattice.H.

References Aleph::CA::Lattice< Storage, Boundary >::size().

◆ rows()

template<typename Storage , typename Boundary = OpenBoundary>
ca_size_t Aleph::CA::Triangular_Lattice< Storage, Boundary >::rows ( ) const
inlinenoexcept

< inherit constructors

Number of rows (axis 0).

Definition at line 164 of file tpl_ca_triangular_lattice.H.

References Aleph::CA::Lattice< Storage, Boundary >::size().

◆ set_tri()

template<typename Storage , typename Boundary = OpenBoundary>
void Aleph::CA::Triangular_Lattice< Storage, Boundary >::set_tri ( Tri_Coord  c,
const state_type &  v 
)
inline

Write cell value at triangular coords (i, j) (strict).

Definition at line 176 of file tpl_ca_triangular_lattice.H.

References Aleph::CA::Tri_Coord::i, Aleph::CA::Tri_Coord::j, and Aleph::CA::Lattice< Storage, Boundary >::set().

Referenced by TEST(), and TEST().

Member Data Documentation

◆ rank

template<typename Storage , typename Boundary = OpenBoundary>
constexpr std::size_t Aleph::CA::Triangular_Lattice< Storage, Boundary >::rank = base_type::rank
staticconstexpr

Definition at line 159 of file tpl_ca_triangular_lattice.H.


The documentation for this class was generated from the following file: