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

User-supplied list of offsets for arbitrary connectivity. More...

#include <tpl_ca_neighborhood.H>

Collaboration diagram for Aleph::CA::Custom_Neighborhood< N, K, Radius >:
[legend]

Public Types

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

Public Member Functions

constexpr Custom_Neighborhood (std::array< Offset_Vec< N >, K > os)
 Build a custom neighborhood from an std::array of offsets.
 
constexpr Custom_Neighborhood (const Offset_Vec< N >(&os)[K])
 Build a custom neighborhood from a braced offset list.
 
constexpr std::size_t radius () const noexcept
 
constexpr std::size_t size () const noexcept
 
constexpr const std::array< Offset_Vec< N >, K > & offsets () const noexcept
 
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 Attributes

static constexpr std::size_t rank_v = N
 Lattice dimension.
 
static constexpr std::size_t size_v = K
 Number of neighbours.
 
static constexpr std::size_t radius_v = Radius
 Compile-time radius (0 if unknown).
 

Private Attributes

std::array< Offset_Vec< N >, K > offs_
 

Detailed Description

template<std::size_t N, std::size_t K, std::size_t Radius = 0>
class Aleph::CA::Custom_Neighborhood< N, K, Radius >

User-supplied list of offsets for arbitrary connectivity.

Template Parameters
Nlattice rank.
Knumber of offsets (compile-time constant).
Radiusoptional compile-time radius; 0 means unknown and radius() computes the actual Chebyshev radius.

Definition at line 474 of file tpl_ca_neighborhood.H.

Member Typedef Documentation

◆ coord_type

template<std::size_t N, std::size_t K, std::size_t Radius = 0>
using Aleph::CA::Custom_Neighborhood< N, K, Radius >::coord_type = Coord_Vec<N>

Coordinate type accepted by for_each_offset.

Definition at line 489 of file tpl_ca_neighborhood.H.

Constructor & Destructor Documentation

◆ Custom_Neighborhood() [1/2]

template<std::size_t N, std::size_t K, std::size_t Radius = 0>
constexpr Aleph::CA::Custom_Neighborhood< N, K, Radius >::Custom_Neighborhood ( std::array< Offset_Vec< N >, K >  os)
inlineexplicitconstexpr

Build a custom neighborhood from an std::array of offsets.

Parameters
osoffsets in the exact order exposed by for_each_offset().

Definition at line 495 of file tpl_ca_neighborhood.H.

◆ Custom_Neighborhood() [2/2]

template<std::size_t N, std::size_t K, std::size_t Radius = 0>
constexpr Aleph::CA::Custom_Neighborhood< N, K, Radius >::Custom_Neighborhood ( const Offset_Vec< N >(&)  os[K])
inlineexplicitconstexpr

Build a custom neighborhood from a braced offset list.

This overload keeps direct-list initialization such as Custom_Neighborhood<2, 3>({ Offset_Vec<2>{ ... }, ... }) unambiguous across GCC and Clang.

Parameters
osoffsets in the exact order exposed by for_each_offset().

Definition at line 505 of file tpl_ca_neighborhood.H.

References Aleph::blossom_maximum_cardinality_matching(), and Aleph::CA::Custom_Neighborhood< N, K, Radius >::offs_.

Member Function Documentation

◆ for_each_offset()

template<std::size_t N, std::size_t K, std::size_t Radius = 0>
template<typename F >
constexpr void Aleph::CA::Custom_Neighborhood< N, K, Radius >::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.
[in]ffunctor to apply.

Definition at line 544 of file tpl_ca_neighborhood.H.

References Aleph::blossom_maximum_cardinality_matching(), and Aleph::CA::Custom_Neighborhood< N, K, Radius >::offs_.

◆ offsets()

template<std::size_t N, std::size_t K, std::size_t Radius = 0>
constexpr const std::array< Offset_Vec< N >, K > & Aleph::CA::Custom_Neighborhood< N, K, Radius >::offsets ( ) const
inlineconstexprnoexcept
Returns
a reference to the array of offsets.

Definition at line 533 of file tpl_ca_neighborhood.H.

References Aleph::CA::Custom_Neighborhood< N, K, Radius >::offs_.

◆ radius()

template<std::size_t N, std::size_t K, std::size_t Radius = 0>
constexpr std::size_t Aleph::CA::Custom_Neighborhood< N, K, Radius >::radius ( ) const
inlineconstexprnoexcept
Returns
the largest Chebyshev component across the offset list.

Definition at line 512 of file tpl_ca_neighborhood.H.

References k, N, Aleph::CA::Custom_Neighborhood< N, K, Radius >::offs_, and r.

◆ size()

template<std::size_t N, std::size_t K, std::size_t Radius = 0>
constexpr std::size_t Aleph::CA::Custom_Neighborhood< N, K, Radius >::size ( ) const
inlineconstexprnoexcept
Returns
the number of neighbours.

Definition at line 527 of file tpl_ca_neighborhood.H.

Member Data Documentation

◆ offs_

◆ radius_v

template<std::size_t N, std::size_t K, std::size_t Radius = 0>
constexpr std::size_t Aleph::CA::Custom_Neighborhood< N, K, Radius >::radius_v = Radius
staticconstexpr

Compile-time radius (0 if unknown).

Definition at line 487 of file tpl_ca_neighborhood.H.

◆ rank_v

template<std::size_t N, std::size_t K, std::size_t Radius = 0>
constexpr std::size_t Aleph::CA::Custom_Neighborhood< N, K, Radius >::rank_v = N
staticconstexpr

Lattice dimension.

Definition at line 483 of file tpl_ca_neighborhood.H.

◆ size_v

template<std::size_t N, std::size_t K, std::size_t Radius = 0>
constexpr std::size_t Aleph::CA::Custom_Neighborhood< N, K, Radius >::size_v = K
staticconstexpr

Number of neighbours.

Definition at line 485 of file tpl_ca_neighborhood.H.


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