Loading...
Searching...
No Matches
vec_range.h
Go to the documentation of this file.
#ifndef _RHEO_VEC_RANGE_H
#define _RHEO_VEC_RANGE_H
// example :
// x[range(0,n)] = y;
// x = y[range(0,m)];
# include "rheolef/vec.h"
namespace rheolef {
template <class T, class M = rheo_default_memory_model>
class vec_range {
public:
// typedef:
typedef typename vec<T,M>::size_type size_type;
typedef typename vec<T,M>::difference_type difference_type;
typedef range range_type;
typedef T value_type;
typedef typename vec<T,M>::iterator iterator;
typedef typename vec<T,M>::const_iterator const_iterator;
// allocator/deallocator:
vec_range (const vec<T,M>& u, const range_type& r) : _u(u), _r(r) {}
vec_range (const vec_range_const<T,M>& ur) : _u(ur._u), _r(ur._r) {}
// accessors:
size_type size() const { return _r.size(); }
iterator begin() { return _u.begin() + _r.start(); }
iterator end() { return begin() + size(); }
const_iterator begin() const { return _u.begin() + _r.start(); }
const_iterator end() const { return begin() + size(); }
protected:
friend class vec<T,M>;
friend class vec_range_const<T,M>;
// data:
vec<T,M> _u;
range _r;
};
template <class T, class M = rheo_default_memory_model>
class vec_range_const {
public:
// typedef:
typedef typename vec<T,M>::size_type size_type;
typedef typename vec<T,M>::difference_type difference_type;
typedef range range_type;
typedef T value_type;
typedef typename vec<T,M>::const_iterator const_iterator;
// allocator/deallocator:
vec_range_const (const vec<T,M>& u, const range_type& r) : _u(u), _r(r) {}
vec_range_const (const vec_range_const<T,M>& ur) : _u(ur._u), _r(ur._r) {}
vec_range_const (const vec_range<T,M>& ur) : _u(ur._u), _r(ur._r) {}
// accessors:
size_type size() const { return _r.size(); }
const_iterator begin() const { return _u.begin() + _r.start(); }
const_iterator end() const { return begin() + size(); }
protected:
friend class vec<T,M>;
// data:
vec<T,M> _u;
range _r;
};
} // namespace rheolef
#endif // _RHEO_VEC_RANGE_H
rheolef::vec_range_const
Definition vec_range.h:65
rheolef::vec_range_const::difference_type
vec< T, M >::difference_type difference_type
Definition vec_range.h:71
rheolef::vec_range_const::_u
vec< T, M > _u
Definition vec_range.h:91
rheolef::vec_range_const::value_type
T value_type
Definition vec_range.h:73
rheolef::vec_range_const::begin
const_iterator begin() const
Definition vec_range.h:85
rheolef::vec_range_const::size_type
vec< T, M >::size_type size_type
Definition vec_range.h:70
rheolef::vec_range_const::size
size_type size() const
Definition vec_range.h:84
rheolef::vec_range_const::vec_range_const
vec_range_const(const vec_range_const< T, M > &ur)
Definition vec_range.h:79
rheolef::vec_range_const::range_type
range range_type
Definition vec_range.h:72
rheolef::vec_range_const::vec_range_const
vec_range_const(const vec< T, M > &u, const range_type &r)
Definition vec_range.h:78
rheolef::vec_range_const::const_iterator
vec< T, M >::const_iterator const_iterator
Definition vec_range.h:74
rheolef::vec_range_const::end
const_iterator end() const
Definition vec_range.h:86
rheolef::vec_range_const::_r
range _r
Definition vec_range.h:92
rheolef::vec_range_const::vec_range_const
vec_range_const(const vec_range< T, M > &ur)
Definition vec_range.h:80
rheolef::vec_range
Definition vec_range.h:32
rheolef::vec_range::difference_type
vec< T, M >::difference_type difference_type
Definition vec_range.h:38
rheolef::vec_range::_u
vec< T, M > _u
Definition vec_range.h:61
rheolef::vec_range::value_type
T value_type
Definition vec_range.h:40
rheolef::vec_range::begin
const_iterator begin() const
Definition vec_range.h:54
rheolef::vec_range::size_type
vec< T, M >::size_type size_type
Definition vec_range.h:37
rheolef::vec_range::size
size_type size() const
Definition vec_range.h:51
rheolef::vec_range::iterator
vec< T, M >::iterator iterator
Definition vec_range.h:41
rheolef::vec_range::range_type
range range_type
Definition vec_range.h:39
rheolef::vec_range::const_iterator
vec< T, M >::const_iterator const_iterator
Definition vec_range.h:42
rheolef::vec_range::end
iterator end()
Definition vec_range.h:53
rheolef::vec_range::end
const_iterator end() const
Definition vec_range.h:55
rheolef::vec_range::vec_range
vec_range(const vec< T, M > &u, const range_type &r)
Definition vec_range.h:46
rheolef::vec_range::begin
iterator begin()
Definition vec_range.h:52
rheolef::vec_range::_r
range _r
Definition vec_range.h:62
rheolef::vec_range::vec_range
vec_range(const vec_range_const< T, M > &ur)
Definition vec_range.h:47
rheolef::vec
see the vec page for the full documentation
Definition vec.h:79
rheolef::vec::iterator
base::iterator iterator
Definition vec.h:91
rheolef::vec::size_type
base::size_type size_type
Definition vec.h:86
rheolef::vec::const_iterator
base::const_iterator const_iterator
Definition vec.h:92
rheolef::vec::difference_type
std::ptrdiff_t difference_type
Definition vec.h:87
T
Expr1::float_type T
Definition field_expr.h:230
rheolef
This file is part of Rheolef.
Definition compiler_eigen.h:39
rheolef::range
see the range page for the full documentation
Definition range.h:61
rheolef::range::start
size_type start() const
Definition range.h:85
rheolef::range::size
size_type size() const
Definition range.h:86
u
Definition leveque.h:25
M
Expr1::memory_type M
Definition vec_expr_v2.h:416