-
-
Notifications
You must be signed in to change notification settings - Fork 228
Write cg1 and dg0 functions to VTKHDF #4025
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
base: main
Are you sure you want to change the base?
Write cg1 and dg0 functions to VTKHDF #4025
Conversation
cpp/dolfinx/io/VTKHDF.h
Outdated
| /// @note Limited support for floating point types at present (no | ||
| /// complex number support). | ||
| template <std::floating_point U> | ||
| void write_CG1_function(std::string filename, const mesh::Mesh<U>& mesh, |
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.
The decision to split up into different functions depending on function space looks problematic, it will not scale. A generic write_function would be favourable.
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.
I was inspired by the Python interface having separate "write point data" and "write cell data" but I realize that that's not quite the same... I agree that a generic write_function would be better but I am not knowledgeable enough on the VTKHDF format to know how to write mixed or exotic elements...
An API-saving option could be to error out for unsupported function spaces; another one, used somewhere else in the repo though unsatisfactory, could be to interpolate whatever function is passed to CG1 or DG0 before saving. What are your thoughts?
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.
I think supporting subsets of elements is fine. Good to add tests, which check for a proper assertion being raised on such invocations.
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.
I think in this case, raise an exception for unsupported function spaces.
|
This PR makes implicit assumptions about the dofmap for P1 and DG0 functions (i.e. that they are simply the same as the geometry). |
I'm interested in learning how to relax that assumption, if you can point me to whatever functions we have to map the geometry dofmap into the P1 and DG0 dofmaps. As far as tests are concerned, I didn't know how to write a test for a writing without being able to read back but in #4027 I added a test that includes a full write-read-compare cycle. |
|
Have a look at |
a0ee385 to
222bb1e
Compare
This PR introduces two convenience functions to write CG1 and DG0 functions to VTKHDF.