Skip to content
Snippets Groups Projects
Commit 02ce9094 authored by Isuru Fernando's avatar Isuru Fernando
Browse files

remove no kernels passing in LayerPotentialBase and fix tests

parent 222a357f
No related branches found
No related tags found
No related merge requests found
...@@ -75,16 +75,6 @@ class LayerPotentialBase(KernelComputation, KernelCacheWrapper): ...@@ -75,16 +75,6 @@ class LayerPotentialBase(KernelComputation, KernelCacheWrapper):
from pytools import single_valued from pytools import single_valued
sdr = SourceDerivativeRemover() sdr = SourceDerivativeRemover()
tdr = TargetDerivativeRemover() 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, KernelComputation.__init__(self, ctx=ctx, target_kernels=target_kernels,
strength_usage=strength_usage, source_kernels=source_kernels, strength_usage=strength_usage, source_kernels=source_kernels,
......
...@@ -109,24 +109,28 @@ def test_qbx_direct(ctx_factory, factor, lpot_id): ...@@ -109,24 +109,28 @@ def test_qbx_direct(ctx_factory, factor, lpot_id):
from sumpy.kernel import LaplaceKernel, DirectionalSourceDerivative from sumpy.kernel import LaplaceKernel, DirectionalSourceDerivative
if lpot_id == 1: if lpot_id == 1:
knl = LaplaceKernel(ndim) base_knl = LaplaceKernel(ndim)
knl = base_knl
elif lpot_id == 2: elif lpot_id == 2:
knl = LaplaceKernel(ndim) base_knl = LaplaceKernel(ndim)
knl = DirectionalSourceDerivative(knl, dir_vec_name="dsource_vec") knl = DirectionalSourceDerivative(base_knl, dir_vec_name="dsource_vec")
else: else:
raise ValueError("unknow lpot_id") raise ValueError("unknow lpot_id")
from sumpy.expansion.local import LineTaylorLocalExpansion from sumpy.expansion.local import LineTaylorLocalExpansion
lknl = LineTaylorLocalExpansion(knl, order) expn = LineTaylorLocalExpansion(knl, order)
from sumpy.qbx import LayerPotential 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 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 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]: for n in [200, 300, 400]:
targets, sources, centers, expansion_radii, sigma = \ targets, sources, centers, expansion_radii, sigma = \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment