Skip to content

Conversation

@ecoon
Copy link

@ecoon ecoon commented Oct 2, 2025

Note that your contribution guidelines suggest this will get pre-populated with info, but that is not working correctly.

This is a small addition to the exodus3.in.py wrapper to support generic addition of sets to exo files via python. This calls the "generic" exodus API of:

ex_put_set_param()
ex_put_name()
ex_put_set()

whereas the current implementation only uses the "node" or "sideset" specific API (e.g. ex_put_node_set()) which is deprecated according to the Exodus source. It would be trivial to remove or update the node- or side-set based versions to use only non-deprecated code, but that is not done here -- this only adds new functions. I'm happy to do that as well if you would like.

Note that corresponding get_* methods are also added.

This also only touches the python3 wrappers, not the python2 wrappers. Are you still supporting python2?

@ecoon
Copy link
Author

ecoon commented Oct 6, 2025

@gsjaardema hey Greg -- is this the right place for this? Not sure if anyone is watching here.

@gsjaardema
Copy link
Member

@ecoon Yes, this is the right place. I was on vacation the day you posted and just got back. Will look at it hopefully today.

Copy link
Member

@gsjaardema gsjaardema left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks for doing this. There are a couple comments.

Not sure of best path forward for the EX_SIDE_SET . Maybe for now just error out in that case and we fix it later.

Only mandatory change would be the addition of None

set_inds = (ctypes.c_longlong * num_indices)()
else:
set_inds = (ctypes.c_int * num_indices)()
EXODUS_LIB.ex_get_set(self.fileId, obj_type, set_id, ctypes.byref(set_inds))
Copy link
Member

Choose a reason for hiding this comment

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

I think this needs an extra parameter None at the end to take care of the set_extra_list. For a sideset, this holds the local_face part of the side definition.

Copy link
Author

@ecoon ecoon Oct 8, 2025

Choose a reason for hiding this comment

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

Yes, otherwise we get a warning (but it works) -- I fixed this in the Amanzi patch but I guess not here. Will fix.


# --------------------------------------------------------------------

def get_set_indices(self, object_type, object_id):
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this will work for EX_SIDE_SET since the indices for that are a pair of element and local_face_number. Similarly for theput_set_indices

We can maybe add a test for object_type == EX_SIDE_SET and

Copy link
Author

Choose a reason for hiding this comment

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

That's right. This function should either error or have a more generic API (equivalent to get_side_set()'s current implementation) in the case of EX_SIDE_SET.

@ecoon
Copy link
Author

ecoon commented Oct 8, 2025

In general @gsjaardema do you have a preference of:

  1. leave the old API e.g. get_side_set(), get_node_set() alongside this more generic API get_set_indices()
  2. remove the old API

Either way I'll fix the new generic API to work for EX_SIDE_SET as well.

@gsjaardema
Copy link
Member

In general @gsjaardema do you have a preference of:

  1. leave the old API e.g. get_side_set(), get_node_set() alongside this more generic API get_set_indices()
  2. remove the old API

Either way I'll fix the new generic API to work for EX_SIDE_SET as well.

We need to leave the old API in case people are using it. I don't want to break existing uses...

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