mirror of
https://github.com/triqs/dft_tools
synced 2024-12-25 05:43:40 +01:00
gf: mesh. const_iterator and add cbegin
- for meshes : clean concept w/ doc, add cbegin, and changed iterator to const_iterator (more standard name).
This commit is contained in:
parent
7898bd8d88
commit
165b44a081
@ -142,7 +142,7 @@ namespace triqs { namespace gfs {
|
|||||||
public boost::iterator_facade< block_gf_iterator<Target,Opt>, typename Target::view_type , boost::forward_traversal_tag, typename Target::view_type > {
|
public boost::iterator_facade< block_gf_iterator<Target,Opt>, typename Target::view_type , boost::forward_traversal_tag, typename Target::view_type > {
|
||||||
friend class boost::iterator_core_access;
|
friend class boost::iterator_core_access;
|
||||||
typedef gf_view<block_index,Target,Opt> big_gf_t;
|
typedef gf_view<block_index,Target,Opt> big_gf_t;
|
||||||
typedef typename big_gf_t::mesh_t::iterator mesh_iterator_t;
|
typedef typename big_gf_t::mesh_t::const_iterator mesh_iterator_t;
|
||||||
big_gf_t big_gf;
|
big_gf_t big_gf;
|
||||||
mesh_iterator_t mesh_it;
|
mesh_iterator_t mesh_it;
|
||||||
|
|
||||||
|
@ -35,8 +35,8 @@ namespace triqs { namespace gfs {
|
|||||||
|
|
||||||
// GENERALISE matrxi TO DEFAULT
|
// GENERALISE matrxi TO DEFAULT
|
||||||
template<typename Variable, typename Opt=void> struct mesh;
|
template<typename Variable, typename Opt=void> struct mesh;
|
||||||
template<typename Variable, typename Target=matrix_valued, typename Opt=void> class gf; // the value class
|
template<typename Variable, typename Target=matrix_valued, typename Opt=void> class gf; // the regular type
|
||||||
template<typename Variable, typename Target=matrix_valued, typename Opt=void> class gf_view; // the view class
|
template<typename Variable, typename Target=matrix_valued, typename Opt=void> class gf_view; // the view type
|
||||||
|
|
||||||
// various implementation traits
|
// various implementation traits
|
||||||
namespace gfs_implementation { // never use using of this...
|
namespace gfs_implementation { // never use using of this...
|
||||||
|
@ -61,9 +61,11 @@ namespace triqs { namespace gfs {
|
|||||||
mesh_point_t operator[](index_t i) const { return mesh_point_t (*this,i);}
|
mesh_point_t operator[](index_t i) const { return mesh_point_t (*this,i);}
|
||||||
|
|
||||||
/// Iterating on all the points...
|
/// Iterating on all the points...
|
||||||
typedef mesh_pt_generator<discrete_mesh> iterator;
|
typedef mesh_pt_generator<discrete_mesh> const_iterator;
|
||||||
iterator begin() const { return iterator (this);}
|
const_iterator begin() const { return const_iterator (this);}
|
||||||
iterator end() const { return iterator (this, true);}
|
const_iterator end() const { return const_iterator (this, true);}
|
||||||
|
const_iterator cbegin() const { return const_iterator (this);}
|
||||||
|
const_iterator cend() const { return const_iterator (this, true);}
|
||||||
|
|
||||||
/// Mesh comparison
|
/// Mesh comparison
|
||||||
bool operator == (discrete_mesh const & M) const { return (_dom == M._dom) ;}
|
bool operator == (discrete_mesh const & M) const { return (_dom == M._dom) ;}
|
||||||
|
@ -37,6 +37,8 @@ namespace triqs { namespace gfs {
|
|||||||
typedef size_t index_t;
|
typedef size_t index_t;
|
||||||
typedef typename domain_t::point_t domain_pt_t;
|
typedef typename domain_t::point_t domain_pt_t;
|
||||||
|
|
||||||
|
linear_mesh () : _dom(), L(0), a_pt(0), b_pt(0), xmin(0), xmax(0), del(0), meshk(half_bins) {}
|
||||||
|
|
||||||
linear_mesh (domain_t const & dom, double a, double b, size_t n_pts, mesh_kind mk) :
|
linear_mesh (domain_t const & dom, double a, double b, size_t n_pts, mesh_kind mk) :
|
||||||
_dom(dom), L(n_pts), a_pt(a), b_pt(b), meshk(mk) {
|
_dom(dom), L(n_pts), a_pt(a), b_pt(b), meshk(mk) {
|
||||||
switch(mk) {
|
switch(mk) {
|
||||||
@ -57,8 +59,6 @@ namespace triqs { namespace gfs {
|
|||||||
xmax = xmin + del*(L-1);
|
xmax = xmin + del*(L-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
linear_mesh () : _dom(), L(0), a_pt(0), b_pt(0), xmin(0), xmax(0), del(0), meshk(half_bins) {}
|
|
||||||
|
|
||||||
domain_t const & domain() const { return _dom;}
|
domain_t const & domain() const { return _dom;}
|
||||||
size_t size() const { return L; }
|
size_t size() const { return L; }
|
||||||
double delta() const { return del; }
|
double delta() const { return del; }
|
||||||
@ -110,9 +110,11 @@ namespace triqs { namespace gfs {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
/// Iterating on all the points...
|
/// Iterating on all the points...
|
||||||
typedef mesh_pt_generator<linear_mesh> iterator;
|
typedef mesh_pt_generator<linear_mesh> const_iterator;
|
||||||
iterator begin() const { return iterator (this);}
|
const_iterator begin() const { return const_iterator (this);}
|
||||||
iterator end() const { return iterator (this, true);}
|
const_iterator end() const { return const_iterator (this, true);}
|
||||||
|
const_iterator cbegin() const { return const_iterator (this);}
|
||||||
|
const_iterator cend() const { return const_iterator (this, true);}
|
||||||
|
|
||||||
/// Mesh comparison
|
/// Mesh comparison
|
||||||
bool operator == (linear_mesh const & M) const { return ((_dom == M._dom) && (size() ==M.size()) && (std::abs(xmin - M.xmin)<1.e-15) && (std::abs(xmax - M.xmax)<1.e-15));}
|
bool operator == (linear_mesh const & M) const { return ((_dom == M._dom) && (size() ==M.size()) && (std::abs(xmin - M.xmin)<1.e-15) && (std::abs(xmax - M.xmax)<1.e-15));}
|
||||||
|
@ -107,9 +107,11 @@ namespace triqs { namespace gfs {
|
|||||||
mesh_point_t operator()(typename Meshes::index_t ... i) const { return (*this)[std::make_tuple(i...)];}
|
mesh_point_t operator()(typename Meshes::index_t ... i) const { return (*this)[std::make_tuple(i...)];}
|
||||||
|
|
||||||
/// Iterating on all the points...
|
/// Iterating on all the points...
|
||||||
typedef mesh_pt_generator<mesh_product> iterator;
|
typedef mesh_pt_generator<mesh_product> const_iterator;
|
||||||
iterator begin() const { return iterator (this);}
|
const_iterator begin() const { return const_iterator (this);}
|
||||||
iterator end() const { return iterator (this, true);}
|
const_iterator end() const { return const_iterator (this, true);}
|
||||||
|
const_iterator cbegin() const { return const_iterator (this);}
|
||||||
|
const_iterator cend() const { return const_iterator (this, true);}
|
||||||
|
|
||||||
/// Mesh comparison
|
/// Mesh comparison
|
||||||
friend bool operator == (mesh_product const & M1, mesh_product const & M2) { return M1.m_tuple==M2.m_tuple; }
|
friend bool operator == (mesh_product const & M1, mesh_product const & M2) { return M1.m_tuple==M2.m_tuple; }
|
||||||
|
Loading…
Reference in New Issue
Block a user