5#ifndef DUNE_ISTL_BASEARRAY_HH
6#define DUNE_ISTL_BASEARRAY_HH
47 template<
class B,
class ST=std::
size_t >
48 class base_array_unmanaged
55 typedef B member_type;
64 using const_reference =
const B&;
69 reference operator[] (size_type i)
71#ifdef DUNE_ISTL_WITH_CHECKING
72 if (i>=n)
DUNE_THROW(ISTLError,
"index out of range");
78 const_reference operator[] (size_type i)
const
80#ifdef DUNE_ISTL_WITH_CHECKING
81 if (i>=n)
DUNE_THROW(ISTLError,
"index out of range");
89 :
public RandomAccessIteratorFacade<RealIterator<T>, T>
95 friend class RandomAccessIteratorFacade<RealIterator<const ValueType>, const ValueType>;
96 friend class RandomAccessIteratorFacade<RealIterator<ValueType>, ValueType>;
97 friend class RealIterator<const ValueType>;
98 friend class RealIterator<ValueType>;
101 RealIterator () =
default;
103 RealIterator (
const B* _p, B* _i)
109 RealIterator (
const RealIterator<T_>& other)
110 : p(other.p), i(other.i)
115 RealIterator&
operator= (
const RealIterator<T_>& other)
123 size_type
index ()
const
129 bool equals (
const RealIterator<ValueType>& other)
const
136 bool equals (
const RealIterator<const ValueType>& other)
const
177 const B* p =
nullptr;
218 typedef RealIterator<const B> const_iterator;
221 const_iterator
begin ()
const
223 return const_iterator(p,p+0);
227 const_iterator
end ()
const
229 return const_iterator(p,p+n);
236 return const_iterator(p,p+n-1);
243 return const_iterator(p,p-1);
247 const_iterator
find (size_type i)
const
249 return const_iterator(p,p+
std::min(i,n));
256 size_type
size ()
const
262 const B*
data()
const
275 base_array_unmanaged ()
279 base_array_unmanaged (size_type n_, B* p_)
309 template<
class B,
class ST=std::
size_t >
310 class compressed_base_array_unmanaged
317 typedef B member_type;
320 typedef ST size_type;
323 using reference = B&;
326 using const_reference =
const B&;
331 reference operator[] (size_type i)
334 if (lb == j+n || *lb != i)
335 DUNE_THROW(ISTLError,
"index "<<i<<
" not in compressed array");
340 const_reference operator[] (size_type i)
const
343 if (lb == j+n || *lb != i)
344 DUNE_THROW(ISTLError,
"index "<<i<<
" not in compressed array");
351 :
public BidirectionalIteratorFacade<RealIterator<T>, T>
357 friend class BidirectionalIteratorFacade<RealIterator<const ValueType>, const ValueType>;
358 friend class BidirectionalIteratorFacade<RealIterator<ValueType>, ValueType>;
359 friend class RealIterator<const ValueType>;
360 friend class RealIterator<ValueType>;
363 RealIterator () =
default;
366 RealIterator (B* _p, size_type* _j, size_type _i)
367 : p(_p), j(_j), i(_i)
372 RealIterator (
const RealIterator<T_>& other)
373 : p(other.p), j(other.j), i(other.i)
378 RealIterator&
operator= (
const RealIterator<T_>& other)
388 bool equals (
const RealIterator<ValueType>& it)
const
395 bool equals (
const RealIterator<const ValueType>& it)
const
403 size_type
index ()
const
409 void setindex (size_type k)
421 size_type offset ()
const
446 size_type* j =
nullptr;
483 return (lb != j+n && *lb == i)
489 typedef RealIterator<const B> const_iterator;
492 const_iterator
begin ()
const
494 return const_iterator(p,j,0);
498 const_iterator
end ()
const
500 return const_iterator(p,j,n);
507 return const_iterator(p,j,n-1);
514 return const_iterator(p,j,-1);
518 const_iterator
find (size_type i)
const
521 return (lb != j+n && *lb == i)
522 ? const_iterator(p,j,lb-j)
529 size_type
size ()
const
536 compressed_base_array_unmanaged ()
SLList< T, A > & operator=(const SLList< T, A > &other)
bool equals(const SLListConstIterator< T, A > &other) const
reference elementAt(size_type i) const
void advance(difference_type n)
difference_type distanceTo(const ArrayListIterator< T, N, A > &other) const
std::ptrdiff_t index() const
#define DUNE_THROW(E,...)
iterator(ParallelIndexSet< TG, TL, N > &indexSet, const Father &father)
const_iterator find(int proc) const