14 #ifndef ECL_CONTAINERS_STENCIL_STENCIL_HPP_ 15 #define ECL_CONTAINERS_STENCIL_STENCIL_HPP_ 22 #include <ecl/config/macros.hpp> 23 #include <ecl/exceptions/standard_exception.hpp> 24 #include <ecl/concepts/containers.hpp> 25 #include <ecl/concepts/streams.hpp> 26 #include "../initialiser.hpp" 71 template <
typename Array>
89 typedef std::size_t size_type;
90 typedef std::ptrdiff_t difference_type;
91 typedef std::reverse_iterator<iterator> reverse_iterator;
92 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
93 typedef formatters::StencilFormatter<value_type,Array>
Formatter;
113 Stencil(Array& underlying_array, iterator begin_iter, iterator end_iter)
ecl_assert_throw_decl(StandardException) :
114 array(underlying_array),
138 Stencil(Array& underlying_array,
const unsigned int& start_index = 0,
const unsigned int &n = 0)
ecl_assert_throw_decl(StandardException) :
139 array(underlying_array),
140 b_iter(array.begin()+start_index),
141 e_iter(array.begin()+start_index+n)
163 Stencil<Array> stencil(
const unsigned int& start_index,
const unsigned int& n)
const ecl_assert_throw_decl(StandardException)
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)
ecl_assert_throw_decl(StandardException)
184 b_iter = array.begin()+start_index;
185 e_iter = array.begin()+start_index+n;
206 containers::BoundedListInitialiser<value_type,value_type*>
operator<< (
const value_type &value)
208 return containers::BoundedListInitialiser<value_type,iterator>(value, begin,
size());
242 if ( &array == &(s.array) )
250 for (
unsigned int i = 0; i < s.size(); ++i )
252 *(b_iter+i) = *(s.b_iter+i);
309 return reverse_iterator(end());
319 return const_reverse_iterator(end());
329 return reverse_iterator(begin());
339 return const_reverse_iterator(begin());
431 reference at(size_type i)
throw(StandardException)
433 if ( b_iter+i <= array.begin() )
437 if ( b_iter+i >= array.end() )
455 const_reference at(size_type i)
const throw(StandardException)
457 if ( b_iter+i <= array.begin() )
461 if ( b_iter+i >= array.end() )
476 size_type
size()
const 477 {
return e_iter-b_iter;}
497 template <
typename OutputStream,
typename ArrayType>
498 friend OutputStream& operator<<(OutputStream &ostream , const Stencil<ArrayType> &stencil);
502 iterator b_iter, e_iter;
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] <<
" ";
const Type * const_iterator
Defines validating functionality for the streams concept.
#define LOC
Stringify the line of code you are at.
OutputStream & operator<<(OutputStream &ostream, const Void void_object)
Output stream operator for Void objects.
#define ecl_assert_throw(expression, exception)
Debug mode throw with a logical condition check.
const Type & const_reference
ecl_geometry_PUBLIC int size(const Trajectory2D &trajectory)
#define ecl_assert_throw_decl(exception)
Assure throw exception declaration.
#define ecl_compile_time_concept_check(Model)
Compile time concept checking assertion.
MatrixFormatter< Derived, Scalar > Formatter