Skip to content

num::periodic_neighbourhood_2d

Defined in header <core/index_space.hpp>

template <class P>
concept periodic_neighbourhood_2d =
    square_extent_2d<P> && requires(const P &lattice, int i) {
      { lattice.up[i] } -> std::convertible_to<int>;
      { lattice.dn[i] } -> std::convertible_to<int>;
      { lattice.lt[i] } -> std::convertible_to<int>;
      { lattice.rt[i] } -> std::convertible_to<int>;
    };

A square extent carrying precomputed periodic neighbour maps.

The wrap-around is folded into the four index arrays. A stencil sweep therefore needs no modulo and no boundary branch, which is why these are stored rather than computed.