3
0
mirror of https://github.com/triqs/dft_tools synced 2025-01-12 05:58:18 +01:00

gf : fix bug in mesh_pt_generator

- in the default constructor, do not call the pointer
that may be null.
- appeared only in python (unused in c++), for new matsubara...
This commit is contained in:
Olivier Parcollet 2013-11-18 22:48:52 +01:00
parent 0b7bfec32e
commit 184274c893
4 changed files with 5 additions and 1 deletions

View File

@ -46,6 +46,7 @@ namespace triqs { namespace gfs {
discrete_mesh const * m;
index_t _index;
public:
mesh_point_t() = default;
mesh_point_t( discrete_mesh const & mesh, index_t const & index_): m(&mesh), _index(index_) {}
void advance() { ++_index;}
typedef size_t cast_t;

View File

@ -87,6 +87,7 @@ namespace gfs {
index_t _index;
public:
mesh_point_t() : m(nullptr) {}
mesh_point_t(linear_mesh const &mesh, index_t const &index_) : m(&mesh), _index(index_) {}
void advance() { ++_index; }
typedef domain_pt_t cast_t;

View File

@ -63,7 +63,8 @@ namespace gfs {
// do NOT check = of mesh, otherwise e.g. block iterator does not work (infinite loop...)
//bool equal(mesh_pt_generator const & other) const { return ((mesh == other.mesh) && (other.u==u) );}
public:
mesh_pt_generator( MeshType const * m=NULL, bool atEnd = false): mesh(m), u(atEnd ? m->size(): 0), pt((*m)[typename MeshType::index_t()]) {}
mesh_pt_generator(): mesh(nullptr), u(0) {}
mesh_pt_generator( MeshType const * m, bool atEnd = false): mesh(m), u(atEnd ? m->size(): 0), pt((*m)[typename MeshType::index_t()]) {}
void increment() { ++u; pt.advance(); }
bool at_end() const { return (u>=mesh->size());}
typename MeshType::domain_t::point_t to_point() const { return pt;}

View File

@ -83,6 +83,7 @@ namespace triqs { namespace gfs {
struct F2 { template<typename M> typename M::mesh_point_t operator()(M const & m, typename M::index_t const & i) const { return m[i];}};
struct F1 { template<typename M> typename M::mesh_point_t operator()(M const & m) const { return m[typename M::index_t()];}};
public :
mesh_point_t() = default;
mesh_point_t(mesh_product const & m_, index_t index_ ) : m(&m_), _c (triqs::tuple::apply_on_zip(F2(), m_.m_tuple, index_)), _atend(false) {}
mesh_point_t(mesh_product const & m_) : m(&m_), _c (triqs::tuple::apply(F1(), m_.m_tuple)), _atend(false) {}
m_pt_tuple_t const & components_tuple() const { return _c;}