From 02ce9094bad81264816ce69933f646c1770f1ffe Mon Sep 17 00:00:00 2001 From: Isuru Fernando <idf2@illinois.edu> Date: Tue, 5 Jan 2021 02:12:26 -0600 Subject: [PATCH] remove no kernels passing in LayerPotentialBase and fix tests --- sumpy/qbx.py | 10 ---------- test/test_matrixgen.py | 18 +++++++++++------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/sumpy/qbx.py b/sumpy/qbx.py index bf2922eb..5a05c057 100644 --- a/sumpy/qbx.py +++ b/sumpy/qbx.py @@ -75,16 +75,6 @@ class LayerPotentialBase(KernelComputation, KernelCacheWrapper): from pytools import single_valued sdr = SourceDerivativeRemover() tdr = TargetDerivativeRemover() - if source_kernels is None and target_kernels is None: - from warnings import warn - warn("A list for the second argument of the constructor is deprecated." - "Use a single expansion and pass source_kernels and target_kernels", - DeprecationWarning, stacklevel=2) - source_kernel = single_valued(tdr(exp.kernel) for exp in expansion) - base_kernel = sdr(source_kernel) - target_kernels = tuple(sdr(exp.kernel) for exp in expansion) - source_kernels = (source_kernel,) - expansion = expansion[0].copy(kernel=base_kernel) KernelComputation.__init__(self, ctx=ctx, target_kernels=target_kernels, strength_usage=strength_usage, source_kernels=source_kernels, diff --git a/test/test_matrixgen.py b/test/test_matrixgen.py index d56341d2..c51fc3ce 100644 --- a/test/test_matrixgen.py +++ b/test/test_matrixgen.py @@ -109,24 +109,28 @@ def test_qbx_direct(ctx_factory, factor, lpot_id): from sumpy.kernel import LaplaceKernel, DirectionalSourceDerivative if lpot_id == 1: - knl = LaplaceKernel(ndim) + base_knl = LaplaceKernel(ndim) + knl = base_knl elif lpot_id == 2: - knl = LaplaceKernel(ndim) - knl = DirectionalSourceDerivative(knl, dir_vec_name="dsource_vec") + base_knl = LaplaceKernel(ndim) + knl = DirectionalSourceDerivative(base_knl, dir_vec_name="dsource_vec") else: raise ValueError("unknow lpot_id") from sumpy.expansion.local import LineTaylorLocalExpansion - lknl = LineTaylorLocalExpansion(knl, order) + expn = LineTaylorLocalExpansion(knl, order) from sumpy.qbx import LayerPotential - lpot = LayerPotential(ctx, [lknl]) + lpot = LayerPotential(ctx, expansion=expn, source_kernels=(knl,), + target_kernels=(base_knl,)) from sumpy.qbx import LayerPotentialMatrixGenerator - mat_gen = LayerPotentialMatrixGenerator(ctx, [lknl]) + mat_gen = LayerPotentialMatrixGenerator(ctx, expansion=expn, + source_kernels=(knl,), target_kernels=(base_knl,)) from sumpy.qbx import LayerPotentialMatrixBlockGenerator - blk_gen = LayerPotentialMatrixBlockGenerator(ctx, [lknl]) + blk_gen = LayerPotentialMatrixBlockGenerator(ctx, expansion=expn, + source_kernels=(knl,), target_kernels=(base_knl,)) for n in [200, 300, 400]: targets, sources, centers, expansion_radii, sigma = \ -- GitLab