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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 17 additions & 12 deletions source/grid/tria_description.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
const std::pair<unsigned int, Point<spacedim>> &b) {
return a.first < b.first;
});
this->coarse_cell_vertices.erase(
std::unique(this->coarse_cell_vertices.begin(),
this->coarse_cell_vertices.end(),
[](const auto &a, const auto &b) {
if (a.first == b.first)
{
Assert(a.second.distance(b.second) < 10e-8,
ExcInternalError());
return true;
}
return false;
}),
std::unique(
this->coarse_cell_vertices.begin(),
this->coarse_cell_vertices.end(),
[](const std::pair<unsigned int, Point<spacedim>> &a,
const std::pair<unsigned int, Point<spacedim>> &b) {
if (a.first == b.first)
{
Assert(a.second.distance(b.second) <=
1e-7 *
std::max(a.second.norm(), b.second.norm()),
ExcInternalError());
return true;
}
return false;
}),
this->coarse_cell_vertices.end());
}

Expand Down