diff --git a/projection_utils.py b/projection_utils.py index 20b18a81fa1e35b97b1893aeec22d9ee85f1a478..2ede5b24415a43a8b2094a1b589ff9db926b67ff 100644 --- a/projection_utils.py +++ b/projection_utils.py @@ -118,8 +118,9 @@ class Mesh: # Adjust grid spacing to be within interval if necessary grid_spacing = self.cell_len - while point - stencil_length/2 * grid_spacing < self._left_bound \ - or point + stencil_length/2 * grid_spacing > self._right_bound: + max_spacing = 2/stencil_length*min(point-self._left_bound, + self._right_bound-point) + while grid_spacing > max_spacing: grid_spacing /= 2 # Return new mesh instance