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

Add a category property to DAGSet #3

Merged
merged 5 commits into from
Feb 2, 2024

Conversation

paulromano
Copy link
Contributor

Short PR here adding a category property to the DAGSet class as well as adding a setter for the existing geom_dimension property.

@pshriwise
Copy link
Member

The category and geom_dimension properties of the MOAB set are intrinsic to the class type. I'm wondering if class attributes would be better in this case.

class Volume(DAGSet):

    _geom_dimension = 3
    _category = 'Volume'

    @property
    def category(self):
        return self._category
    
    @property
    def dimension(self):
        return self._geom_dimension

    @classmethod
    def create(cls, model, volume_id=None):
        new_set = model.mb.create_meshset()
        self.model.mb.tag_set_data(model.category_tag, new_set, cls._catetory)
        self.model.mb.tag_set_data(model.category_tag, new_set, cls._geom_dimension)
        if volume_id is not None:
            ...

        return cls(model new_set)
      
    ...

We could then also add some checks in the __init__ method of the Volume, Surface, etc. classes to make sure that the handle passed in the constructor is tagged correctly to represent that class type.

@paulromano
Copy link
Contributor Author

@pshriwise I just implemented your suggestion there. Right now, a mismatched geom_dimension or category will simply show a warning (note that this actually happens for groups in the fuel_pin.h5m file used in testing).

dagmc/dagnav.py Outdated Show resolved Hide resolved
Copy link
Member

@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.

One more tiny request here, but then I think this is ready to go.

dagmc/dagnav.py Show resolved Hide resolved
dagmc/dagnav.py Show resolved Hide resolved
Copy link
Member

@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.

Thanks @paulromano!

@pshriwise pshriwise merged commit 002dfc6 into svalinn:main Feb 2, 2024
1 check passed
@paulromano paulromano deleted the category-property branch February 2, 2024 04:39
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