From ed93cce4d4806ef2ffce60957a60d6e12cb495d6 Mon Sep 17 00:00:00 2001 From: ceschoon Date: Tue, 18 Jun 2024 11:24:36 +0200 Subject: [PATCH] Changed behaviour of Lattice::get_next_boundary_point so that it behaves like it used to (no error thrown when ran out of boundary points) --- include/Lattice.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/Lattice.h b/include/Lattice.h index 1833661..d6d82ff 100644 --- a/include/Lattice.h +++ b/include/Lattice.h @@ -312,6 +312,7 @@ void init(double L[]) bool get_next_boundary_point(int &ix, int &iy, int &iz) const { int b = boundary_width_; + long pos_input = pos(ix,iy,iz); // are we in x-boundary ? if(ix <= b || ix >= Nx_-b) @@ -346,7 +347,9 @@ void init(double L[]) if(iz > b && iz < Nz_-1) {iz++; ix = b+1; iy = b+1; return true;} } // no where left to go or we were fed a bad starting point - throw std::runtime_error("Lattice::get_next_boundary_point called with bad arguments"); + if (!is_boundary_point(pos_input)) + throw std::runtime_error("Lattice::get_next_boundary_point called with bad arguments"); + else return false; } bool get_next_boundary_point(long &p) const