![]() |
StencilStream v3.0.0
SYCL-based Stencil Simulation Framework Targeting FPGAs
|
A helper class to support the double-subscript idiom for GridAccessors. More...
#include <AccessorSubscript.hpp>
Public Member Functions | |
AccessorSubscript (Accessor &ac, uindex_t i) | |
Instantiate a new accessor subscript object with the given index as the prefix. | |
AccessorSubscript (Accessor &ac, sycl::id< dimensions > id_prefix, uindex_t i) | |
Instantiate a new subscript object with the given prefix and subscript index. | |
AccessorSubscript< Cell, Accessor, access_mode, current_subdim+1 > | operator[] (uindex_t i) |
Access the next dimension's accessor subscript. | |
Cell const & | operator[] (uindex_t i) |
Access the cell. | |
Cell & | operator[] (uindex_t i) |
Access the cell. | |
Static Public Attributes | |
static constexpr uindex_t | dimensions = Accessor::dimensions |
The number of dimensions in the accessed grid. | |
A helper class to support the double-subscript idiom for GridAccessors.
This class is used to support expressions like accessor[i_column][i_row]
. Each subscript except the last one creates an object of this class, which stores the index of the subscript as well as all previous indices to form a so-called "prefix." When the last subscript is called, the index is added to the prefix to yield the complete, multi-dimensional index. Then, the last subscript object returns a reference to the requested cell.
Cell | The cell type to support |
Accessor | accessor to direct to. It must fulfill stencil::concepts::GridAccessor, but since this class is also part of the concept's definition, we can't check it here. |
access_mode | The access mode of the accessor. Used to enable and disable different operator[] implementations |
current_subdim | The current subdim. Decides whether the next call to operator[] returns another AccessorSubscript or the final cell reference. |
|
inline |
Instantiate a new accessor subscript object with the given index as the prefix.
This accessor is meant to be used by the operator[]
implementation of the accessor to construct the first subscript object. It is therefore only available iff the current subdimention is zero.
ac | The accessor to redirect to. |
i | The index of the previous subscript. It will be used as a prefix. |
|
inline |
Instantiate a new subscript object with the given prefix and subscript index.
This constructor will take the given prefix, add the new index to it at the current position, and use the resulting prefix.
ac | The accessor to redirect to. |
id_prefix | The previous prefix |
i | The new index to add to the prefix. |
|
inline |
Access the next dimension's accessor subscript.
The resulting subscript object will contain the current prefix together with the given index. This implementation is only available to intermediate dimensions. For the last dimension, the resulting ID will be evaluated and returned.
i | The next dimension's index. |
|
inline |
Access the cell.
This will add the given index to the prefix and use the underlying accessor to provide a reference to the cell. This is the implementation for read-only accessors as it returns a constant reference.
i | The final dimension's index. |
|
inline |
Access the cell.
This will add the given index to the prefix and use the underlying accessor to provide a reference to the cell. This is the implementation for accessors that may alter the grid.
i | The final dimension's index. |
|
staticconstexpr |
The number of dimensions in the accessed grid.