-
Notifications
You must be signed in to change notification settings - Fork 116
Check if a group has a choke #4622
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?
Conversation
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.
Looks good to me, with one small provision on the parameter name. Don't worry about the "failed check" for labels. I'll fix that.
GTNode groupTree(std::size_t report_step) const; | ||
GTNode groupTree(const std::string& root_node, std::size_t report_step) const; | ||
const Group& getGroup(const std::string& groupName, std::size_t timeStep) const; | ||
bool hasChoke(const std::string& groupName, std::size_t timeStep) const; |
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'd probably use a different parameter name here, since the predicate typically applies to a node named in the (extended) network. While groups may indeed be network nodes, not all network nodes are expected to be groups in this case.
Maybe nodeName
instead of groupName
?
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.
Thanks @bska. I was trying to fix the label but could not change it myself which I should be able to do, right?
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 was trying to fix the label but could not change it myself which I should be able to do, right?
You need "triage" privileges in the repository in order to set/change PR labels. At the moment, "triage" is effectively the same as "administrator" so only repository administrators have that ability. It's possible that we'll revise the PR labelling policy in light of this fact.
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'd probably use a different parameter name here, since the predicate typically applies to a node named in the (extended) network. While groups may indeed be network nodes, not all network nodes are expected to be groups in this case.
Maybe
nodeName
instead ofgroupName
?
From the downstream PR, it looks like the function is to check whether a group is also a choke node in a network. Maybe groupName
can be more appropriate as the input argument? But I also understand your arguments, so there is no strong objection to your suggestion either. Just for discussion.
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.
Whether or not something is a choke is inherently a node property, since this is governed by item 3 of the NODEPROP
keyword. It's very misleading to give the impression that this pertains only to groups.
On a tangential note, we might want to add a unit test for this new function, both for the case of a node/group having a choke and for the case of there not being a choke. |
Hi, is the function used in some code already? Based on the usage, the design of the function can be some different. It is good to show the usage of the function in my opinion. |
Added a unit test for this |
I am preparing a PR in simulators in which I make use of it. |
jenkins build this please |
jenkins build this opm-simulators=6313 please |
Thanks. I now see the downstream PR now. OPM/opm-simulators#6313 From the usage, it looks like it is checking whether an certain group is also serving as a network node with an active choke setup. Maybe a more descriptive function name can be
|
With more thinking, it is okay to keep the function has_choke(), the parameter can be |
GTNode groupTree(std::size_t report_step) const; | ||
GTNode groupTree(const std::string& root_node, std::size_t report_step) const; | ||
const Group& getGroup(const std::string& groupName, std::size_t timeStep) const; | ||
bool hasChoke(const std::string& groupName, std::size_t timeStep) const; |
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.
@plgbrts , you changed to use nodeName
in the .cpp file, it is good to have the consistency in the .hpp file also.
return this->snapshots[timeStep].groups.get(groupName); | ||
} | ||
|
||
bool Schedule::hasChoke(const std::string& nodeName, std::size_t timeStep) const { |
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.
When reviewing the downstream PR, I saw there is the following function,
bool Group::as_choke() const {
return this->m_choke_group.has_value();
}
Does this function overlap with the new function introduced here?
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.
Does this function overlap with the new function introduced here?
Kind of. This particular function exists for the "standard network" model (GRUPNET
keyword).
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.
But it looks like updated in the function handleNODEPROP()
, which is for extended network.
Potentially we can reuse as_choke()
function instead of introducing a new one?
No description provided.