Skip to content

Commit

Permalink
Don't Needlessly Copy Well/Group Names
Browse files Browse the repository at this point in the history
The no-argument overloads of member functions

    WellMatcher::wells()
    SummaryState::groups()

return references to const.  Don't convert these to independent
objects on the caller's behalf.  If the caller wants independent
objects, they can create such objects at the call site.
  • Loading branch information
bska committed Nov 5, 2024
1 parent c82b527 commit 63d7733
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions opm/input/eclipse/Schedule/UDQ/UDQContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ namespace Opm {
return it->second;
}

std::vector<std::string> UDQContext::wells() const
const std::vector<std::string>& UDQContext::wells() const
{
return this->well_matcher.wells();
}
Expand All @@ -217,7 +217,7 @@ namespace Opm {
return this->well_matcher.wells(pattern);
}

std::vector<std::string> UDQContext::groups() const
const std::vector<std::string>& UDQContext::groups() const
{
return this->summary_state.groups();
}
Expand Down
4 changes: 2 additions & 2 deletions opm/input/eclipse/Schedule/UDQ/UDQContext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ namespace Opm {

const UDQFunctionTable& function_table() const;

std::vector<std::string> wells() const;
const std::vector<std::string>& wells() const;
std::vector<std::string> wells(const std::string& pattern) const;
std::vector<std::string> groups() const;
const std::vector<std::string>& groups() const;
SegmentSet segments() const;
SegmentSet segments(const std::vector<std::string>& set_descriptor) const;

Expand Down

0 comments on commit 63d7733

Please sign in to comment.