Skip to content
Snippets Groups Projects
Commit 5538dd38 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

fix non-deterministic behavior of sort_edge (patch from Wendy)

parent abc5c286
No related branches found
No related tags found
No related merge requests found
...@@ -481,8 +481,16 @@ static void midpointsphere(GFace *gf, double u1, double v1, double u2, double v2 ...@@ -481,8 +481,16 @@ static void midpointsphere(GFace *gf, double u1, double v1, double u2, double v2
bool edges_sort(std::pair<double, BDS_Edge*> a, std::pair<double, BDS_Edge*> b) bool edges_sort(std::pair<double, BDS_Edge*> a, std::pair<double, BDS_Edge*> b)
{ {
if (a.first == b.first) // don't compare pointers: it leads to non-deterministic behavior
return ((*a.second) < (*b.second)); // if (a.first == b.first){
// return ((*a.second) < (*b.second));
// }
if (std::abs(a.first - b.first) < 1e-10){
if (a.second->p1->iD == b.second->p1->iD)
return (a.second->p2->iD < b.second->p2->iD);
else
return (a.second->p1->iD < b.second->p1->iD);
}
else else
return (a.first < b.first); return (a.first < b.first);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment