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
Implement ReferenceCell::point_is_inside. #13496
Conversation
FYI @nfehn |
*/ | ||
template <int dim> | ||
bool | ||
point_is_inside(const Point<dim> &p, const double eps = 0) 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.
Maybe formulate as question is_point_inside()
.
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 don't like is_point_inside
as a name. It sounds grammatically wrong.
Would contains_point
be better? As in
cell->contains_point(p)
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.
Maybe just is_inside(), in analogy to std::is_same, std::is_enum, etc.
(point.is_inside(cell) would be easier to read, but does not make sense from a software design perspective. I assume this is the reason why you repeated „point“ in the function name?)
/** | ||
* Return true if the given point is inside the reference cell of the present | ||
* space dimension. This function accepts an additional parameter (which | ||
* defaults to zero) which |
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.
Maybe such geometry functions with tolerances should not use default parameters.
I think the documentation does not exactly specify what eps = 0
means. I would understand the docu as follows: A point lying on the boundary together with eps=0
will result in a return value of true
. However, the formulation in the first sentence "if the given point is inside the reference cell ..." goes in a different direction.
I would prefer tolerance
(often used in GridTools
) over eps
. Is it really numerical roundoff in the sense of eps?
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 made those changes.
f691e77
to
04952cb
Compare
What do others think about the naming of the function? |
I am fine with |
I understand "contain" in the sense of information/data, not geometrically. |
Assume you want to know whether a cell (of one triangulation) is enclosed by another triangulation |
I don't have a strong opinion on the name. If we want something more general, we could use the same naming convention as boost. Use |
What about |
On 3/8/22 05:01, Niklas Fehn wrote:
I understand "contain" in the sense of information/data, not geometrically.
That's not how native speakers would interpret it, though. "contains" is used
in sets, for example. I think "contains" is pretty clearly geometric. (There's
also the (shipping) container, which quite literally "contains" a bunch of
objects in the same way as a dam contains the water behind it.)
|
I like |
This is the generalized equivalent of GeometryInfo::is_inside_unit_cell().
04952cb
to
c3f74c2
Compare
So updated! |
This is the generalized equivalent of GeometryInfo::is_inside_unit_cell().
/rebuild