Skip to content

Make it Possible to have sparse fill matrices #695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 29 commits into
base: develop
Choose a base branch
from

Conversation

MicahGale
Copy link
Collaborator

@MicahGale MicahGale commented Mar 14, 2025

Pull Request Checklist for MontePy

Description

This fixes a bug where sparse fill matrices can't be parsed. The MCNP manual does allow for fill sparsity in the multiple universe fill system at the end. This handles this case by padding the list with effective "jumps", and then defaulting those to universe 0 (per the manual).

At first all the fill universe data was one long list. I was doing a lot of janky things to edit just the middle of the list, etc. I realized though: this is a small grammar. So I actually added a syntax tree that splits this into indices (the 0:1 section for multi-universe), universes, and transform. This greatly simplified the code and increased legibility.

Fixes #601


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.
  • I have added tests that prove my fix is effective or that my feature works (if applicable).

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:

  • 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--695.org.readthedocs.build/en/695/

@MicahGale MicahGale linked an issue Mar 14, 2025 that may be closed by this pull request
@MicahGale MicahGale marked this pull request as draft March 14, 2025 22:24
@MicahGale MicahGale added bugs A deviation from expected behavior that does not reach the level of being reportable as an "Error". parsers are hard Examples of where MCNP syntax is complicated and should be simplified. labels Mar 14, 2025
@MicahGale MicahGale self-assigned this Mar 14, 2025
@MicahGale MicahGale requested a review from tjlaboss March 14, 2025 22:44
@MicahGale
Copy link
Collaborator Author

This is paused while I figure out how to handle partial matrices.

@MicahGale MicahGale changed the title Make syntax error with fill more useful Make it Possible to have sparse fill matrices Apr 10, 2025
@MicahGale
Copy link
Collaborator Author

MicahGale commented Jul 10, 2025

  • Add this to the hypothesis tests in tests/test_universe_integration.py

@MicahGale MicahGale marked this pull request as ready for review July 10, 2025 14:14
@MicahGale
Copy link
Collaborator Author

MicahGale commented Jul 10, 2025

Ok this time it is ready @tjlaboss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugs A deviation from expected behavior that does not reach the level of being reportable as an "Error". low priority parsers are hard Examples of where MCNP syntax is complicated and should be simplified.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Uncaught iterator error in Fill
1 participant