25#include <sycl/ext/intel/ac_types/ac_int.hpp>
46template <
typename Cell, uindex_t stencil_radius,
typename TimeDependentValue = std::monostate>
47 requires std::semiregular<Cell> && (stencil_radius >= 1)
51 static constexpr uindex_t diameter = 2 * stencil_radius + 1;
54 static constexpr unsigned long bits_stencil = std::bit_width(diameter);
78 TimeDependentValue tdv)
79 : id(id), iteration(iteration), subiteration(subiteration), grid_range(grid_range),
80 time_dependent_value(tdv), internal() {}
93 TimeDependentValue tdv, Cell raw[diameter][diameter])
94 : id(id), iteration(iteration), subiteration(subiteration), grid_range(grid_range),
95 time_dependent_value(tdv), internal() {
97 for (
uindex_t c = 0; c < diameter; c++) {
99 for (
uindex_t r = 0; r < diameter; r++) {
100 internal[c][r] = raw[c][r];
111 return internal[
id.c + stencil_radius][
id.r + stencil_radius];
119 Cell &
operator[](
ID id) {
return internal[
id.c + stencil_radius][
id.r + stencil_radius]; }
189 Cell internal[diameter][diameter];
A generic, two-dimensional index.
Definition GenericID.hpp:32
The stencil buffer.
Definition Stencil.hpp:48
const UID grid_range
The range of the underlying grid.
Definition Stencil.hpp:183
Cell const & operator[](ID id) const
Access a cell in the stencil.
Definition Stencil.hpp:110
Stencil(ID id, UID grid_range, uindex_t iteration, uindex_t subiteration, TimeDependentValue tdv, Cell raw[diameter][diameter])
Create a new stencil with the given contents.
Definition Stencil.hpp:92
Cell & operator[](ID id)
Access a cell in the stencil.
Definition Stencil.hpp:119
Cell & operator[](StencilUID id)
Access a cell in the stencil.
Definition Stencil.hpp:171
ac_int< bits_stencil, false > uindex_stencil_t
An unsigned index type for column and row indices in this stencil.
Definition Stencil.hpp:60
const ID id
The position of the central cell in the global grid.
Definition Stencil.hpp:174
Cell & operator[](UID id)
Access a cell in the stencil.
Definition Stencil.hpp:155
ac_int< bits_stencil, true > index_stencil_t
A signed index type for column and row indices in this stencil.
Definition Stencil.hpp:57
const uindex_t iteration
The present iteration index of the cells in the stencil.
Definition Stencil.hpp:177
Cell const & operator[](UID id) const
Access a cell in the stencil.
Definition Stencil.hpp:147
Stencil(ID id, UID grid_range, uindex_t iteration, uindex_t subiteration, TimeDependentValue tdv)
Create a new stencil with an uninitialized buffer.
Definition Stencil.hpp:77
Cell const & operator[](StencilID id) const
Access a cell in the stencil.
Definition Stencil.hpp:126
const uindex_t subiteration
The present sub-iteration index of the cells in the stencil.
Definition Stencil.hpp:180
const TimeDependentValue time_dependent_value
The time-dependent value for this iteration.
Definition Stencil.hpp:186
Cell const & operator[](StencilUID id) const
Access a cell in the stencil.
Definition Stencil.hpp:163
Cell & operator[](StencilID id)
Access a cell in the stencil.
Definition Stencil.hpp:136
Definition AccessorSubscript.hpp:24
BOOST_PP_CAT(BOOST_PP_CAT(uint, STENCIL_INDEX_WIDTH), _t) uindex_t
An unsigned integer of configurable width.
Definition Index.hpp:42