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
Add tolerance to box in compute_point_locations_try_all #15102
Add tolerance to box in compute_point_locations_try_all #15102
Conversation
source/grid/grid_tools.cc
Outdated
const auto &box = leaf.first; | ||
const double relative_tolerance = 1e-12; | ||
const BoundingBox<spacedim> box = leaf.first.create_extended( | ||
relative_tolerance * leaf.first.side_length(0)); |
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 think it would be better if we scale each side length with a relative tolerance. Thanks for tackling this! @kronbichler
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.
What about creating BB::create_extended_relative()
? @bergbauer could write this ;)
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 added @bergbauer's suggestion (via his own commit) to this PR.
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 👍 I am wondering when we will have eliminated all the tolerance issues!?
source/grid/grid_tools.cc
Outdated
const auto &box = leaf.first; | ||
const double relative_tolerance = 1e-12; | ||
const BoundingBox<spacedim> box = leaf.first.create_extended( | ||
relative_tolerance * leaf.first.side_length(0)); |
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.
What about creating BB::create_extended_relative()
? @bergbauer could write this ;)
e2c4bf3
to
cce10ff
Compare
Can we have another review on this? #15035 depends on this to fix the failing tests there. |
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.
If there are no further comments, I will merge this tonight so that we can proceed with #15035.
In #15035, we observed a test failure of
numerics/generalized_interpolation_02
because of the following assertion:dealii/include/deal.II/numerics/fe_field_function.templates.h
Lines 543 to 545 in f5f72b0
What is happening there is that a point ends up being outside the triangulation by roundoff (1e-16), which can happen during a typical program run. Looking into the code, I realize the following condition
dealii/source/grid/grid_tools.cc
Lines 5835 to 5837 in f5f72b0
intersects(box)
without tolerance. Since I don't know how to teachboost
a tolerance (maybe you do @luca-heltai?), I think the right way is to make the bounding box we accept larger by a roundoff margin, say1e-12
relative tolerance. I added a test that checks this for the actual numbers where it happened (outside by1e-16
), by outside of1e-8
, and outside a lot. I think this way the code makes more sense.