mirror of
https://github.com/triqs/dft_tools
synced 2024-12-23 21:03:45 +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 > {
|
||||
friend class boost::iterator_core_access;
|
||||
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;
|
||||
mesh_iterator_t mesh_it;
|
||||
|
||||
|
@ -35,8 +35,8 @@ namespace triqs { namespace gfs {
|
||||
|
||||
// GENERALISE matrxi TO DEFAULT
|
||||
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_view; // the view 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 type
|
||||
|
||||
// various implementation traits
|
||||
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);}
|
||||
|
||||
/// Iterating on all the points...
|
||||
typedef mesh_pt_generator<discrete_mesh> iterator;
|
||||
iterator begin() const { return iterator (this);}
|
||||
iterator end() const { return iterator (this, true);}
|
||||
typedef mesh_pt_generator<discrete_mesh> const_iterator;
|
||||
const_iterator begin() const { return const_iterator (this);}
|
||||
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
|
||||
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 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) :
|
||||
_dom(dom), L(n_pts), a_pt(a), b_pt(b), meshk(mk) {
|
||||
switch(mk) {
|
||||
@ -57,8 +59,6 @@ namespace triqs { namespace gfs {
|
||||
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;}
|
||||
size_t size() const { return L; }
|
||||
double delta() const { return del; }
|
||||
@ -110,9 +110,11 @@ namespace triqs { namespace gfs {
|
||||
public:
|
||||
|
||||
/// Iterating on all the points...
|
||||
typedef mesh_pt_generator<linear_mesh> iterator;
|
||||
iterator begin() const { return iterator (this);}
|
||||
iterator end() const { return iterator (this, true);}
|
||||
typedef mesh_pt_generator<linear_mesh> const_iterator;
|
||||
const_iterator begin() const { return const_iterator (this);}
|
||||
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
|
||||
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...)];}
|
||||
|
||||
/// Iterating on all the points...
|
||||
typedef mesh_pt_generator<mesh_product> iterator;
|
||||
iterator begin() const { return iterator (this);}
|
||||
iterator end() const { return iterator (this, true);}
|
||||
typedef mesh_pt_generator<mesh_product> const_iterator;
|
||||
const_iterator begin() const { return const_iterator (this);}
|
||||
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
|
||||
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