FEniCS / FEniCS/dolfinx

[Bug]: Wrong integer type in dolfinx::geometry::impl::is_leaf

Closed Beginner friendly
#4,451 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.2k
Forks
261
Avg merge
1d 19h
Merged PRs (30d)
71

Description

Hi,

I think the argument type of `bbox` in the function `dolfinx::geometry::impl::is_leaf`:

https://github.com/FEniCS/dolfinx/blob/5c1c561ff2eee35f081b63bc5a17d85f64bd50cf/cpp/dolfinx/geometry/utils.h#L187-L192

should be `std::array` instead of `std::array` corresponding to the return type of `dolfinx::geometry::BoundingBoxTree::bbox`:

https://github.com/FEniCS/dolfinx/blob/5c1c561ff2eee35f081b63bc5a17d85f64bd50cf/cpp/dolfinx/geometry/BoundingBoxTree.h#L400-L411

I think most compilers did not care about this issue since their types `int` and `std::int32_t` are the same, but in general there's no guarantee for that.
Furthermore, wouldn't it be better making `is_leaf` a (static) function of the class `dolfinx::geometry::BoundingBoxTree`?

Contributor guide

Open the contributing guide

Research direction

Start with cpp/dolfinx/geometry/utils.h around is_leaf and compare its bbox argument with the return type of BoundingBoxTree::bbox in cpp/dolfinx/geometry/BoundingBoxTree.h. Confirm the integer types are consistent, then review whether moving is_leaf into BoundingBoxTree is within scope; the change is done when the API types agree and the relevant geometry code still builds and tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend-api-design
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.