[Core] Fix C++20-only compatibility issue in VtuOutput endianness detection#14326
Open
loumalouomega wants to merge 5 commits intomasterfrom
Open
[Core] Fix C++20-only compatibility issue in VtuOutput endianness detection#14326loumalouomega wants to merge 5 commits intomasterfrom
VtuOutput endianness detection#14326loumalouomega wants to merge 5 commits intomasterfrom
Conversation
Member
|
this is used in cosimio, its independent of the standards version: Not sure if its better though |
…and C++20 compatibility
vtu_output.cpp for C++17 compatibilityVtuOutput endianness detection
…() and <cstdint> include
Member
|
ok, i thought we are fully in cpp20. Thats the reason I added it there... aparently we are not yet there :/ |
Member
Author
Well, I thought we were, but GCC 11 is right now our limit, so we can just use some minor C++20 functions |
Member
Author
|
Ok, looks like is fixed |
Member
Author
|
@sunethwarna this is fixed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
This PR addresses a compatibility issue in the VTU output module related to endianness detection, ensuring that the code works correctly with C++17. The changes update the logic in
kratos/input_output/vtu_output.cppto avoid using C++20-only features, restoring compatibility with C++17 compilers.(Devtools 11 in Rocky Linux does not fully supports C++20).
@roigcarlo we should revert devtools to version 11 in CI.
What is changed?
constexpr bool IsBigEndian()helper that uses a well-knownunion-based type-punning trick (reference) to detect endianness at compile time without any compiler-version guards or C++20 features.GetEndianness()with a single ternary delegating toIsBigEndian(), making the function C++17-compatible and compiler-agnostic.Why?
Validation
kratos/tests/test_vtu_output.py,kratos/mpi/future/tests/test_mpi_vtu_output.py) pass without modification.🆕 Changelog
Files changed
kratos/input_output/vtu_output.cppCommits