From df726621cc43701cb7540f93de22d57540d3d814 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Fri, 30 Jun 2017 23:39:13 -0500 Subject: [PATCH 1/5] Rename QBXTargetAssocation to TargetAssocation and rename QBXTargetAssocationFailedException to TargetAssocationFailedException. --- examples/cahn-hilliard.py | 4 ++-- examples/helmholtz-dirichlet.py | 4 ++-- examples/maxwell.py | 4 ++-- examples/scaling-study.py | 4 ++-- pytential/qbx/__init__.py | 6 +++--- pytential/qbx/target_assoc.py | 16 ++++++++-------- test/test_global_qbx.py | 4 ++-- test/test_layer_pot.py | 4 ++-- test/test_scalar_int_eq.py | 4 ++-- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/examples/cahn-hilliard.py b/examples/cahn-hilliard.py index 8393f744..fce81499 100644 --- a/examples/cahn-hilliard.py +++ b/examples/cahn-hilliard.py @@ -41,7 +41,7 @@ def main(): InterpolatoryQuadratureSimplexGroupFactory(bdry_quad_order)) from pytential.qbx import ( - QBXLayerPotentialSource, QBXTargetAssociationFailedException) + QBXLayerPotentialSource, TargetAssociationFailedException) qbx, _ = QBXLayerPotentialSource( pre_density_discr, fine_order=bdry_ovsmp_quad_order, qbx_order=qbx_order, fmm_order=fmm_order, @@ -107,7 +107,7 @@ def main(): fld_in_vol = bind( (qbx_stick_out, PointsTarget(targets)), chop.representation(unk))(queue, sigma=sigma).get() - except QBXTargetAssociationFailedException as e: + except TargetAssociationFailedException as e: fplot.write_vtk_file( "failed-targets.vts", [ diff --git a/examples/helmholtz-dirichlet.py b/examples/helmholtz-dirichlet.py index b591c5be..c231b70c 100644 --- a/examples/helmholtz-dirichlet.py +++ b/examples/helmholtz-dirichlet.py @@ -69,7 +69,7 @@ def main(): InterpolatoryQuadratureSimplexGroupFactory(bdry_quad_order)) from pytential.qbx import ( - QBXLayerPotentialSource, QBXTargetAssociationFailedException) + QBXLayerPotentialSource, TargetAssociationFailedException) qbx, _ = QBXLayerPotentialSource( pre_density_discr, fine_order=bdry_ovsmp_quad_order, qbx_order=qbx_order, fmm_order=fmm_order @@ -159,7 +159,7 @@ def main(): fld_in_vol = bind( (qbx_stick_out, PointsTarget(targets)), representation_sym)(queue, sigma=sigma, k=k).get() - except QBXTargetAssociationFailedException as e: + except TargetAssociationFailedException as e: fplot.write_vtk_file( "failed-targets.vts", [ diff --git a/examples/maxwell.py b/examples/maxwell.py index ed8c6106..75712a1c 100644 --- a/examples/maxwell.py +++ b/examples/maxwell.py @@ -101,7 +101,7 @@ def main(): qbx_tgt_tol = qbx.copy(target_association_tolerance=0.1) from pytential.target import PointsTarget - from pytential.qbx import QBXTargetAssociationFailedException + from pytential.qbx import TargetAssociationFailedException try: fld_in_vol = bind( (qbx_tgt_tol, PointsTarget(fplot.points)), @@ -116,7 +116,7 @@ def main(): qbx_forced_limit=None)), ]) )(queue, jt=jt, rho=rho, k=k) - except QBXTargetAssociationFailedException as e: + except TargetAssociationFailedException as e: fplot.write_vtk_file( "failed-targets.vts", [ diff --git a/examples/scaling-study.py b/examples/scaling-study.py index 183fc915..f47035b4 100644 --- a/examples/scaling-study.py +++ b/examples/scaling-study.py @@ -66,7 +66,7 @@ def timing_run(nx, ny): InterpolatoryQuadratureSimplexGroupFactory(bdry_quad_order)) from pytential.qbx import ( - QBXLayerPotentialSource, QBXTargetAssociationFailedException) + QBXLayerPotentialSource, TargetAssociationFailedException) qbx = QBXLayerPotentialSource( density_discr, fine_order=bdry_ovsmp_quad_order, qbx_order=qbx_order, fmm_order=fmm_order @@ -158,7 +158,7 @@ def timing_run(nx, ny): fld_in_vol = bind( (qbx_stick_out, PointsTarget(targets)), sym_op)(queue, sigma=sigma, k=k).get() - except QBXTargetAssociationFailedException as e: + except TargetAssociationFailedException as e: fplot.write_vtk_file( "failed-targets.vts", [ diff --git a/pytential/qbx/__init__.py b/pytential/qbx/__init__.py index 3568601f..98e9f44e 100644 --- a/pytential/qbx/__init__.py +++ b/pytential/qbx/__init__.py @@ -28,7 +28,7 @@ import six import numpy as np from pytools import memoize_method from meshmode.discretization import Discretization -from pytential.qbx.target_assoc import QBXTargetAssociationFailedException +from pytential.qbx.target_assoc import TargetAssociationFailedException from pytential.source import LayerPotentialSourceBase import pyopencl as cl @@ -40,7 +40,7 @@ logger = logging.getLogger(__name__) __doc__ = """ .. autoclass:: QBXLayerPotentialSource -.. autoclass:: QBXTargetAssociationFailedException +.. autoclass:: TargetAssociationFailedException """ @@ -775,7 +775,7 @@ class QBXLayerPotentialSource(LayerPotentialSourceBase): __all__ = ( QBXLayerPotentialSource, - QBXTargetAssociationFailedException, + TargetAssociationFailedException, ) # vim: fdm=marker diff --git a/pytential/qbx/target_assoc.py b/pytential/qbx/target_assoc.py index 1a447396..54945f2f 100644 --- a/pytential/qbx/target_assoc.py +++ b/pytential/qbx/target_assoc.py @@ -87,9 +87,9 @@ A target may further specify how it should be treated by target association. Return values ^^^^^^^^^^^^^ -.. autoclass:: QBXTargetAssociation +.. autoclass:: TargetAssociation -.. autoclass:: QBXTargetAssociationFailedException +.. autoclass:: TargetAssociationFailedException Target association driver ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -352,7 +352,7 @@ QBX_FAILED_TARGET_ASSOCIATION_REFINER = AreaQueryElementwiseTemplate( # {{{ target associator -class QBXTargetAssociationFailedException(Exception): +class TargetAssociationFailedException(Exception): """ .. attribute:: refine_flags .. attribute:: failed_target_flags @@ -365,7 +365,7 @@ class QBXTargetAssociationFailedException(Exception): return "<%s>" % type(self).__name__ -class QBXTargetAssociation(DeviceDataRecord): +class TargetAssociation(DeviceDataRecord): """ .. attribute:: target_to_center """ @@ -709,7 +709,7 @@ class TargetAssociationWrangler(TreeWranglerBase): target_to_center.fill(-1) target_to_center.finish() - return QBXTargetAssociation(target_to_center=target_to_center) + return TargetAssociation(target_to_center=target_to_center) def associate_targets_to_qbx_centers(lpot_source, wrangler, @@ -735,11 +735,11 @@ def associate_targets_to_qbx_centers(lpot_source, wrangler, The side request can take on the values in :ref:`qbx-side-request-table`. - :raises QBXTargetAssociationFailedException: + :raises TargetAssociationFailedException: when target association failed to find a center for a target. The returned exception object contains suggested refine flags. - :returns: A :class:`QBXTargetAssociation`. + :returns: A :class:`TargetAssociation`. """ tree = wrangler.build_tree(lpot_source, @@ -783,7 +783,7 @@ def associate_targets_to_qbx_centers(lpot_source, wrangler, tree, peer_lists, lpot_source, target_status, refine_flags, debug) assert have_panel_to_refine - raise QBXTargetAssociationFailedException( + raise TargetAssociationFailedException( refine_flags=refine_flags.with_queue(None), failed_target_flags=center_not_found.with_queue(None)) diff --git a/test/test_global_qbx.py b/test/test_global_qbx.py index 12c816f4..7848ca37 100644 --- a/test/test_global_qbx.py +++ b/test/test_global_qbx.py @@ -395,11 +395,11 @@ def test_target_association_failure(ctx_getter): from pytential.qbx.target_assoc import ( TargetAssociationCodeContainer, associate_targets_to_qbx_centers, - QBXTargetAssociationFailedException) + TargetAssociationFailedException) code_container = TargetAssociationCodeContainer(cl_ctx) - with pytest.raises(QBXTargetAssociationFailedException): + with pytest.raises(TargetAssociationFailedException): associate_targets_to_qbx_centers( lpot_source, code_container.get_wrangler(queue), diff --git a/test/test_layer_pot.py b/test/test_layer_pot.py index 280a918c..caba317a 100644 --- a/test/test_layer_pot.py +++ b/test/test_layer_pot.py @@ -394,14 +394,14 @@ def test_off_surface_eval_vs_direct(ctx_getter, do_plot=False): op = sym.D(LaplaceKernel(2), sym.var("sigma"), qbx_forced_limit=None) - from pytential.qbx import QBXTargetAssociationFailedException + from pytential.qbx import TargetAssociationFailedException try: direct_density_discr = direct_qbx.density_discr direct_sigma = direct_density_discr.zeros(queue) + 1 direct_fld_in_vol = bind((direct_qbx, ptarget), op)( queue, sigma=direct_sigma) - except QBXTargetAssociationFailedException as e: + except TargetAssociationFailedException as e: fplot.show_scalar_in_matplotlib(e.failed_target_flags.get(queue)) import matplotlib.pyplot as pt pt.show() diff --git a/test/test_scalar_int_eq.py b/test/test_scalar_int_eq.py index 9443261a..b0694112 100644 --- a/test/test_scalar_int_eq.py +++ b/test/test_scalar_int_eq.py @@ -373,14 +373,14 @@ def run_int_eq_test(cl_ctx, queue, case, resolution): qbx_tgt_tol = qbx.copy(target_association_tolerance=0.15) from pytential.target import PointsTarget - from pytential.qbx import QBXTargetAssociationFailedException + from pytential.qbx import TargetAssociationFailedException try: solved_pot = bind( (qbx_tgt_tol, PointsTarget(fplot.points)), op.representation(sym.var("u")) )(queue, u=u, k=case.k) - except QBXTargetAssociationFailedException as e: + except TargetAssociationFailedException as e: fplot.write_vtk_file( "failed-targets.vts", [ -- GitLab From 0a78aab37bd8dff223b64007de0ac3b425916c5c Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sat, 1 Jul 2017 01:24:12 -0500 Subject: [PATCH 2/5] QBX: Don't compute expansions in centers that don't have any targets (closes #53 on gitlab). --- pytential/qbx/__init__.py | 3 --- pytential/qbx/geometry.py | 50 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/pytential/qbx/__init__.py b/pytential/qbx/__init__.py index 98e9f44e..c34f0905 100644 --- a/pytential/qbx/__init__.py +++ b/pytential/qbx/__init__.py @@ -575,9 +575,6 @@ class QBXLayerPotentialSource(LayerPotentialSourceBase): # }}} - if len(geo_data.global_qbx_centers()) != geo_data.ncenters: - raise NotImplementedError("geometry has centers requiring local QBX") - from pytential.qbx.geometry import target_state if (geo_data.user_target_to_center().with_queue(queue) == target_state.FAILED).any().get(): diff --git a/pytential/qbx/geometry.py b/pytential/qbx/geometry.py index af8da4ca..96bacdf1 100644 --- a/pytential/qbx/geometry.py +++ b/pytential/qbx/geometry.py @@ -222,6 +222,28 @@ class QBXFMMGeometryCodeGetter(object): if (i+1 == N) *count = item; """) + @property + @memoize_method + def pick_used_centers(self): + knl = lp.make_kernel( + """{[i]: 0<=itarget_has_center = (target_to_center[i] >= 0) + center_is_used[target_to_center[i]] = 1 \ + {id=center_is_used_write,if=target_has_center} + """, + [ + lp.GlobalArg("target_to_center", shape="ntargets", offset=lp.auto), + lp.GlobalArg("center_is_used", shape="ncenters"), + lp.ValueArg("ncenters", np.int32), + lp.ValueArg("ntargets", np.int32), + ], + name="pick_used_centers", + silenced_warnings="write_race(center_is_used_write)") + + knl = lp.split_iname(knl, "i", 128, inner_tag="l.0", outer_tag="g.0") + return knl + # }}} @@ -603,25 +625,47 @@ class QBXFMMGeometryData(object): """Build a list of indices of QBX centers that use global QBX. This indexes into the global list of targets, (see :meth:`target_info`) of which the QBX centers occupy the first *ncenters*. + + Centers without any associated targets are excluded. """ tree = self.tree() + user_target_to_center = self.user_target_to_center() with cl.CommandQueue(self.cl_context) as queue: + logger.info("find global qbx centers: start") + + tgt_assoc_result = ( + user_target_to_center.with_queue(queue)[self.ncenters:]) + + center_is_used = cl.array.zeros(queue, self.ncenters, np.int8) + + self.code_getter.pick_used_centers( + queue, + center_is_used=center_is_used, + target_to_center=tgt_assoc_result, + ncenters=self.ncenters, + ntargets=len(tgt_assoc_result)) + from pyopencl.algorithm import copy_if - logger.info("find global qbx centers: start") result, count, _ = copy_if( cl.array.arange(queue, self.ncenters, tree.particle_id_dtype), - "global_qbx_flags[i] != 0", + "global_qbx_flags[i] != 0 && center_is_used[i] != 0", extra_args=[ - ("global_qbx_flags", self.global_qbx_flags()) + ("global_qbx_flags", self.global_qbx_flags()), + ("center_is_used", center_is_used) ], queue=queue) logger.info("find global qbx centers: done") + if self.debug: + logger.debug( + "find global qbx centers: using %d/%d centers" + % (int(count.get()), self.ncenters)) + return result[:count.get()].with_queue(None) @memoize_method -- GitLab From 9cfba4fc5859a1dabb7610555fe279a91cd00687 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sat, 1 Jul 2017 17:19:36 -0500 Subject: [PATCH 3/5] Fix fmmlib breakage due to edge case with zero centers. --- pytential/qbx/fmmlib.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pytential/qbx/fmmlib.py b/pytential/qbx/fmmlib.py index 9ec0194c..5ae793e9 100644 --- a/pytential/qbx/fmmlib.py +++ b/pytential/qbx/fmmlib.py @@ -419,6 +419,10 @@ class QBXFMMLibExpansionWrangler(FMMLibExpansionWrangler): qbx_center_to_target_box = geo_data.qbx_center_to_target_box() qbx_centers = geo_data.centers() centers = self.tree.box_centers + ngqbx_centers = len(geo_data.global_qbx_centers()) + + if ngqbx_centers == 0: + return mploc = self.get_translation_routine("%ddmploc", vec_suffix="_imany") @@ -429,7 +433,6 @@ class QBXFMMLibExpansionWrangler(FMMLibExpansionWrangler): print("par data prep lev %d" % isrc_level) - ngqbx_centers = len(geo_data.global_qbx_centers()) tgt_icenter_vec = geo_data.global_qbx_centers() icontaining_tgt_box_vec = qbx_center_to_target_box[tgt_icenter_vec] -- GitLab From 81ab488dd75b082dd16ac40579e24eebb495724d Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sat, 1 Jul 2017 19:24:12 -0500 Subject: [PATCH 4/5] Return local expansions. --- pytential/qbx/fmmlib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytential/qbx/fmmlib.py b/pytential/qbx/fmmlib.py index 5ae793e9..bbb37ab0 100644 --- a/pytential/qbx/fmmlib.py +++ b/pytential/qbx/fmmlib.py @@ -422,7 +422,7 @@ class QBXFMMLibExpansionWrangler(FMMLibExpansionWrangler): ngqbx_centers = len(geo_data.global_qbx_centers()) if ngqbx_centers == 0: - return + return local_exps mploc = self.get_translation_routine("%ddmploc", vec_suffix="_imany") -- GitLab From 2811931be3202577617a4d9bfcc595c3cb193185 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sun, 2 Jul 2017 00:42:43 -0500 Subject: [PATCH 5/5] Revert "Rename QBXTargetAssocation to TargetAssocation and rename" This reverts commit df726621cc43701cb7540f93de22d57540d3d814. --- examples/cahn-hilliard.py | 4 ++-- examples/helmholtz-dirichlet.py | 4 ++-- examples/maxwell.py | 4 ++-- examples/scaling-study.py | 4 ++-- pytential/qbx/__init__.py | 6 +++--- pytential/qbx/target_assoc.py | 16 ++++++++-------- test/test_global_qbx.py | 4 ++-- test/test_layer_pot.py | 4 ++-- test/test_scalar_int_eq.py | 4 ++-- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/examples/cahn-hilliard.py b/examples/cahn-hilliard.py index fce81499..8393f744 100644 --- a/examples/cahn-hilliard.py +++ b/examples/cahn-hilliard.py @@ -41,7 +41,7 @@ def main(): InterpolatoryQuadratureSimplexGroupFactory(bdry_quad_order)) from pytential.qbx import ( - QBXLayerPotentialSource, TargetAssociationFailedException) + QBXLayerPotentialSource, QBXTargetAssociationFailedException) qbx, _ = QBXLayerPotentialSource( pre_density_discr, fine_order=bdry_ovsmp_quad_order, qbx_order=qbx_order, fmm_order=fmm_order, @@ -107,7 +107,7 @@ def main(): fld_in_vol = bind( (qbx_stick_out, PointsTarget(targets)), chop.representation(unk))(queue, sigma=sigma).get() - except TargetAssociationFailedException as e: + except QBXTargetAssociationFailedException as e: fplot.write_vtk_file( "failed-targets.vts", [ diff --git a/examples/helmholtz-dirichlet.py b/examples/helmholtz-dirichlet.py index c231b70c..b591c5be 100644 --- a/examples/helmholtz-dirichlet.py +++ b/examples/helmholtz-dirichlet.py @@ -69,7 +69,7 @@ def main(): InterpolatoryQuadratureSimplexGroupFactory(bdry_quad_order)) from pytential.qbx import ( - QBXLayerPotentialSource, TargetAssociationFailedException) + QBXLayerPotentialSource, QBXTargetAssociationFailedException) qbx, _ = QBXLayerPotentialSource( pre_density_discr, fine_order=bdry_ovsmp_quad_order, qbx_order=qbx_order, fmm_order=fmm_order @@ -159,7 +159,7 @@ def main(): fld_in_vol = bind( (qbx_stick_out, PointsTarget(targets)), representation_sym)(queue, sigma=sigma, k=k).get() - except TargetAssociationFailedException as e: + except QBXTargetAssociationFailedException as e: fplot.write_vtk_file( "failed-targets.vts", [ diff --git a/examples/maxwell.py b/examples/maxwell.py index 75712a1c..ed8c6106 100644 --- a/examples/maxwell.py +++ b/examples/maxwell.py @@ -101,7 +101,7 @@ def main(): qbx_tgt_tol = qbx.copy(target_association_tolerance=0.1) from pytential.target import PointsTarget - from pytential.qbx import TargetAssociationFailedException + from pytential.qbx import QBXTargetAssociationFailedException try: fld_in_vol = bind( (qbx_tgt_tol, PointsTarget(fplot.points)), @@ -116,7 +116,7 @@ def main(): qbx_forced_limit=None)), ]) )(queue, jt=jt, rho=rho, k=k) - except TargetAssociationFailedException as e: + except QBXTargetAssociationFailedException as e: fplot.write_vtk_file( "failed-targets.vts", [ diff --git a/examples/scaling-study.py b/examples/scaling-study.py index f47035b4..183fc915 100644 --- a/examples/scaling-study.py +++ b/examples/scaling-study.py @@ -66,7 +66,7 @@ def timing_run(nx, ny): InterpolatoryQuadratureSimplexGroupFactory(bdry_quad_order)) from pytential.qbx import ( - QBXLayerPotentialSource, TargetAssociationFailedException) + QBXLayerPotentialSource, QBXTargetAssociationFailedException) qbx = QBXLayerPotentialSource( density_discr, fine_order=bdry_ovsmp_quad_order, qbx_order=qbx_order, fmm_order=fmm_order @@ -158,7 +158,7 @@ def timing_run(nx, ny): fld_in_vol = bind( (qbx_stick_out, PointsTarget(targets)), sym_op)(queue, sigma=sigma, k=k).get() - except TargetAssociationFailedException as e: + except QBXTargetAssociationFailedException as e: fplot.write_vtk_file( "failed-targets.vts", [ diff --git a/pytential/qbx/__init__.py b/pytential/qbx/__init__.py index c34f0905..adb858a1 100644 --- a/pytential/qbx/__init__.py +++ b/pytential/qbx/__init__.py @@ -28,7 +28,7 @@ import six import numpy as np from pytools import memoize_method from meshmode.discretization import Discretization -from pytential.qbx.target_assoc import TargetAssociationFailedException +from pytential.qbx.target_assoc import QBXTargetAssociationFailedException from pytential.source import LayerPotentialSourceBase import pyopencl as cl @@ -40,7 +40,7 @@ logger = logging.getLogger(__name__) __doc__ = """ .. autoclass:: QBXLayerPotentialSource -.. autoclass:: TargetAssociationFailedException +.. autoclass:: QBXTargetAssociationFailedException """ @@ -772,7 +772,7 @@ class QBXLayerPotentialSource(LayerPotentialSourceBase): __all__ = ( QBXLayerPotentialSource, - TargetAssociationFailedException, + QBXTargetAssociationFailedException, ) # vim: fdm=marker diff --git a/pytential/qbx/target_assoc.py b/pytential/qbx/target_assoc.py index 54945f2f..1a447396 100644 --- a/pytential/qbx/target_assoc.py +++ b/pytential/qbx/target_assoc.py @@ -87,9 +87,9 @@ A target may further specify how it should be treated by target association. Return values ^^^^^^^^^^^^^ -.. autoclass:: TargetAssociation +.. autoclass:: QBXTargetAssociation -.. autoclass:: TargetAssociationFailedException +.. autoclass:: QBXTargetAssociationFailedException Target association driver ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -352,7 +352,7 @@ QBX_FAILED_TARGET_ASSOCIATION_REFINER = AreaQueryElementwiseTemplate( # {{{ target associator -class TargetAssociationFailedException(Exception): +class QBXTargetAssociationFailedException(Exception): """ .. attribute:: refine_flags .. attribute:: failed_target_flags @@ -365,7 +365,7 @@ class TargetAssociationFailedException(Exception): return "<%s>" % type(self).__name__ -class TargetAssociation(DeviceDataRecord): +class QBXTargetAssociation(DeviceDataRecord): """ .. attribute:: target_to_center """ @@ -709,7 +709,7 @@ class TargetAssociationWrangler(TreeWranglerBase): target_to_center.fill(-1) target_to_center.finish() - return TargetAssociation(target_to_center=target_to_center) + return QBXTargetAssociation(target_to_center=target_to_center) def associate_targets_to_qbx_centers(lpot_source, wrangler, @@ -735,11 +735,11 @@ def associate_targets_to_qbx_centers(lpot_source, wrangler, The side request can take on the values in :ref:`qbx-side-request-table`. - :raises TargetAssociationFailedException: + :raises QBXTargetAssociationFailedException: when target association failed to find a center for a target. The returned exception object contains suggested refine flags. - :returns: A :class:`TargetAssociation`. + :returns: A :class:`QBXTargetAssociation`. """ tree = wrangler.build_tree(lpot_source, @@ -783,7 +783,7 @@ def associate_targets_to_qbx_centers(lpot_source, wrangler, tree, peer_lists, lpot_source, target_status, refine_flags, debug) assert have_panel_to_refine - raise TargetAssociationFailedException( + raise QBXTargetAssociationFailedException( refine_flags=refine_flags.with_queue(None), failed_target_flags=center_not_found.with_queue(None)) diff --git a/test/test_global_qbx.py b/test/test_global_qbx.py index 7848ca37..12c816f4 100644 --- a/test/test_global_qbx.py +++ b/test/test_global_qbx.py @@ -395,11 +395,11 @@ def test_target_association_failure(ctx_getter): from pytential.qbx.target_assoc import ( TargetAssociationCodeContainer, associate_targets_to_qbx_centers, - TargetAssociationFailedException) + QBXTargetAssociationFailedException) code_container = TargetAssociationCodeContainer(cl_ctx) - with pytest.raises(TargetAssociationFailedException): + with pytest.raises(QBXTargetAssociationFailedException): associate_targets_to_qbx_centers( lpot_source, code_container.get_wrangler(queue), diff --git a/test/test_layer_pot.py b/test/test_layer_pot.py index caba317a..280a918c 100644 --- a/test/test_layer_pot.py +++ b/test/test_layer_pot.py @@ -394,14 +394,14 @@ def test_off_surface_eval_vs_direct(ctx_getter, do_plot=False): op = sym.D(LaplaceKernel(2), sym.var("sigma"), qbx_forced_limit=None) - from pytential.qbx import TargetAssociationFailedException + from pytential.qbx import QBXTargetAssociationFailedException try: direct_density_discr = direct_qbx.density_discr direct_sigma = direct_density_discr.zeros(queue) + 1 direct_fld_in_vol = bind((direct_qbx, ptarget), op)( queue, sigma=direct_sigma) - except TargetAssociationFailedException as e: + except QBXTargetAssociationFailedException as e: fplot.show_scalar_in_matplotlib(e.failed_target_flags.get(queue)) import matplotlib.pyplot as pt pt.show() diff --git a/test/test_scalar_int_eq.py b/test/test_scalar_int_eq.py index b0694112..9443261a 100644 --- a/test/test_scalar_int_eq.py +++ b/test/test_scalar_int_eq.py @@ -373,14 +373,14 @@ def run_int_eq_test(cl_ctx, queue, case, resolution): qbx_tgt_tol = qbx.copy(target_association_tolerance=0.15) from pytential.target import PointsTarget - from pytential.qbx import TargetAssociationFailedException + from pytential.qbx import QBXTargetAssociationFailedException try: solved_pot = bind( (qbx_tgt_tol, PointsTarget(fplot.points)), op.representation(sym.var("u")) )(queue, u=u, k=case.k) - except TargetAssociationFailedException as e: + except QBXTargetAssociationFailedException as e: fplot.write_vtk_file( "failed-targets.vts", [ -- GitLab