From 2fa7e6b61727ef6619be19a0a8d84cfeba8ea455 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Fri, 12 Jan 2018 16:24:07 -0600 Subject: [PATCH] Lpot source: Disallow passing 'npanels' to _expansion_radii(). --- pytential/qbx/__init__.py | 9 +++------ test/test_global_qbx.py | 6 +++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/pytential/qbx/__init__.py b/pytential/qbx/__init__.py index c3ca7d95..82ef3e19 100644 --- a/pytential/qbx/__init__.py +++ b/pytential/qbx/__init__.py @@ -409,12 +409,9 @@ class QBXLayerPotentialSource(LayerPotentialSourceBase): @memoize_method def _expansion_radii(self, last_dim_length): if last_dim_length == "npanels": - # FIXME: Make this an error - - from warnings import warn - warn("Passing 'npanels' as last_dim_length to _expansion_radii is " - "deprecated. Expansion radii should be allowed to vary " - "within a panel.", stacklevel=3) + raise ValueError( + "Passing 'npanels' as last_dim_length to _expansion_radii is " + "not allowed. Allowed values are 'nsources' and 'ncenters'.") with cl.CommandQueue(self.cl_context) as queue: return (self._panel_sizes(last_dim_length).with_queue(queue) * 0.5 diff --git a/test/test_global_qbx.py b/test/test_global_qbx.py index cc0f26f0..c7609387 100644 --- a/test/test_global_qbx.py +++ b/test/test_global_qbx.py @@ -121,7 +121,7 @@ def run_source_refinement_test(ctx_getter, mesh, order, helmholtz_k=None): int_centers = np.array([axis.get(queue) for axis in int_centers]) ext_centers = get_centers_on_side(lpot_source, +1) ext_centers = np.array([axis.get(queue) for axis in ext_centers]) - expansion_radii = lpot_source._expansion_radii("npanels").get(queue) + expansion_radii = lpot_source._expansion_radii("nsources").get(queue) panel_sizes = lpot_source._panel_sizes("npanels").get(queue) fine_panel_sizes = lpot_source._fine_panel_sizes("npanels").get(queue) @@ -150,8 +150,8 @@ def run_source_refinement_test(ctx_getter, mesh, order, helmholtz_k=None): # A center cannot be closer to another panel than to its originating # panel. - rad = expansion_radii[centers_panel.element_nr] - assert dist >= rad * (1-expansion_disturbance_tolerance), \ + rad = expansion_radii[centers_panel.discr_slice] + assert (dist >= rad * (1-expansion_disturbance_tolerance)).all(), \ (dist, rad, centers_panel.element_nr, sources_panel.element_nr) def check_sufficient_quadrature_resolution(centers_panel, sources_panel): -- GitLab