Return geometry by value (alternative 4) - #1055
Open
SoilRos wants to merge 3 commits into
Open
Conversation
This change switches the `LocalGeometry` type and the return type of `geometryInFather()` to `Dune::AxisAlignedCubeGeometry`. This simplifies the implementation of `geometryInFather()` and leverages a standard Dune geometry type for axis-aligned refined cells. The local geometry is a mapping from one cube reference element to another cube reference element. For this, there is no need to store all corners, just the upper-left and lower-bottom corners.
This is to conform with the dune interface
The `Geometry` class previously used `std::shared_ptr` to manage its corner geometry data. This commit changes the `allcorners_` member to a raw pointer, making `Geometry` a non-owning view of this data. This refactoring aligns with the goal of `Geometry` objects being lightweight value types, enabling them to be returned by value more efficiently and consistently with the Dune interface. A warning has been added to the constructor to explicitly state these new ownership semantics.
Member
Author
|
jenkins build this serial please |
Member
Author
|
benchmark please |
|
Benchmark result overview:
View result details @ https://www.ytelses.com/opm/?page=result&id=3163 |
Member
Author
|
The table above seems wrong, the actual table reported in the website is:
|
Member
Author
This was referenced Jul 31, 2026
Member
|
Just a question: how can Dune::AxisAlignedCubeGeometry be used, our grid cells are not axis aligned (except for artificial test cases)? |
Member
Author
|
@atgeirr |
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.

This is yet another version of how to return the geometry by value (see #885, #884, #891, and #334). Compared to the others, this should be the fastest one. The trick is made by not sharing the ownership of the corners, just a non-owning pointer. Additionally, since the
geometryInFatherneeds to store its own data, I simply changed its type forDune::AxisAlignedCubeGeometrywhich does the same job, but faster.