Skip to content

Allow editing cell geometry definition#945

Open
digvijay-y wants to merge 32 commits into
idaholab:developfrom
digvijay-y:geometry-editing
Open

Allow editing cell geometry definition#945
digvijay-y wants to merge 32 commits into
idaholab:developfrom
digvijay-y:geometry-editing

Conversation

@digvijay-y

@digvijay-y digvijay-y commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator

Pull Request Checklist for MontePy

Description

  • Add iter to HalfSpace and unit Halfspace
  • Add replace() to HalfSpace
  • Add _replace_recursive() to both classes
  • Add TestCases

Fixes #737


General Checklist

  • I have performed a self-review of my own code.
  • The code follows the standards outlined in the development documentation.
  • I have formatted my code with black version 25 or 26.
  • I have added tests that prove my fix is effective or that my feature works (if applicable).

LLM Disclosure

  1. Are you?

    • A human user
    • A large language model (LLM), including ones acting on behalf of a human
  2. Were any large language models (LLM or "AI") used in to generate any of this code?

  • Yes
    • Model(s) used: Claude sonnet 4.5 (anthropic) - Built Test cases.
  • No

Documentation Checklist

  • I have documented all added classes and methods.
  • For infrastructure updates, I have updated the developer's guide.
  • For significant new features, I have added a section to the getting started guide.

First-Time Contributor Checklist

  • If this is your first contribution, add yourself to pyproject.toml if you wish to do so.

Additional Notes for Reviewers

Ensure that:

  • This PR fully addresses and resolves the referenced issue(s).
  • The submitted code is consistent with the merge checklist outlined here.
  • The PR covers all relevant aspects according to the development guidelines.
  • 100% coverage of the patch is achieved, or justification for a variance is given.

📚 Documentation preview 📚: https://montepy--945.org.readthedocs.build/en/945/

@digvijay-y digvijay-y added the feature request An issue that improves the user interface. label Apr 25, 2026
@digvijay-y digvijay-y marked this pull request as ready for review April 26, 2026 03:53
Copilot AI review requested due to automatic review settings April 26, 2026 03:53
@digvijay-y digvijay-y self-assigned this Apr 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 swap Surface/Cell dividers throughout a geometry tree.
  • Added __iter__ to HalfSpace and UnitHalfSpace for 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.

Comment thread montepy/surfaces/half_space.py Outdated
Comment thread doc/source/changelog.rst
Comment thread doc/source/changelog.rst Outdated
Comment thread montepy/surfaces/half_space.py Outdated
Copilot AI review requested due to automatic review settings April 26, 2026 04:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Comment thread montepy/surfaces/half_space.py
Comment thread doc/source/changelog.rst Outdated
Comment thread montepy/surfaces/half_space.py
Comment thread montepy/surfaces/half_space.py
Copilot AI review requested due to automatic review settings April 26, 2026 04:05
@digvijay-y digvijay-y requested review from MicahGale and removed request for Copilot April 26, 2026 04:06
@MicahGale

Copy link
Copy Markdown
Collaborator

@digvijay-y thanks for doing this. It will be a few days before I will be able to review this.

Copilot AI review requested due to automatic review settings May 8, 2026 21:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

@MicahGale MicahGale left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again @digvijay-y.

A few thoughts:

  1. This is a good first implementation, just some slight improvements can be made.
  2. 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
  1. Could you review the self-check of your code?

Comment thread demo/answers/1_fusion_radial_build.ipynb
Comment thread montepy/surfaces/half_space.py
Comment thread montepy/surfaces/half_space.py Outdated
Comment thread montepy/surfaces/half_space.py Outdated
Comment thread montepy/surfaces/half_space.py
Comment thread tests/test_geometry.py Outdated
Comment thread montepy/surfaces/half_space.py
Comment thread tests/test_geometry.py Outdated
Comment thread tests/test_geometry.py Outdated
Comment thread tests/test_geometry.py
Comment thread doc/source/changelog.rst
Copilot AI review requested due to automatic review settings May 20, 2026 17:05
@digvijay-y digvijay-y requested review from Copilot and removed request for Copilot May 20, 2026 17:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Comment thread montepy/surfaces/half_space.py Outdated
Comment thread tests/test_geometry.py
Copilot AI review requested due to automatic review settings May 23, 2026 15:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread montepy/surfaces/half_space.py
Copilot AI review requested due to automatic review settings May 23, 2026 15:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread montepy/surfaces/half_space.py
@digvijay-y digvijay-y requested a review from MicahGale May 23, 2026 15:30
digvijay-y and others added 24 commits June 14, 2026 16:59
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>
@digvijay-y digvijay-y requested a review from MicahGale June 17, 2026 05:17

@MicahGale MicahGale left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread doc/source/changelog.rst
* ``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`).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is redundant from the features added above, also this should have been :pull not :issue:

Comment thread doc/source/changelog.rst

1.3 releases
============

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't delete this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request An issue that improves the user interface.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow editing cell geometry definition

3 participants