StencilStream v3.0.0
SYCL-based Stencil Simulation Framework Targeting FPGAs
All Classes Namespaces Files Functions Variables Typedefs Macros Pages Concepts
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
stencil::Stencil< Cell, stencil_radius, TimeDependentValue > Class Template Reference

The stencil buffer. More...

#include <Stencil.hpp>

Collaboration diagram for stencil::Stencil< Cell, stencil_radius, TimeDependentValue >:
Collaboration graph
[legend]

Public Types

using index_stencil_t = ac_int< bits_stencil, true >
 A signed index type for column and row indices in this stencil.
 
using uindex_stencil_t = ac_int< bits_stencil, false >
 An unsigned index type for column and row indices in this stencil.
 
using StencilID = GenericID< index_stencil_t >
 A signed, two-dimensional index to address cells in this stencil.
 
using StencilUID = GenericID< uindex_stencil_t >
 An unsigned, two-dimensional index to address cells in this stencil.
 

Public Member Functions

 Stencil (ID id, UID grid_range, uindex_t iteration, uindex_t subiteration, TimeDependentValue tdv)
 Create a new stencil with an uninitialized buffer.
 
 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.
 
Cell constoperator[] (ID id) const
 Access a cell in the stencil.
 
Cell & operator[] (ID id)
 Access a cell in the stencil.
 
Cell constoperator[] (StencilID id) const
 Access a cell in the stencil.
 
Cell & operator[] (StencilID id)
 Access a cell in the stencil.
 
Cell constoperator[] (UID id) const
 Access a cell in the stencil.
 
Cell & operator[] (UID id)
 Access a cell in the stencil.
 
Cell constoperator[] (StencilUID id) const
 Access a cell in the stencil.
 
Cell & operator[] (StencilUID id)
 Access a cell in the stencil.
 

Public Attributes

const ID id
 The position of the central cell in the global grid.
 
const uindex_t iteration
 The present iteration index of the cells in the stencil.
 
const uindex_t subiteration
 The present sub-iteration index of the cells in the stencil.
 
const UID grid_range
 The range of the underlying grid.
 
const TimeDependentValue time_dependent_value
 The time-dependent value for this iteration.
 

Static Public Attributes

static constexpr uindex_t diameter = 2 * stencil_radius + 1
 The diameter (aka width and height) of the stencil buffer.
 
static constexpr unsigned long bits_stencil = std::bit_width(diameter)
 The number of bits necessary to express column and row indices in the stencil.
 

Detailed Description

template<typename Cell, uindex_t stencil_radius, typename TimeDependentValue = std::monostate>
requires std::semiregular<Cell> && (stencil_radius >= 1)
class stencil::Stencil< Cell, stencil_radius, TimeDependentValue >

The stencil buffer.

The stencil buffer contains the extended Moore neighborhood of a central cell and is used by a transition function to calculate the next iteration of the central cell.

This implementation provides two ways to index the stencil: With an ID and a UID. Since ID is signed, the column and row axes are within the range of [-radius : radius]. Therefore, (0,0) points to the central cell. UID is unsigned and the column and row axes are within the range of [0 : 2*radius + 1). Therefore, (0,0) points to the north-western corner of the stencil.

Template Parameters
CellThe type of cells in the stencil
stencil_radiusThe radius of the stencil, i.e. the extent of the stencil in each direction from the central cell.
TimeDependentValueThe type of values provided by the TDV system.

Member Typedef Documentation

◆ index_stencil_t

template<typename Cell , uindex_t stencil_radius, typename TimeDependentValue = std::monostate>
using stencil::Stencil< Cell, stencil_radius, TimeDependentValue >::index_stencil_t = ac_int<bits_stencil, true>

A signed index type for column and row indices in this stencil.

◆ StencilID

template<typename Cell , uindex_t stencil_radius, typename TimeDependentValue = std::monostate>
using stencil::Stencil< Cell, stencil_radius, TimeDependentValue >::StencilID = GenericID<index_stencil_t>

A signed, two-dimensional index to address cells in this stencil.

◆ StencilUID

template<typename Cell , uindex_t stencil_radius, typename TimeDependentValue = std::monostate>
using stencil::Stencil< Cell, stencil_radius, TimeDependentValue >::StencilUID = GenericID<uindex_stencil_t>

An unsigned, two-dimensional index to address cells in this stencil.

◆ uindex_stencil_t

template<typename Cell , uindex_t stencil_radius, typename TimeDependentValue = std::monostate>
using stencil::Stencil< Cell, stencil_radius, TimeDependentValue >::uindex_stencil_t = ac_int<bits_stencil, false>

An unsigned index type for column and row indices in this stencil.

Constructor & Destructor Documentation

◆ Stencil() [1/2]

template<typename Cell , uindex_t stencil_radius, typename TimeDependentValue = std::monostate>
stencil::Stencil< Cell, stencil_radius, TimeDependentValue >::Stencil ( ID  id,
UID  grid_range,
uindex_t  iteration,
uindex_t  subiteration,
TimeDependentValue  tdv 
)
inline

Create a new stencil with an uninitialized buffer.

Parameters
idThe position of the central cell in the global grid.
grid_rangeThe range of the underlying grid.
iterationThe present iteration index of the cells in the stencil.
subiterationThe present sub-iteration index of the cells in the stencil.
tdvThe time-dependent value for this iteration.

◆ Stencil() [2/2]

