3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-25 13:53:40 +01:00

gf: fix upper bound in out of bounds check in linear mesh

This commit is contained in:
Olivier Parcollet 2013-07-29 11:51:52 +02:00
parent bd4926157c
commit 65bdc65da1
2 changed files with 8 additions and 2 deletions

View File

@ -14,6 +14,8 @@ using triqs::arrays::array;
int main() {
try {
//typedef gf<two_real_times> Gf_type;
//typedef gf_view<two_real_times> Gf_view_type;
@ -31,7 +33,9 @@ int main() {
std::cout <<A << std::endl ;
G(t_,tp_) << t_ - 3*tp_;
//G2(t_,tp_) << t_ + 3*tp_;
G2(t_,tp_) << t_ + 3*tp_;
G2(t_,tp_) << 2* G(tp_,t_);
TEST( G(1,1) );
TEST( G[G.mesh()(1,1) ]);
@ -46,3 +50,5 @@ int main() {
//TEST( G2(2,1,3) ); // should not compile
}
catch( std::exception const &e) { std::cout << e.what()<< std::endl;}
}

View File

@ -191,7 +191,7 @@ namespace triqs { namespace gfs {
std::tuple<bool, size_t, double> windowing ( linear_mesh<D> const & mesh, typename D::point_t const & x) {
double a = (x - mesh.x_min())/mesh.delta();
long i = floor(a);
bool in = (! ((i<0) || (i>=long(mesh.size())-1)));
bool in = (! ((i<0) || (i>long(mesh.size())-1)));
double w = a-i;
// std::cerr << " window "<< i << " "<< in << " "<< w<< std::endl ;
return std::make_tuple(in, (in ? size_t(i) : 0),w);