From 706ad4deabab027e4f20471c7725780fb5b35717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=BChle=2C=20Laura=20Christine=20=28lakue103=29?= <laura.kuehle@uni-duesseldorf.de> Date: Sun, 5 Jun 2022 18:03:11 +0200 Subject: [PATCH] Refactored 'random_stencil()'. --- projection_utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projection_utils.py b/projection_utils.py index 20b18a8..2ede5b2 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 -- GitLab