14 #ifndef ECL_CONTAINERS_STENCIL_STENCIL_HPP_ 15 #define ECL_CONTAINERS_STENCIL_STENCIL_HPP_ 26 #include "../initialiser.hpp" 71 template <
typename Array>
113 Stencil(
Array& underlying_array, iterator begin_iter, iterator end_iter) :
114 array(underlying_array),
138 Stencil(
Array& underlying_array,
const unsigned int& start_index = 0,
const unsigned int &n = 0) :
139 array(underlying_array),
140 b_iter(array.begin()+start_index),
141 e_iter(array.begin()+start_index+n)
167 return Stencil<Array>(array,b_iter+start_index,b_iter+start_index+n);
181 void resettle(
const unsigned int& start_index,
const unsigned int& n)
184 b_iter = array.begin()+start_index;
185 e_iter = array.begin()+start_index+n;
242 if ( &array == &(s.
array) )
250 for (
unsigned int i = 0; i < s.
size(); ++i )
252 *(b_iter+i) = *(s.
b_iter+i);
296 const_iterator
end()
const 309 return reverse_iterator(end());
319 return const_reverse_iterator(end());
329 return reverse_iterator(begin());
336 const_reverse_iterator
rend()
const 339 return const_reverse_iterator(begin());
431 reference
at(size_type i)
433 if ( b_iter+i <= array.begin() )
437 if ( b_iter+i >= array.end() )
455 const_reference
at(size_type i)
const 457 if ( b_iter+i <= array.begin() )
461 if ( b_iter+i >= array.end() )
477 {
return e_iter-b_iter;}
497 template <
typename OutputStream,
typename ArrayType>
498 friend OutputStream& operator<<(OutputStream &ostream , const Stencil<ArrayType> &stencil);
509 template<
typename OutputStream,
typename ArrayType>
510 OutputStream& operator<<(OutputStream &ostream, const Stencil<ArrayType> &stencil)
516 for (std::size_t i = 0; i < stencil.size(); ++i)
518 ostream << stencil[i] <<
" ";
Fixed size container with a few bells and whistles.
const Type * const_iterator
Embedded control libraries.
const_reference at(size_type i) const
OutputStream & operator<<(OutputStream &ostream, Format< std::string > &formatter)
Stencil(Array &underlying_array, iterator begin_iter, iterator end_iter)
Initialises with a reference to the underlying container and boundary constraints.
const_reference front() const
Stencil(Array &underlying_array, const unsigned int &start_index=0, const unsigned int &n=0)
Initialises with a reference to the underlying container and boundary constraints.
std::reverse_iterator< iterator > reverse_iterator
Uses the array's reverse iterator type.
formatters::StencilFormatter< value_type, Array > Formatter
Array::iterator iterator
Uses the array's iterator type.
std::reverse_iterator< const_iterator > const_reverse_iterator
Uses the array's constant reverse iterator type.
const_reference operator[](size_type i) const
Array::reference reference
Uses the array's element reference type.
void resettle(const unsigned int &start_index, const unsigned int &n)
Resettle the stencil on a different range over the same underlying array.
#define ecl_assert_throw(expression, exception)
std::size_t size_type
Uses the array's type used to denote the length of the array.
Stencil< Array > & operator=(const Stencil< Array > &s)
This either resettles this stencil or copies across to it (depending on the rhs stencil).
reverse_iterator rbegin()
Stencil< Array > stencil(const unsigned int &start_index, const unsigned int &n) const
Generate a sub-stencil.
const_reverse_iterator rend() const
const Type & const_reference
reference operator[](size_type i)
std::ptrdiff_t difference_type
Array::const_reference const_reference
Uses the array's element const reference type.
const_iterator begin() const
Convenience initialiser with bounds checking for fixed size containers.
A safe windowing class that opens onto array-like containers.
#define ecl_compile_time_concept_check(Model)
Array::value_type value_type
Uses the array's element type.
const_reverse_iterator rbegin() const
reference at(size_type i)
const_reference back() const
Array::const_iterator const_iterator
Uses the array's constant iterator type.
const_iterator end() const