From bb33283fdefc4d3c9de2ae5662d40f076798bf74 Mon Sep 17 00:00:00 2001 From: Alex Fikl Date: Thu, 21 Jun 2018 16:26:31 -0500 Subject: [PATCH 1/3] make sure qbx_order is provided --- pytential/qbx/__init__.py | 6 ++++++ test/test_global_qbx.py | 10 +++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pytential/qbx/__init__.py b/pytential/qbx/__init__.py index d3cd843a..b3bb102f 100644 --- a/pytential/qbx/__init__.py +++ b/pytential/qbx/__init__.py @@ -106,6 +106,12 @@ class QBXLayerPotentialSource(LayerPotentialSourceBase): # {{{ argument processing + if fine_order is None: + raise ValueError("fine_order must be provided.") + + if qbx_order is None: + raise ValueError("qbx_order must be provided.") + if target_stick_out_factor is not _not_provided: from warnings import warn warn("target_stick_out_factor has been renamed to " diff --git a/test/test_global_qbx.py b/test/test_global_qbx.py index d0128819..d6ffeaf4 100644 --- a/test/test_global_qbx.py +++ b/test/test_global_qbx.py @@ -96,7 +96,9 @@ def run_source_refinement_test(ctx_getter, mesh, order, helmholtz_k=None): from pytential.qbx.utils import TreeCodeContainer - lpot_source = QBXLayerPotentialSource(discr, order) + lpot_source = QBXLayerPotentialSource(discr, + fine_order=order, + qbx_order=order // 2) del discr expansion_disturbance_tolerance = 0.025 @@ -239,7 +241,8 @@ def test_target_association(ctx_getter, curve_name, curve_f, nelements, discr = Discretization(cl_ctx, mesh, factory) - lpot_source, conn = QBXLayerPotentialSource(discr, order).with_refinement() + lpot_source, conn = QBXLayerPotentialSource(discr, + fine_order=order, qbx_order=order // 2).with_refinement() del discr from pytential.qbx.utils import get_interleaved_centers @@ -417,7 +420,8 @@ def test_target_association_failure(ctx_getter): InterpolatoryQuadratureSimplexGroupFactory factory = InterpolatoryQuadratureSimplexGroupFactory(order) discr = Discretization(cl_ctx, mesh, factory) - lpot_source = QBXLayerPotentialSource(discr, order) + lpot_source = QBXLayerPotentialSource(discr, + fine_order=order, qbx_order=order // 2) # }}} -- GitLab From 5d333006141f20dbad4dec6a296a33ce784b5fd8 Mon Sep 17 00:00:00 2001 From: Alex Fikl Date: Fri, 22 Jun 2018 10:37:49 -0500 Subject: [PATCH 2/3] add a comment to tests using qbx_order that don't need it --- test/test_global_qbx.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/test_global_qbx.py b/test/test_global_qbx.py index d6ffeaf4..aacc53e5 100644 --- a/test/test_global_qbx.py +++ b/test/test_global_qbx.py @@ -97,8 +97,8 @@ def run_source_refinement_test(ctx_getter, mesh, order, helmholtz_k=None): from pytential.qbx.utils import TreeCodeContainer lpot_source = QBXLayerPotentialSource(discr, - fine_order=order, - qbx_order=order // 2) + qbx_order=order, # not used in refinement + fine_order=order) del discr expansion_disturbance_tolerance = 0.025 @@ -242,7 +242,8 @@ def test_target_association(ctx_getter, curve_name, curve_f, nelements, discr = Discretization(cl_ctx, mesh, factory) lpot_source, conn = QBXLayerPotentialSource(discr, - fine_order=order, qbx_order=order // 2).with_refinement() + qbx_order=order, # not used in target association + fine_order=order).with_refinement() del discr from pytential.qbx.utils import get_interleaved_centers @@ -421,7 +422,8 @@ def test_target_association_failure(ctx_getter): factory = InterpolatoryQuadratureSimplexGroupFactory(order) discr = Discretization(cl_ctx, mesh, factory) lpot_source = QBXLayerPotentialSource(discr, - fine_order=order, qbx_order=order // 2) + qbx_order=order, # not used in target association + fine_order=order) # }}} -- GitLab From 5937ce8229174b4cbb645c374ae178a9bc14cfa4 Mon Sep 17 00:00:00 2001 From: Alex Fikl Date: Fri, 22 Jun 2018 11:23:18 -0500 Subject: [PATCH 3/3] flake8 --- test/test_global_qbx.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_global_qbx.py b/test/test_global_qbx.py index aacc53e5..86832d6e 100644 --- a/test/test_global_qbx.py +++ b/test/test_global_qbx.py @@ -97,7 +97,7 @@ def run_source_refinement_test(ctx_getter, mesh, order, helmholtz_k=None): from pytential.qbx.utils import TreeCodeContainer lpot_source = QBXLayerPotentialSource(discr, - qbx_order=order, # not used in refinement + qbx_order=order, # not used in refinement fine_order=order) del discr @@ -242,7 +242,7 @@ def test_target_association(ctx_getter, curve_name, curve_f, nelements, discr = Discretization(cl_ctx, mesh, factory) lpot_source, conn = QBXLayerPotentialSource(discr, - qbx_order=order, # not used in target association + qbx_order=order, # not used in target association fine_order=order).with_refinement() del discr @@ -422,7 +422,7 @@ def test_target_association_failure(ctx_getter): factory = InterpolatoryQuadratureSimplexGroupFactory(order) discr = Discretization(cl_ctx, mesh, factory) lpot_source = QBXLayerPotentialSource(discr, - qbx_order=order, # not used in target association + qbx_order=order, # not used in target association fine_order=order) # }}} -- GitLab