Skip to content
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

Support for CellInstanceFilter #88

Merged
merged 2 commits into from
Apr 28, 2022

Conversation

paulromano
Copy link
Contributor

@paulromano paulromano commented Apr 27, 2022

This PR is a quick follow-up to #87 that extends support to openmc.CellInstanceFilter as well. I've managed to do it in a way that requires very little extra code. Technically it makes the logic for distribcell plotting slightly less efficient, but I'm not sure it really matters.

Closes #86

@paulromano paulromano requested a review from pshriwise April 27, 2022 22:29
# Iterate over tally bins, setting any pixels that have matching (cell
# ID, instance) each time
for v, (cell_id, instance) in zip(data, bins):
cell_id_mask = (self.cell_ids == cell_id)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure how much of a performance hit this might be, but having this in the loop is going to cause a repeated calculation of this mask for DistribCellFilter's. The same is true for CellInstanceFilter's that contain instances of the same cell.

I suppose that since we're typically working with around 100k pixels in the image data this shouldn't be too bad. Mainly noting it here in case we run into a performance issue with these filter types in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, I'm well aware that this is performance-shitty code. But, so far on the models I've played with it doesn't seem to be a big deal. It would be easy enough to optimize if we find later on that it is causing significant lags on larger models. I can go ahead and add a comment in the code about this since I'm sure we'll probably forget.

Copy link
Collaborator

@pshriwise pshriwise left a comment

Choose a reason for hiding this comment

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

I think this looks good @paulromano! The formatting cleanup is appreciated and I like the way you were able to use the distribcell function.

@pshriwise pshriwise merged commit 01e2387 into openmc-dev:develop Apr 28, 2022
@paulromano paulromano deleted the cellinstance branch April 28, 2022 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to plot distributed cell tallies
2 participants