Skip to content
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

Use a relative tolerance. #15890

Merged
merged 2 commits into from Aug 18, 2023
Merged

Use a relative tolerance. #15890

merged 2 commits into from Aug 18, 2023

Conversation

bangerth
Copy link
Member

In debugging something unrelated, I had to look at a piece of code that compares two vertex locations for equality. The existing code uses an absolute tolerance, but that isn't going to work well when using meshes at atomic or cosmic length scales. Use a relative tolerance instead.

While there, I also made the types used in this lambda function explicit.

Copy link
Member

@marcfehling marcfehling left a comment

Choose a reason for hiding this comment

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

Looks good!

@@ -268,21 +268,26 @@ namespace TriangulationDescription
{
std::sort(this->coarse_cell_vertices.begin(),
this->coarse_cell_vertices.end(),
[](const auto &a, const auto &b) {
[](const std::pair<unsigned int, Point<spacedim>> &a,
std::pair<unsigned int, Point<spacedim>> & b) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
std::pair<unsigned int, Point<spacedim>> & b) {
const std::pair<unsigned int, Point<spacedim>> &b) {

This used to be const before.

@bangerth
Copy link
Member Author

Good point about the const. So fixed.

@kronbichler kronbichler merged commit 1472e19 into dealii:master Aug 18, 2023
15 checks passed
@bangerth bangerth deleted the tolerance branch August 18, 2023 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants