-
Notifications
You must be signed in to change notification settings - Fork 127
reducing some code duplication in MultisegmentWellSegments #6530
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
base: master
Are you sure you want to change the base?
reducing some code duplication in MultisegmentWellSegments #6530
Conversation
jenkins build this please |
8ed1c13
to
abba6dd
Compare
jenkins build this please |
132d78a
to
3ab2969
Compare
3ab2969
to
de82a0b
Compare
by introducing the funciton computeFluidProperties() and getSurfaceDensities(). And some small adjustment when working on the lines. small adjustment more small rewriting
jenkins build this please |
I am marking the PR as ready for review to discuss. |
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.
I haven't looked closely enough at the details to verify that this is in fact completely equivalent to the current master, but I'll assume it is for the purpose of this initial review. I really like the reduction in duplicated logic, so this is a marked improvement over the current master version. Moreover, it opens the path to further refactorings that would hopefully bring additional improvements to the readability.
Other than that, I have just one initial suggestion.
There are some small difference between the original functions in the original In the original Basically, Furthermore, when implementing And also, thanks for the suggestion for the private free function |
jenkins build this please |
A lot of code in the function
getSurfaceVolume()
andcomputeFluidProperties()
are similar (probably started from the same) while became a little different with time.In this PR, we put the common part of the two functions inside a third function
calculatePhaseProperties()
and reuse it.And also, since the surface densities does not change, it is also put in a function while called once in the constructor instead of calling it again and again.
The function
calculatePhaseProperties()
is still long after the PR, which probably can be split to smaller functions.