Skip to content

Commit

Permalink
Return a copy for Geomerty::center()
Browse files Browse the repository at this point in the history
This is mandated by the DUNE interface. It also makes a lot of sense
because now people do not need to think whether
const auto& center = entity.geometry().center();
might cause a dangling reference. It just wont as it is always a copy
and never a reference to a member.
  • Loading branch information
blattms committed Aug 3, 2018
1 parent 51c7393 commit e48a468
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion opm/grid/cpgrid/Geometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ namespace Dune
}

/// Returns the centroid of the geometry.
const GlobalCoordinate& center() const
GlobalCoordinate center() const
{
return pos_;
}
Expand Down

5 comments on commit e48a468

@bska
Copy link
Member

@bska bska commented on e48a468 Aug 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you really intend to push this directly to OPM/opm-grid:master?

@blattms
Copy link
Member Author

@blattms blattms commented on e48a468 Aug 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I didn't and am very sorry. It was meant to end up in my repository in a branch. I accidentally commit thiese to master and not the branch that I am working wth and I issued a git push without a remote and git assumed that I wanted to push to the branch being tracked (which is this master). Ouch.

@bska
Copy link
Member

@bska bska commented on e48a468 Aug 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I didn't and am very sorry.

Okay, thanks for the information. Do you want me to revert the commits or do you want to do it yourself? Is there a better follow-up action?

@blattms
Copy link
Member Author

@blattms blattms commented on e48a468 Aug 3, 2018 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akva2
Copy link
Member

@akva2 akva2 commented on e48a468 Aug 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a friendly tip how I avoid this: Never use ssh for the origin remote, only my forks. The need to input user/pwd then point out the error.

Please sign in to comment.