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

Von Neumann (L1) neighborhood of radius R in N dimensions. More...

#include <tpl_ca_neighborhood.H>

Collaboration diagram for Aleph::CA::Von_Neumann< N, R >:
[legend]

Public Types

using coord_type = Coord_Vec< N >
 Coordinate type accepted by for_each_offset.
 

Public Member Functions

template<typename F >
constexpr void for_each_offset (const Coord_Vec< N > &center, 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 L1 radius of the neighborhood.
 
static constexpr std::size_t size () noexcept
 Return the number of neighbours in the neighborhood.
 

Static Public Attributes

static constexpr std::size_t rank_v = N
 Lattice dimension.
 
static constexpr std::size_t radius_v = R
 L1 radius.
 
static constexpr std::size_t size_v = ca_neighborhood_detail::von_neumann_count<N, R>()
 Number of neighbours (excluding center).
 
static constexpr std::array< Offset_Vec< N >, size_v > offsets = ca_neighborhood_detail::compute_von_neumann_offsets<N, R>()
 Compile-time, canonical-ordered offsets array.
 

Detailed Description

template<std::size_t N, std::size_t R = 1>
class Aleph::CA::Von_Neumann< N, R >

Von Neumann (L1) neighborhood of radius R in N dimensions.

Enumerates every offset whose |x|_1 lies in [1, R]. For 2D radius 1 this is the classic 4-neighbour cross.

Definition at line 290 of file tpl_ca_neighborhood.H.

Member Typedef Documentation

◆ coord_type

template<std::size_t N, std::size_t R = 1>
using Aleph::CA::Von_Neumann< N, R >::coord_type = Coord_Vec<N>

Coordinate type accepted by for_each_offset.

Definition at line 303 of file tpl_ca_neighborhood.H.

Member Function Documentation

◆ for_each_offset()

template<std::size_t N, std::size_t R = 1>
template<typename F >
constexpr void Aleph::CA::Von_Neumann< N, R >::for_each_offset ( const Coord_Vec< N > &  center,
F &&  f 
) const
inlineconstexpr

Apply a functor to each offset in the neighborhood.

Template Parameters
Ffunctor type.
Parameters
[in]centerthe coordinate of the center cell (unused).
[in]ffunctor to apply to each Offset_Vec<N>.

Definition at line 334 of file tpl_ca_neighborhood.H.

References Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::Von_Neumann< N, R >::offsets, and Aleph::CA::Von_Neumann< N, R >::size_v.

Referenced by TEST().

◆ radius()

template<std::size_t N, std::size_t R = 1>
static constexpr std::size_t Aleph::CA::Von_Neumann< N, R >::radius ( )
inlinestaticconstexprnoexcept

Return the L1 radius of the neighborhood.

Returns
the template parameter R.

Definition at line 315 of file tpl_ca_neighborhood.H.

References Aleph::CA::R.

◆ size()

template<std::size_t N, std::size_t R = 1>
static constexpr std::size_t Aleph::CA::Von_Neumann< N, R >::size ( )
inlinestaticconstexprnoexcept

Return the number of neighbours in the neighborhood.

Returns
size_v.

Definition at line 323 of file tpl_ca_neighborhood.H.

References Aleph::CA::Von_Neumann< N, R >::size_v.

Member Data Documentation

◆ offsets

template<std::size_t N, std::size_t R = 1>
constexpr std::array<Offset_Vec<N>, size_v> Aleph::CA::Von_Neumann< N, R >::offsets = ca_neighborhood_detail::compute_von_neumann_offsets<N, R>()
staticconstexpr

Compile-time, canonical-ordered offsets array.

Contains all size_v offsets satisfying 1 <= |off|_1 <= R.

Definition at line 309 of file tpl_ca_neighborhood.H.

Referenced by Aleph::CA::Von_Neumann< N, R >::for_each_offset().

◆ radius_v

template<std::size_t N, std::size_t R = 1>
constexpr std::size_t Aleph::CA::Von_Neumann< N, R >::radius_v = R
staticconstexpr

L1 radius.

Definition at line 299 of file tpl_ca_neighborhood.H.

◆ rank_v

template<std::size_t N, std::size_t R = 1>
constexpr std::size_t Aleph::CA::Von_Neumann< N, R >::rank_v = N
staticconstexpr

Lattice dimension.

Definition at line 297 of file tpl_ca_neighborhood.H.

◆ size_v

template<std::size_t N, std::size_t R = 1>
constexpr std::size_t Aleph::CA::Von_Neumann< N, R >::size_v = ca_neighborhood_detail::von_neumann_count<N, R>()
staticconstexpr

Number of neighbours (excluding center).

Definition at line 301 of file tpl_ca_neighborhood.H.

Referenced by Aleph::CA::Von_Neumann< N, R >::for_each_offset(), and Aleph::CA::Von_Neumann< N, R >::size().


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