Add a SystemKernel wrapper#287
Open
alexfikl wants to merge 5 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the kernel type hierarchy by splitting the previous Kernel concept into a ScalarKernel (codegen-capable scalar kernels) and a new, more barebones SystemKernel API for vector/tensor-valued PDE kernels (e.g. Stokes/Brinkman/Elasticity), while deprecating sumpy.kernel.Kernel.
Changes:
- Renames most type usage/imports from
KerneltoScalarKernelacross FMM/expansion/tooling and tests. - Introduces
GenericKernel,SystemKernel, andExpressionSystemKernel, and implements several concrete*SystemKernelPDE kernels. - Adds tests validating
SystemKernelcomponent structure and pickling behavior.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
sumpy/toys.py |
Updates toy context typing/imports to ScalarKernel. |
sumpy/tools.py |
Switches KernelLike and computation typing/docs to ScalarKernel. |
sumpy/test/test_target_deriv.py |
Updates test typing/imports to ScalarKernel. |
sumpy/test/test_misc.py |
Adds SystemKernel tests and updates kernel typing to ScalarKernel. |
sumpy/test/test_m2m_coeffs.py |
Updates test typing/imports to ScalarKernel. |
sumpy/test/test_l2l_coeffs.py |
Updates test typing/imports to ScalarKernel. |
sumpy/test/test_kernels.py |
Updates test typing/imports to ScalarKernel. |
sumpy/test/test_fmm.py |
Updates test typing/imports to ScalarKernel. |
sumpy/p2p.py |
Updates docstrings to reference ScalarKernel. |
sumpy/kernel.py |
Introduces new kernel interfaces + concrete *SystemKernel implementations and deprecates Kernel. |
sumpy/fmm.py |
Updates FMM typing/imports to ScalarKernel. |
sumpy/expansion/multipole.py |
Updates expansion interfaces typing to ScalarKernel. |
sumpy/expansion/m2l.py |
Updates M2L factory typing to ScalarKernel. |
sumpy/expansion/loopy.py |
Updates loopy kernel builders typing to ScalarKernel. |
sumpy/expansion/local.py |
Updates local expansion typing to ScalarKernel. |
sumpy/expansion/level_to_order.py |
Updates level-to-order typing to ScalarKernel. |
sumpy/expansion/__init__.py |
Updates expansion base interfaces typing to ScalarKernel. |
.basedpyright/baseline.json |
Updates the basedpyright baseline to match new typing outcomes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
inducer
reviewed
Jun 12, 2026
|
|
||
|
|
||
| @dataclass(frozen=True, repr=False) | ||
| class ScalarKernel(GenericKernel, ABC): |
Owner
There was a problem hiding this comment.
sudo get-me-a-system-kernel-and-index -f
|
|
||
| for i in range(dim): | ||
| for j in range(i, dim): | ||
| components[i, j] = components[j, i] = ElasticityKernel( |
Owner
There was a problem hiding this comment.
- Deprecate
ElasticityKernel. - Rename to
ElasticityComponentKernel.
?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is very drafty at the moment.
However, the point is to:
KerneltoScalarKernelSystemKernelfor things like Stokes. Currently, theSystemKernelis intentionally more barebones than aScalarKernelbecause it cannot (and maybe will not?) be used for codegen.SystemKernel.