1 #ifndef DASH__VIEW__VIEW_ITERATOR_H__INCLUDED 2 #define DASH__VIEW__VIEW_ITERATOR_H__INCLUDED 4 #include <dash/GlobPtr.h> 5 #include <dash/iterator/internal/IteratorBase.h> 6 #include <dash/meta/TypeInfo.h> 22 :
public dash::internal::IndexIteratorBase<
23 ViewIterator<DomainIterator, IndexSetType>,
24 typename DomainIterator::value_type,
25 typename DomainIterator::difference_type,
26 typename DomainIterator::pointer,
27 typename DomainIterator::reference
30 typedef dash::internal::IndexIteratorBase<
32 typename DomainIterator::value_type,
33 typename DomainIterator::difference_type,
34 typename DomainIterator::pointer,
35 typename DomainIterator::reference > base_t;
37 template<
class DomainT,
class IndexSetT>
38 friend std::ostream & operator<<(
42 typedef typename base_t::reference reference;
43 typedef typename base_t::value_type value_type;
44 typedef typename IndexSetType::index_type index_type;
46 DomainIterator _domain_it;
47 IndexSetType _index_set;
51 template <
class DomainItType>
53 const DomainItType & domain_it,
54 const IndexSetType & index_set,
57 , _domain_it(domain_it)
58 , _index_set(index_set)
61 template <
class DomainItType>
63 DomainItType && domain_it,
64 const IndexSetType & index_set,
67 , _domain_it(std::forward<DomainItType>(domain_it))
68 , _index_set(index_set)
75 , _domain_it(other._domain_it)
76 , _index_set(other._index_set)
79 constexpr reference dereference(index_type idx)
const {
80 return *(_domain_it + (_index_set[idx]));
83 constexpr index_type gpos()
const {
84 return (_index_set)[this->pos()];
87 constexpr
const value_type * local()
const {
88 return (_domain_it + (_index_set[this->pos()])).local();
91 inline value_type * local() {
92 return (_domain_it + (_index_set[this->pos()])).local();
96 return (_domain_it + _index_set[this->pos()]).dart_gptr();
103 constexpr
explicit operator DomainIterator()
const {
104 return (_domain_it + _index_set[this->pos()]);
109 class DomainIterator,
112 :
public dash::internal::IndexIteratorBase<
120 typedef dash::internal::IndexIteratorBase<
121 ViewIterator<DomainIterator *, IndexSetType>,
125 DomainIterator & > base_t;
127 template<
class DomainT,
class IndexSetT>
128 friend std::ostream & operator<<(
132 typedef DomainIterator & reference;
133 typedef DomainIterator value_type;
134 typedef std::ptrdiff_t index_type;
136 DomainIterator * _domain_it;
137 IndexSetType _index_set;
141 template <
class DomainItType>
143 DomainItType * domain_it,
144 const IndexSetType & index_set,
147 , _domain_it(domain_it)
148 , _index_set(index_set)
152 const self_t & other,
155 , _domain_it(other._domain_it)
156 , _index_set(other._index_set)
159 constexpr reference dereference(index_type idx)
const {
160 return (_domain_it)[ (_index_set)[idx] ];
163 constexpr index_type gpos()
const {
164 return (_index_set)[this->pos()];
167 constexpr
const value_type *
local()
const {
168 return (_domain_it + (_index_set[this->pos()])).local();
171 inline value_type *
local() {
172 return (_domain_it + (_index_set[this->pos()])).local();
176 template<
class DomainT,
class IndexSetT>
177 std::ostream & operator<<(
181 std::ostringstream ss;
184 <<
"domain_it: " << view_it._domain_it <<
", " 185 <<
"rpos: " << view_it.pos() <<
", " 186 <<
"gpos: " << view_it.gpos()
188 return operator<<(os, ss.str());
193 #endif // DASH__VIEW__VIEW_ITERATOR_H__INCLUDED constexpr auto local(ViewType &v) -> typename std::enable_if<(std::is_pointer< typename ViewType::iterator >::value||(dash::view_traits< ViewValueT >::is_local::value)), ViewType &>::type
This class is a simple memory pool which holds allocates elements of size ValueType.
DART Global pointer type.
std::string typestr(const T &obj)
Returns string containing the type name of the given object.