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

Adding a method to delete sets #8

Merged
merged 1 commit into from
Feb 12, 2024
Merged

Adding a method to delete sets #8

merged 1 commit into from
Feb 12, 2024

Conversation

pshriwise
Copy link
Member

This should of course be used wisely, but it makes sense to be able to remove sets. For instance, one might want to replace group assignments entirely. This would make it easier to do so.

Copy link
Member

@gonuke gonuke left a comment

Choose a reason for hiding this comment

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

LGTM @pshriwise

@pshriwise pshriwise merged commit 79dcc62 into main Feb 12, 2024
1 check passed
Copy link
Member

@gonuke gonuke left a comment

Choose a reason for hiding this comment

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

Just found something to ask about?

@@ -279,6 +279,11 @@ def get_triangle_coordinate_mapping(self, compress=False):
tri_map = {eh: c for eh, c in zip(triangle_handles, conn)}
return tri_map, coords

def delete(self):
"""Delete this group from the DAGMC file."""
self.model.mb.delete_entity(self.handle)
Copy link
Member

Choose a reason for hiding this comment

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

Should we delete the entry in model.groups?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, sorry for the quick-merge! I think we're okay here though as the dict returned by the model.groups property is generated on-the-fly, so the next time it's accessed the groups should reflect those currently in the model.

Previous dict's generated by this property will become stale after a group is deleted, but that will have to be up to the user to track I'm afraid.

Copy link
Member

Choose a reason for hiding this comment

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

The quick-merge is only enabled by my too superficial review :) - no worries here, then.

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.

2 participants