/******************************************************************************* * * TRIQS: a Toolbox for Research in Interacting Quantum Systems * * Copyright (C) 2011 by M. Ferrero, O. Parcollet * * TRIQS is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any later * version. * * TRIQS is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * TRIQS. If not, see . * ******************************************************************************/ #ifndef TRIQS_GRID_GENERATOR_H #define TRIQS_GRID_GENERATOR_H #include namespace triqs { namespace lattice_tools { /** * Generate the point in a cuboid as an array const & */ class grid_generator : public boost::iterator_facade< grid_generator, K_type const &, boost::forward_traversal_tag, K_type const & > { friend class boost::iterator_core_access; size_t dim, nkpts,nx,ny,nz,N_X,N_Y,N_Z,index_; double step_x, step_y, step_z; bool at_end; K_type pt; void init() { nx=0; ny=0; nz=0;at_end = false;index_ =0; N_X = nkpts; N_Y = (dim>1 ? nkpts : 1); N_Z = (dim>2 ? nkpts : 1); step_x = 1.0/double(N_X); step_y = 1.0/double(N_Y); step_z = 1.0/double(N_Z); pt(0)=step_x/2; pt(1)=step_y/2; pt(2)=step_z/2; } void increment() { if (nx