-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changing IdType to int64_t #823
Conversation
The extra template argument that causes the need for a downstream PR: is there a way to avoid needing to specify the argument, having it deduced instead? Otherwise I think this looks like a reasonable direction, but I have not done a thorough review as this is still in draft mode. I think replacing |
@atgeirr I think this can be avoided. One solution would be to exchange the order of the template arguments, ie. having Another solution would be to make the functions have a version taking template<typename Grid, typename GridView>
template<class GridType>
int Opm::LookUpData<Grid,GridView>::getFieldPropIdx(const auto& elem) const
{ // ignoring the check for GridType to keep it simple, but that could either be handled as is or with a constexpr if.
if constexpr (!std::is_integral_v(decltype(elem)) {
static_assert(std::is_same_v<Grid,GridType>);
static_assert(std::is_same_v<EntityType,Dune::cpgrid::Entity<0>>);
if (isFieldPropInLgr_ && elem.level()) { // level > 0 == true ; level == 0 == false
// In case some LGRs do not have refined field properties, the next line need to be modified.
return elem.getLevelElem().index();
}
else {
return elem.getOrigin().index();
}
} else {
static_assert(std::is_same_v<Grid,GridType>);
// Check there are no LGRs. LGRs (level>0) only supported for CpGrid.
assert(gridView_.grid().maxLevel() == 0);
return elem;
}
} Now, this would also introduce change in In terms of minimisation of change, I think exchanging the order of the template arguments would be the winner, but that would lead to an inconsistency. |
Now I think that maybe changing the interface would be better in the end, if we could avoid having to specify (more than one) template arguments, despite a few downstream changes. I think there are confusingly many variants of these functions, which I think is because there are several dimensions here: CpGrid or not, Entity or not. Could we do with just a single one using |
@atgeirr I've added a sketch with a simplified function signature. Note that I still have to add documentation to the new functions to properly document this. The function signatures are a bit cleaner, though I would argue that their definitions might be slightly more cumbersome to read (a lot of Also note that there are some simplifications that can be done, since some of the functions coincide. Right now this is still handled as separate |
9983649
to
c71f124
Compare
So it seems a fortunate side effect of this edition is that no change in opm-simulators is needed. |
Jenkins build this please |
I think this looks like a good reduction of complexity. @aritorto as the original author of this code, do you agree? |
Indeed, nice simplification/improvement. Why is it still in draft mode? Now running a simulation with CARFIN keyword has been incorporated into master (OPM/opm-simulators#5903). This is (one test) where lookupdata would do the not trivial thing. So, just in case, we could check - one more time - that nothing breaks |
jenkins build this please |
@aritorto the main reason it's still in draft is that I haven't completed the new documentation of the functions. I will do that now and take it out of draft. |
Good point, @kjetilly (Also it was in the description, my bad...). Documentation is also important. Great! |
this requires c++-20. |
Which part of it? |
see jenkins console output and gcc tells you all you need to know.
|
Jenkins build this please |
Jenkins build this please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a nice simplification. I had only a couple of comments/questions
fa3da3c
to
353f143
Compare
0eb13c4
to
bb17ec7
Compare
Jenkins build this please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The companion PR in opm-simulators is still WIP. I guess that needs to be merged with one? |
Jenkins build this please |
This was a bit unclear since I did not close the opm-simulators PR, but in its current version, this PR does not need any change outside of opm-grid. I closed the opm-simulators PR now since it is no longer needed. |
This pull request changes the
IdType
toint64_t
to avoid some overflow errors seen previously.No change in opm-simulators is needed.