-
-
Notifications
You must be signed in to change notification settings - Fork 186
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
Make read_meshtags a template function #3533
base: main
Are you sure you want to change the base?
Make read_meshtags a template function #3533
Conversation
read_meshtags(const mesh::Mesh<double>& mesh, std::string name, | ||
std::optional<std::string> attribute_name, | ||
std::string xpath = "/Xdmf/Domain"); | ||
template <typename T = std::int32_t> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What types are supported? If the type in the file can't be checked it can lead to all sorts of crashes and mis-behaviours.
What is needed for this to be robust is a function for querying the data type in the file. I started this ages ago for HDF5 files, but it wasn't trivial to make it precise, but getting the type size was easy and may be adequate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We hit the same issue with the recent checkpointing project. We should have a chat in #developmemt about the best ways to tackle this.
This PR leverages functionalities introduced some time ago by @jorgensd that makes
xdmf_utils::distribute_entity_data
process data of a generic type, not onlystd::int32_t
. In this PR I makeXDMFFile::read_meshtags
a template so that we can read mesh tags of any type [esp.double
] from file. This will be useful in an upcoming PR to read functions from file.