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

more info for debugging

parent 9b95d6c5
No related branches found
No related tags found
No related merge requests found
Pipeline #9768 passed
...@@ -217,48 +217,81 @@ void getCandidateExtrudeInfo(GRegion *gr, std::vector<extrudeInfo> &info, ...@@ -217,48 +217,81 @@ void getCandidateExtrudeInfo(GRegion *gr, std::vector<extrudeInfo> &info,
for(auto f2 : f) { for(auto f2 : f) {
// for each pair of surfaces // for each pair of surfaces
if(f1 == f2) continue; if(f1 == f2) continue;
Msg::Debug("Testing surface pair %d - %d:", f1->tag(), f2->tag());
auto f2v = f2->vertices(); auto f2v = f2->vertices();
auto f2e = f2->edges(); auto f2e = f2->edges();
std::set<GVertex *, GEntityPtrLessThan> v2(f2v.begin(), f2v.end()); std::set<GVertex *, GEntityPtrLessThan> v2(f2v.begin(), f2v.end());
std::set<GEdge *, GEntityPtrLessThan> e2(f2e.begin(), f2e.end()); std::set<GEdge *, GEntityPtrLessThan> e2(f2e.begin(), f2e.end());
// abort if different topology // abort if different topology
if((v1.size() != v2.size()) || (e1.size() != e2.size())) continue; if((v1.size() != v2.size()) || (e1.size() != e2.size())) {
Msg::Debug(" - incompatible surfaces %d (#points=%lu, #curves=%lu) - "
"%d (#points=%lu, #curves=%lu)",
f1->tag(), v1.size(), e1.size(),
f2->tag(), v2.size(), e2.size());
continue;
}
SVector3 t0(0., 0., 0.); SVector3 t0(0., 0., 0.);
bool translated = true; bool translated = true;
// check all curves not on the boundary of the 2 surfaces std::set<GEdge*> perp;
for(auto e : gr->edges()) { for(auto e : gr->edges()) {
if(e1.find(e) == e1.end() && e2.find(e) == e2.end()) { // skip curves that are on the boundary of the 2 surfaces
if(e1.find(e) != e1.end() || e2.find(e) != e2.end()) {
continue;
}
if((v1.find(e->getBeginVertex()) != v1.end() ||
v1.find(e->getEndVertex()) != v1.end()) &&
(v2.find(e->getBeginVertex()) != v2.end() ||
v2.find(e->getEndVertex()) != v2.end())) {
perp.insert(e);
}
}
// straight lines with the same translation vector? if(perp.size() != v1.size()) {
if(e->geomType() == GEntity::Line) { Msg::Debug(" - number of extruded curves differs from number of "
GVertex *vs = e->getBeginVertex(), *vt = e->getEndVertex(); "source/target surface points (%lu != %lu)",
if(vs && vt) { perp.size(), v1.size());
SVector3 t; continue;
if(v1.find(vs) != v1.end() && v2.find(vt) != v2.end()) { }
t = SVector3(vs->xyz(), vt->xyz());
} if(perp.size() + e1.size() + e2.size() != gr->edges().size()) {
else if(v1.find(vt) != v1.end() && v2.find(vs) != v2.end()) { Msg::Debug(" - extra curves not connected to source/target surfaces");
t = SVector3(vt->xyz(), vs->xyz()); continue;
} }
else {
translated = false; for(auto e : perp) {
break; // straight lines with the same translation vector?
} if(e->geomType() == GEntity::Line) {
if(t0.norm() == 0.) t0 = t; GVertex *vs = e->getBeginVertex(), *vt = e->getEndVertex();
if(!sameDir(t0, t)) { if(vs && vt) {
translated = false; SVector3 t;
break; if(v1.find(vs) != v1.end() && v2.find(vt) != v2.end()) {
} t = SVector3(vs->xyz(), vt->xyz());
}
else if(v1.find(vt) != v1.end() && v2.find(vs) != v2.end()) {
t = SVector3(vt->xyz(), vs->xyz());
}
else {
// should not happen
translated = false;
break;
}
if(t0.norm() == 0.) t0 = t;
if(!sameDir(t0, t)) {
Msg::Debug(" - straight line t=(%g, %g, %g) != t0=(%g, %g, %g)",
t.x(), t.y(), t.z(), t0.x(), t0.y(), t0.z());
translated = false;
break;
} }
} }
else { }
// TODO: could check here if all curves are circles to detect else {
// extrusions by rotation // TODO: could check here if all curves are circles to detect
translated = false; // extrusions by rotation
break; translated = false;
} break;
} }
} }
if(translated && t0.norm() != 0.) { if(translated && t0.norm() != 0.) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment