Allow editing cell geometry definition#945
Conversation
There was a problem hiding this comment.
Pull request overview
Adds user-facing utilities to traverse and edit a cell’s CSG geometry tree, addressing #737 by enabling divider replacement and leaf iteration.
Changes:
- Added
HalfSpace.replace()/_replace_recursive()to swapSurface/Celldividers throughout a geometry tree. - Added
__iter__toHalfSpaceandUnitHalfSpacefor depth-first leaf traversal. - Added unit tests plus minor documentation/demo formatting updates.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
montepy/surfaces/half_space.py |
Implements replace() and iteration over geometry leaves; adjusts duplicate-surface remapping logic. |
tests/test_geometry.py |
Adds test coverage for replace() and __iter__. |
doc/source/changelog.rst |
Documents the new feature (but currently has RST formatting issues). |
doc/source/conf.py |
Removes trailing whitespace in nitpick_ignore. |
demo/_config.py |
Minor formatting (blank line). |
demo/1_fusion_radial_build.ipynb |
Minor formatting fix (newline). |
demo/answers/1_fusion_radial_build.ipynb |
Formatting cleanup in example code cells. |
|
@digvijay-y thanks for doing this. It will be a few days before I will be able to review this. |
MicahGale
left a comment
There was a problem hiding this comment.
Thanks again @digvijay-y.
A few thoughts:
- This is a good first implementation, just some slight improvements can be made.
- I messed up the GHA so coveralls doesn't run. There is some uncovered code. Could you check if these were your changes?
montepy/surfaces/half_space.py 366 4 98.91% 208, 429, 473, 484
- Could you review the self-check of your code?
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Fix conf.py: remove accidentally embedded terminal output, wire up schema_org extension with sys.path, extensions list, and configs - Add SoftwareApplication JSON-LD to index page and FAQPage JSON-LD to faq page; move injection to <head> via extrahead block - Add meta descriptions to all user-facing RST pages; fix typo and trim starting.rst description to under 155 chars - Add sphinx-sitemap for per-page sitemap coverage; set sitemap_url_scheme to suppress version/lang prefix; use READTHEDOCS_CANONICAL_URL for html_baseurl - Update robots.txt: fix inline comment, block /en/v prefix for all versioned releases, add stable sitemap URL Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… in divider setter
9a91d35 to
9463cb3
Compare
MicahGale
left a comment
There was a problem hiding this comment.
Just need to cleanup the changelog, and then we are good.
Coveralls is having issues, but it looks like the patch coverage is 100% and coverage overall is up: https://coveralls.io/jobs/183386951. Thanks @digvijay-y
| * ``Cell.universe`` can now be set to ``None`` (or deleted via ``del cell.universe``) to reset the universe assignment back to the default (:issue:`902`). | ||
| * Added ``extend_renumber`` to ``NumberedObjectCollection`` with related test cases (:issue:`881`). | ||
| * Made :class:`montepy.data_inputs.importance.Importance` more ``dict``-like with ``keys``, ``values``, and ``items`` functions (:pull:`921`). | ||
| * API to Allow editing cell geometry definition (:issue:`945`). |
There was a problem hiding this comment.
This is redundant from the features added above, also this should have been :pull not :issue:
|
|
||
| 1.3 releases | ||
| ============ | ||
|
|
Pull Request Checklist for MontePy
Description
Fixes #737
General Checklist
blackversion 25 or 26.LLM Disclosure
Are you?
Were any large language models (LLM or "AI") used in to generate any of this code?
Documentation Checklist
First-Time Contributor Checklist
pyproject.tomlif you wish to do so.Additional Notes for Reviewers
Ensure that:
📚 Documentation preview 📚: https://montepy--945.org.readthedocs.build/en/945/