Skip to content

Commit

Permalink
Merge pull request #15890 from bangerth/tolerance
Browse files Browse the repository at this point in the history
Use a relative tolerance.
  • Loading branch information
kronbichler committed Aug 18, 2023
2 parents ef09d23 + 4642c89 commit 1472e19
Showing 1 changed file with 17 additions and 12 deletions.
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

0 comments on commit 1472e19

Please sign in to comment.