GrPPI  0.2
Generic and Reusable Parallel Pattern Interface
Stencil pattern

The stencil pattern applies a transformation to every element in one or multiple data sets, generating a new data set as an output. The transformation also takes as an input a neighborhood of the transformed data item.

The interface to the stencil pattern is provided by function grppi::stencil(). As all functions in GrPPI, this function takes as its first argument an execution policy.

grppi::stencil(exec, other_arguments...);

Stencil variants

There are several variants:

Key elements in stencil

The key elements in a stencil are: a StencilTransformer operation and a Neighbourhood operation.

A Neighbourhood operation is any C++ callable entity that takes one or more iterators to data items and generates a neighbourhood. Depending on the number of iterators taking it may be a UnaryNeighbourhood or a MultiNeighbourhood.

Consequently, a UnaryNeighbourhood is any operation op that given an iterator value it and an output neighbourhood type N makes valid the following:

N n = op(it);

A MultiNeighbourhood is any operation op that given n iterator values it1, it2, ... , itN and an output neighbourhood type N makes valid the following:

N n = op(it1, it2, ..., itN);

The StencilTransformer is any C++ callable entity that takes one iterator to a data item and the result of a Neighbourhood operation and performs a transformation.

Thus, a StencilTransfomer is any operation op that, given an iterator value itand the result of a Neighbourhood operation n, makes valid the following:

R r = op(it, n);

Details on stencil variants

Unary stencil

An unary stencil takes a data set and transforms each element in the data set by applying a transformation to each data item using the data item and its neighbourhood.

The only interface currently offered for this pattern is based in iterators (following the C++ standard library conventions):

N-ary stencil

An n-ary stencil takes multiple data sets and transforms each element in the data set by applying a transformation to each data item form the first data set and the neighbourhood obtained from all data sets.

The only interface currently offered for this pattern is based in iterators: