Skip to content

Improvement: Better handling of hashes and errors in t8_geometry [2/2]#1656

Merged
sandro-elsweijer merged 23 commits intomainfrom
feature-geometry_improved_hashes
Jun 16, 2025
Merged

Improvement: Better handling of hashes and errors in t8_geometry [2/2]#1656
sandro-elsweijer merged 23 commits intomainfrom
feature-geometry_improved_hashes

Conversation

@holke
Copy link
Collaborator

@holke holke commented May 16, 2025

Closes #1657
Requires merging of #1662 first.

Describe your changes here:

I stumbled on this while testing something else and noticed that if a tree has no geometry, but we query for it (for example when trying to print VTK), we run into a segfault.
While working on this i noticed that the handling of hash values of geometries should be improved.

  • Added new header that defines hash handling functions.
  • New strong data type for hashes (a strong type version of size_t)
  • Definition of empty hash, that is a hash for the string "" which we do not allow as name of a geometry and use as hash for a non-existing geometry
  • definition of INVALID geometry
  • proper error handling when no geometry is registered but asked for. In that case the functions return nullptr
  • proper handling of cmesh vtk output not reading vertex coordinates
    • Error message and not writing the file for cmesh ASCII output
    • Error message and abort for writing cmesh VTK API output
  • Added a test with a cmesh with no geometry to check that nullptr is returned.

All these boxes must be checked by the AUTHOR before requesting review:

  • The PR is small enough to be reviewed easily. If not, consider splitting up the changes in multiple PRs.
  • The title starts with one of the following prefixes: Documentation:, Bugfix:, Feature:, Improvement: or Other:.
  • If the PR is related to an issue, make sure to link it.
  • The author made sure that, as a reviewer, he/she would check all boxes below.

All these boxes must be checked by the REVIEWERS before merging the pull request:

As a reviewer please read through all the code lines and make sure that the code is fully understood, bug free, well-documented and well-structured.

General

  • The reviewer executed the new code features at least once and checked the results manually.
  • The code follows the t8code coding guidelines.
  • New source/header files are properly added to the CMake files.
  • The code is well documented. In particular, all function declarations, structs/classes and their members have a proper doxygen documentation.
  • All new algorithms and data structures are sufficiently optimal in terms of memory and runtime (If this should be merged, but there is still potential for optimization, create a new issue).

Tests

  • The code is covered in an existing or new test case using Google Test.
  • Valgrind doesn't find any bugs in the new code. This script can be used to check for errors; see also this wiki article.

If the Pull request introduces code that is not covered by the github action (for example coupling with a new library):

  • Should this use case be added to the github action?
  • If not, does the specific use case compile and all tests pass (check manually).

Scripts and Wiki

  • If a new directory with source files is added, it must be covered by the script/find_all_source_files.scp to check the indentation of these files.
  • If this PR introduces a new feature, it must be covered in an example or tutorial and a Wiki article.

License

  • The author added a BSD statement to doc/ (or already has one).

@holke holke added enhancement Enhances already existing code workload:low Would take half a day or less labels May 16, 2025
@holke holke marked this pull request as draft May 16, 2025 12:46
@holke holke force-pushed the feature-geometry_improved_hashes branch from 37fa64b to 3b426ad Compare May 19, 2025 20:17
@holke holke mentioned this pull request May 19, 2025
16 tasks
@holke holke changed the title Improvement: Better handling of hashes and errors in t8_geometry Improvement: Better handling of hashes and errors in t8_geometry [2/2] May 19, 2025
holke and others added 2 commits May 22, 2025 17:32
Co-authored-by: David Knapp <david.knapp@dlr.de>
@holke holke marked this pull request as ready for review May 22, 2025 15:52
@holke holke requested a review from sandro-elsweijer May 22, 2025 15:52
@holke holke assigned sandro-elsweijer and unassigned holke May 23, 2025
@sandro-elsweijer sandro-elsweijer linked an issue May 26, 2025 that may be closed by this pull request
@sandro-elsweijer sandro-elsweijer added this pull request to the merge queue Jun 16, 2025
Merged via the queue into main with commit 357a914 Jun 16, 2025
22 checks passed
@sandro-elsweijer sandro-elsweijer deleted the feature-geometry_improved_hashes branch June 16, 2025 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Enhances already existing code workload:low Would take half a day or less

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improvement: Better handling of hashes and errors in t8_geometry Scheme builder tutorial bug

3 participants