|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Moore (Chebyshev) neighborhood of radius R in N dimensions.
More...
#include <tpl_ca_neighborhood.H>
Public Types | |
| using | coord_type = Coord_Vec< N > |
| Coordinate type accepted by for_each_offset. | |
Public Member Functions | |
| constexpr std::size_t | size () const noexcept |
| Return the number of neighbours in the neighborhood. | |
| template<typename F > | |
| constexpr void | for_each_offset (const Coord_Vec< N > ¢er, F &&f) const |
| Apply a functor to each offset in the neighborhood. | |
Static Public Member Functions | |
| static constexpr std::size_t | radius () noexcept |
| Return the Chebyshev radius of the neighborhood. | |
Static Public Attributes | |
| static constexpr std::size_t | rank_v = N |
| Lattice dimension. | |
| static constexpr std::size_t | radius_v = R |
| Chebyshev radius. | |
| static constexpr std::size_t | size_v = ca_neighborhood_detail::static_pow(2 * R + 1, N) - 1 |
| Number of neighbours (excluding center). | |
| static constexpr std::array< Offset_Vec< N >, size_v > | offsets = ca_neighborhood_detail::compute_moore_offsets<N, R>() |
| Compile-time, canonical-ordered offsets array. | |
Moore (Chebyshev) neighborhood of radius R in N dimensions.
Enumerates every offset whose components lie in [-R, R], except the origin. Total: (2R+1)^N - 1. For 2D radius 1 this is the classic 8-neighbour pattern used by Conway's Game of Life.
Definition at line 228 of file tpl_ca_neighborhood.H.
| using Aleph::CA::Moore< N, R >::coord_type = Coord_Vec<N> |
Coordinate type accepted by for_each_offset.
Definition at line 241 of file tpl_ca_neighborhood.H.
|
inlineconstexpr |
Apply a functor to each offset in the neighborhood.
| F | functor type. |
| [in] | center | the coordinate of the center cell. |
| [in] | f | functor to apply. |
Definition at line 272 of file tpl_ca_neighborhood.H.
References Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::Moore< N, R >::offsets, and Aleph::CA::Moore< N, R >::size_v.
Referenced by TEST().
|
inlinestaticconstexprnoexcept |
Return the Chebyshev radius of the neighborhood.
R. Definition at line 253 of file tpl_ca_neighborhood.H.
References Aleph::CA::R.
|
inlineconstexprnoexcept |
Return the number of neighbours in the neighborhood.
size_v, equal to (2R+1)^N - 1. Definition at line 261 of file tpl_ca_neighborhood.H.
References Aleph::CA::Moore< N, R >::size_v.
|
staticconstexpr |
Compile-time, canonical-ordered offsets array.
Contains all size_v offsets sorted in lexicographic order.
Definition at line 247 of file tpl_ca_neighborhood.H.
Referenced by Aleph::CA::Moore< N, R >::for_each_offset().
|
staticconstexpr |
Chebyshev radius.
Definition at line 237 of file tpl_ca_neighborhood.H.
|
staticconstexpr |
Lattice dimension.
Definition at line 235 of file tpl_ca_neighborhood.H.
|
staticconstexpr |
Number of neighbours (excluding center).
Definition at line 239 of file tpl_ca_neighborhood.H.
Referenced by Aleph::CA::Moore< N, R >::for_each_offset(), and Aleph::CA::Moore< N, R >::size().