template<typename Cell , uindex_t stencil_radius, typename TimeDependentValue = std::monostate>
stencil::Stencil< Cell, stencil_radius, TimeDependentValue >::Stencil ( ID  id,
UID  grid_range,
uindex_t  iteration,
uindex_t  subiteration,
TimeDependentValue  tdv,
Cell  raw[diameter][diameter] 
)
inline

Create a new stencil with the given contents.

Parameters
idThe position of the central cell in the global grid.
grid_rangeThe range of the underlying grid.
iterationThe present iteration index of the cells in the stencil.
subiterationThe present sub-iteration index of the cells in the stencil.
tdvThe time-dependent value for this iteration.
rawAn array of cells, which is copied into the stencil object.

Member Function Documentation

◆ operator[]() [1/8]

template<typename Cell , uindex_t stencil_radius, typename TimeDependentValue = std::monostate>
Cell & stencil::Stencil< Cell, stencil_radius, TimeDependentValue >::operator[] ( ID  id)
inline

Access a cell in the stencil.

Since the indices in id are signed, the origin of this index operator is the central cell.

◆ operator[]() [2/8]

template<typename Cell , uindex_t stencil_radius, typename TimeDependentValue = std::monostate>
Cell const & stencil::Stencil< Cell, stencil_radius, TimeDependentValue >::operator[] ( ID  id) const
inline

Access a cell in the stencil.

Since the indices in id are signed, the origin of this index operator is the central cell.

◆ operator[]() [3/8]

template<typename Cell , uindex_t stencil_radius, typename TimeDependentValue = std::monostate>
Cell & stencil::Stencil< Cell, stencil_radius, TimeDependentValue >::operator[] ( StencilID  id)
inline

Access a cell in the stencil.

Since the indices in id are signed, the origin of this index operator is the central cell.

◆ operator[]() [4/8]

template<typename Cell , uindex_t stencil_radius, typename TimeDependentValue = std::monostate>
Cell const & stencil::Stencil< Cell, stencil_radius, TimeDependentValue >::operator[] ( StencilID  id) const
inline

Access a cell in the stencil.

Since the indices in id are signed, the origin of this index operator is the central cell.

◆ operator[]() [5/8]

template<typename Cell , uindex_t stencil_radius, typename TimeDependentValue = std::monostate>
Cell & stencil::Stencil< Cell, stencil_radius, TimeDependentValue >::operator[] ( StencilUID  id)
inline

Access a cell in the stencil.

Since the indices in id are unsigned, the origin of this index operator is the north-western corner.

◆ operator[]() [6/8]

template<typename Cell , uindex_t stencil_radius, typename TimeDependentValue = std::monostate>
Cell const & stencil::Stencil< Cell, stencil_radius, TimeDependentValue >::operator[] ( StencilUID  id) const
inline

Access a cell in the stencil.

Since the indices in id are unsigned, the origin of this index operator is the north-western corner.

◆ operator[]() [7/8]

template<typename Cell , uindex_t stencil_radius, typename TimeDependentValue = std::monostate>
Cell & stencil::Stencil< Cell, stencil_radius, TimeDependentValue >::operator[] ( UID  id)
inline

Access a cell in the stencil.

Since the indices in id are unsigned, the origin of this index operator is the north-western corner.

◆ operator[]() [8/8]

template<typename Cell , uindex_t stencil_radius, typename TimeDependentValue = std::monostate>
Cell const & stencil::Stencil< Cell, stencil_radius, TimeDependentValue >::operator[] ( UID  id) const
inline

Access a cell in the stencil.

Since the indices in id are unsigned, the origin of this index operator is the north-western corner.

Member Data Documentation

◆ bits_stencil

template<typename Cell , uindex_t stencil_radius, typename TimeDependentValue = std::monostate>
constexpr unsigned long stencil::Stencil< Cell, stencil_radius, TimeDependentValue >::bits_stencil = std::bit_width(diameter)
staticconstexpr

The number of bits necessary to express column and row indices in the stencil.

◆ diameter

template<typename Cell , uindex_t stencil_radius, typename TimeDependentValue = std::monostate>
constexpr uindex_t stencil::Stencil< Cell, stencil_radius, TimeDependentValue >::diameter = 2 * stencil_radius + 1
staticconstexpr

The diameter (aka width and height) of the stencil buffer.

◆ grid_range

template<typename Cell , uindex_t stencil_radius, typename TimeDependentValue = std::monostate>
const UID stencil::Stencil< Cell, stencil_radius, TimeDependentValue >::grid_range

The range of the underlying grid.

◆ id

template<typename Cell , uindex_t stencil_radius, typename TimeDependentValue = std::monostate>
const ID stencil::Stencil< Cell, stencil_radius, TimeDependentValue >::id

The position of the central cell in the global grid.

◆ iteration

template<typename Cell , uindex_t stencil_radius, typename TimeDependentValue = std::monostate>
const uindex_t stencil::Stencil< Cell, stencil_radius, TimeDependentValue >::iteration

The present iteration index of the cells in the stencil.

◆ subiteration

template<typename Cell , uindex_t stencil_radius, typename TimeDependentValue = std::monostate>
const uindex_t stencil::Stencil< Cell, stencil_radius, TimeDependentValue >::subiteration

The present sub-iteration index of the cells in the stencil.

◆ time_dependent_value

template<typename Cell , uindex_t stencil_radius, typename TimeDependentValue = std::monostate>
const TimeDependentValue stencil::Stencil< Cell, stencil_radius, TimeDependentValue >::time_dependent_value

The time-dependent value for this iteration.


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