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

Make read_meshtags a template function #3533

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

mleoni-pf
Copy link
Contributor

This PR leverages functionalities introduced some time ago by @jorgensd that makes xdmf_utils::distribute_entity_data process data of a generic type, not only std::int32_t. In this PR I make XDMFFile::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.

@mleoni-pf mleoni-pf changed the title Mleoni/make read meshtags a template function Make read meshtags a template function Nov 25, 2024
@mleoni-pf mleoni-pf changed the title Make read meshtags a template function Make read_meshtags a template function Nov 25, 2024
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>
Copy link
Member

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.

Copy link
Member

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.

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.

3 participants