Draft
Conversation
…ipole_expand/local_expand) Agent-Logs-Url: https://github.com/inducer/sumpy/sessions/624fb3c8-77e4-43be-b63c-79e9d59b3b8b Co-authored-by: inducer <352067+inducer@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Port test_p2e2p to use the expansion toys
Port Apr 27, 2026
test_p2e2p to use expansion toys
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.
test_p2e2pwas written against the low-levelP2EFromSingleBox/E2PFromSingleBox/P2PAPI with manual box index arrays. The expansion toys module (sumpy.toys) provides a cleaner abstraction for exactly this kind of test, as already used intest_translationsandtest_toy_p2e2e2p.Changes
Replaced low-level kernel calls with
t.ToyContext,t.PointSources,t.multipole_expand/t.local_expand, and.eval(). All manual box management arrays (source_boxes,box_source_starts,box_source_counts_nonchild, etc.) are removed — handled internally by the toys layer.Split
extra_kwargs→extra_source_kwargs+extra_kernel_kwargsas required byToyContext(kernel parameters likekneed to reach both P2E and E2P).Moved expansion construction outside the h-loop — the center and sources are fixed across h-values; only evaluation targets change. The expansion is computed once and reused.
Dropped the
AxisTargetDerivativegradient test — target derivatives require a separate kernel evaluation and don't fit the one-kernel-at-a-time toys API. The h-convergence check for the primary potential is preserved in full.Removed unused
obj_arrayimport (was only needed foractx.from_numpy(obj_array.new_1d(fp.points)), now handled inside_e2p).