Return geometry by value (alternative 4) - #1055
Conversation
|
jenkins build this serial please |
|
benchmark please |
|
Benchmark result overview:
View result details @ https://www.ytelses.com/opm/?page=result&id=3163 |
|
The table above seems wrong, the actual table reported in the website is:
|
|
Just a question: how can Dune::AxisAlignedCubeGeometry be used, our grid cells are not axis aligned (except for artificial test cases)? |
|
@atgeirr |
|
@atgeirr @SoilRos I just added a small test to illustrate what might be obvious: a deformed cell (i.e. a cell with collapsed corners and therefore fewer than 8 corners) does not map to the entire unit cube (#1065). With the current code in If the pillars are skewed but the cell is still a hexahedron, however, it can be refined — see [this test](https://github.com/OPM/opm-grid/blob/master/tests/cpgrid/lgr/refine_hexahedron_with_non_rectangular_faces_test.cpp). Also, |
|
I have looked at this again and think it looks good and should probably be merged. I do have a few questions first:
Currently unmergeable due to conflict, please resolve. |
fe28d09 to
8f6f2e9
Compare
Good question! Initially, I implemented this to ensure that I has not leaving dangling references behind during testing. For compiled objects, definitely yes, this is more expensive as the ABI of the function needs to write the signature explicitly. For templated code where the function may be inserted in-place, I do not know what are optimizations can the compiler do with either version. From what I can gather, these functions are compiled into binaries for the iteration of center of elements (e.g. via
Thanks for asking, I usually check that results are statistically significant. I am confident that the sequential cases are statistically significant but I probably have done a mistake here because I cannot directly reproduce the ones with higher process count. I have 10 performance cores and these results are not explained by the multithreading because I always run benchmarks with 1 thread per process (this is the default in my machine, I do not know why but I prefer this for measurements anyways). So I just re-ran the experiments (several times) for 3 cases:
Done 👍 |
|
jenkins build this serial please |
|
benchmark please |
|
Benchmark result overview:
FAILED RUNS: View result details @ https://www.ytelses.com/opm/?page=result&id=3198 |
|
jenkins build this serial please |
|
The tests seem to be broken since August 7th, so it's not related to this PR. |
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.
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.
This is to conform with the dune interface
8f6f2e9 to
65a967b
Compare
|
jenkins build this serial please |

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.