Skip to content

Commit

Permalink
use the full double-layer in source-proxy skeletonization
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfikl committed Sep 22, 2022
1 parent 8b17002 commit 7d5bb22
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
8 changes: 6 additions & 2 deletions pytential/linalg/direct_solver_symbolic.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,16 @@ def prepare_expr(places, exprs, auto_where=None):
return _prepare_expr(places, exprs, auto_where=auto_where)


def prepare_proxy_expr(places, exprs, auto_where=None):
def prepare_proxy_expr(
places, exprs,
auto_where=None,
remove_transforms: bool = True):
def _prepare_expr(expr):
# remove all diagonal / non-operator terms in the expression
expr = IntGTermCollector()(expr)
# ensure all IntGs remove all the kernel derivatives
expr = KernelTransformationRemover()(expr)
if remove_transforms:
expr = KernelTransformationRemover()(expr)
# ensure all IntGs have their source and targets set
expr = DOFDescriptorReplacer(auto_where[0], auto_where[1])(expr)

Expand Down
6 changes: 4 additions & 2 deletions pytential/linalg/skeletonization.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,11 @@ def make_skeletonization_wrangler(

exprs = prepare_expr(places, exprs, auto_where)
source_proxy_exprs = prepare_proxy_expr(
places, exprs, (auto_where[0], PROXY_SKELETONIZATION_TARGET))
places, exprs, (auto_where[0], PROXY_SKELETONIZATION_TARGET),
remove_transforms=True)
target_proxy_exprs = prepare_proxy_expr(
places, exprs, (PROXY_SKELETONIZATION_SOURCE, auto_where[1]))
places, exprs, (PROXY_SKELETONIZATION_SOURCE, auto_where[1]),
remove_transforms=True)

# }}}

Expand Down
9 changes: 3 additions & 6 deletions pytential/symbolic/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,6 @@ def map_int_g(self, expr):
expr.target.geometry, expr.target.discr_stage)

actx = self.array_context
target_base_kernel = expr.target_kernel.get_base_kernel()

result = 0
for kernel, density in zip(expr.source_kernels, expr.densities):
Expand All @@ -672,12 +671,10 @@ def map_int_g(self, expr):

# {{{ generator

base_kernel = kernel.get_base_kernel()

from sumpy.p2p import P2PMatrixSubsetGenerator
mat_gen = P2PMatrixSubsetGenerator(actx.context,
source_kernels=(base_kernel,),
target_kernels=(target_base_kernel,),
source_kernels=(kernel,),
target_kernels=(expr.target_kernel,),
exclude_self=self.exclude_self)

# }}}
Expand All @@ -687,7 +684,7 @@ def map_int_g(self, expr):
# {{{ kernel args

# NOTE: copied from pytential.symbolic.primitives.IntG
kernel_args = base_kernel.get_args() + base_kernel.get_source_args()
kernel_args = kernel.get_args() + kernel.get_source_args()
kernel_args = {arg.loopy_arg.name for arg in kernel_args}

kernel_args = _get_layer_potential_args(
Expand Down

0 comments on commit 7d5bb22

Please sign in to comment.