feat: add transplanted 1D quadrature maps, docs, tests#159
feat: add transplanted 1D quadrature maps, docs, tests#159inducer merged 22 commits intoinducer:mainfrom
Conversation
|
Thanks! Could you look at those linter failures? The biggest one is probably adding types. |
|
(I can help if there's an issue.) |
|
cc @ShawnL00 |
There was a problem hiding this comment.
Pull request overview
Adds transplanted 1D quadrature rules/maps (Hale–Trefethen and Kosloff–Tal-Ezer) to modepy, with accompanying docs, tests, and a QBX comparison example.
Changes:
- Introduces
modepy.quadrature.transplantedwith transplant maps, a dispatcher, and transplanted quadrature classes. - Exports transplanted quadrature classes through package init modules (
modepy.quadratureand top-levelmodepy). - Adds docs + tests for map dispatch/validation and includes a 2D QBX comparison example script.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
modepy/quadrature/transplanted.py |
New transplanted-map implementations and transplanted quadrature classes. |
modepy/quadrature/__init__.py |
Re-exports transplanted quadrature classes from the quadrature package. |
modepy/__init__.py |
Exposes transplanted quadrature classes at the top-level modepy API. |
modepy/test/test_quadrature.py |
Adds unit tests for transplanted quadrature mapping/validation behavior. |
examples/plot-qbx-transplanted-vs-gauss.py |
New QBX comparison example for Gauss vs transplanted rules. |
doc/quadrature.rst |
Adds documentation section describing transplanted quadrature usage and references. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| OUT = "/tmp/qbx-transplanted-vs-gauss-2d.png" | ||
|
|
There was a problem hiding this comment.
The example writes output to a hard-coded /tmp/... path, which will fail on non-POSIX platforms (e.g. Windows) and can be surprising for users.
Consider using tempfile.gettempdir()/pathlib.Path, saving relative to the current working directory, or making the output path a CLI argument.
alexfikl
left a comment
There was a problem hiding this comment.
Very nifty! 😁
I took a quick look and left some nitpicks and questions.
inducer
left a comment
There was a problem hiding this comment.
Thanks for making this! Pretty close, just a few small wrinkles.
8988606 to
250c95c
Compare
250c95c to
c02d6be
Compare
|
I've addressed the review feedback. LGTM now. @alexfikl? |
alexfikl
left a comment
There was a problem hiding this comment.
Left a bunch of nitpicks in the docs and the example, but otherwise looks good to me too 😁
Co-authored-by: Alex Fikl <alexfikl@gmail.com> Co-authored-by: Andreas Klöckner <inform@tiker.net>
Summary
This PR adds transplanted 1D quadrature support to
modepyusing Hale–Trefethen/Kosloff–Tal-Ezer style maps, with docs and tests.modepy/quadrature/transplanted.pymap_identitymap_sausagemap_kosloff_tal_ezer(kte/kosloff_tal_ezer)map_stripmap_trefethen_transplanttransplanted_1d_quadraturetransplanted_legendre_gauss_quadraturemodepy.__init__.doc/quadrature.rstwith map-specific guidance and references.modepy/test/test_quadrature.py(map consistency, strip endpoint rejection, KTE validation, sausage degree checks).What for
These quadrature rules are good at integrating QBX coefficients:
API Notes
map_name="sausage"withsausage_degree=<odd int>map_name="sausage_d{odd}"Transplanted*class API introduced).exact_tois preserved for identity-preserving mappings (identity and sausage degree 1), and unset otherwise.Documentation Updates
w_i^{(s)}vs mapped weights).doc/quadrature.rst.Validation
ruff checkbasedpyrightpytest modepy/test/test_quadrature.py -k transplanted