struct neighborhood
Declaration
template <int Dims>
struct neighborhood { /* full declaration omitted */ };
Description
Declares a buffer access that extends from the current work item by a symmetric boundary offset, either in all directions in the shape of a bounding box (default), or along each axis separately (without "diagonal" boundary elements). Buffer and kernel dimensions must both match the Dims
parameter. This is typically used in stencil applications. For bounding-box neighborhoods, - neighborhood({1})
declares the read for a 1D 3-point stencil, - neighborhood({1, 1})
for a 2D 9-point stencil, and - neighborhood({1, 1, 1})
for a 3D 27-point stencil. For neighborhoods defined along axes only, - neighborhood({1}, neighborhood_shape::along_axes)
declares the read for a 1D 3-point stencil, - neighborhood({1, 1}, neighborhood_shape::along_axes)
for a 2D 5-point stencil, and - neighborhood({1, 1, 1}, neighborhood_shape::along_axes)
for a 3D 7-point stencil. For reads, neighborhood_shape::bounding_box
is functionally correct whenever neighborhood_shape::along_axes
is, but will lead to unnecessary copies and transfers between diagonal neighbors in 2D-split work assignments when the application does not actually read from those buffer elements.
Declared at: include/range_mapper.h:198
Template Parameters
- int Dims
Member Variables
- range<Dims> m_extent
- neighborhood_shape m_shape
Member Function Overview
- neighborhood(const range<Dims> & extent, neighborhood_shape shape = neighborhood_shape::bounding_box) → explicit
- neighborhood(size_t dim0, size_t dim1) → explicit
- neighborhood(size_t dim0, size_t dim1, size_t dim2) → explicit
- operator()(const chunk<Dims> & chnk) const → detail::region<Dims>
- extend_axis(const detail::box<Dims> & box, int d) const → detail::box<Dims>
Member Functions
¶explicit neighborhood(
const range<Dims>& extent,
neighborhood_shape shape =
neighborhood_shape::bounding_box)
explicit neighborhood(
const range<Dims>& extent,
neighborhood_shape shape =
neighborhood_shape::bounding_box)
Declared at: include/range_mapper.h:199
Parameters
- const range<Dims>& extent
- neighborhood_shape shape = neighborhood_shape::bounding_box
¶explicit neighborhood(size_t dim0, size_t dim1)
explicit neighborhood(size_t dim0, size_t dim1)
Declared at: include/range_mapper.h:203
Parameters
- size_t dim0
- size_t dim1
¶explicit neighborhood(size_t dim0,
size_t dim1,
size_t dim2)
explicit neighborhood(size_t dim0,
size_t dim1,
size_t dim2)
Declared at: include/range_mapper.h:208
Parameters
- size_t dim0
- size_t dim1
- size_t dim2
¶detail::region<Dims> operator()(
const chunk<Dims>& chnk) const
detail::region<Dims> operator()(
const chunk<Dims>& chnk) const
Declared at: include/range_mapper.h:212
Parameters
- const chunk<Dims>& chnk
¶inline detail::box<Dims> extend_axis(
const detail::box<Dims>& box,
int d) const
inline detail::box<Dims> extend_axis(
const detail::box<Dims>& box,
int d) const
Declared at: include/range_mapper.h:236
Parameters
- const detail::box<Dims>& box
- int d