GrPPI  0.2
Generic and Reusable Parallel Pattern Interface
seq/stencil.h
Go to the documentation of this file.
1 
21 #ifndef GRPPI_SEQ_STENCIL_H
22 #define GRPPI_SEQ_STENCIL_H
23 
24 #include "sequential_execution.h"
25 
26 #include "../common/iterator.h"
27 
28 namespace grppi {
29 
52 template <typename InputIt, typename OutputIt, typename StencilTransformer,
53  typename Neighbourhood>
55  InputIt first, InputIt last, OutputIt out,
56  StencilTransformer transform_op,
57  Neighbourhood neighbour_op)
58 {
59  while (first!=last) {
60  *out = transform_op(first, neighbour_op(first));
61  first++;
62  out++;
63  }
64 }
65 
82 template <typename InputIt, typename OutputIt, typename StencilTransformer,
83  typename Neighbourhood, typename ... OtherInputIts>
85  InputIt first, InputIt last, OutputIt out,
86  StencilTransformer transform_op,
87  Neighbourhood neighbour_op, OtherInputIts ... other_firsts)
88 {
89  while (first!=last) {
90  *out = transform_op(first, neighbour_op(first, other_firsts ...));
91  advance_iterators(other_firsts...);
92  first++;
93  out++;
94  }
95 }
96 
102 }
103 
104 #endif
Definition: callable_traits.h:24
void stencil(parallel_execution_native &ex, InputIt first, InputIt last, OutputIt first_out, StencilTransformer transform_op, Neighbourhood neighbour_op)
Invoke Stencil pattern on a data sequence with native parallel execution.
Definition: native/stencil.h:53
void advance_iterators(size_t delta, InputIt &...in)
Definition: iterator.h:29
Sequential execution policy.
Definition: sequential_execution.h:31