Commit 04198ccb authored by Christophe Geuzaine's avatar Christophe Geuzaine

Merge branch 'FixingIssuesEmbeddedEdgesPeriodicSurface' into 'master'

Fixing issues embedded edges periodic surface

See merge request !96
parents 8d2147bb 5876f407
Pipeline #1383 failed with stage
in 76 minutes and 59 seconds
......@@ -128,7 +128,7 @@ void OCCFace::setup()
vmax += fabs(dv) / 100.0;
occface = BRep_Tool::Surface(s);
for(exp2.Init(s, TopAbs_VERTEX); exp2.More(); exp2.Next()){
for(exp2.Init(s.Oriented(TopAbs_FORWARD), TopAbs_VERTEX, TopAbs_EDGE); exp2.More(); exp2.Next()){
TopoDS_Vertex vertex = TopoDS::Vertex(exp2.Current());
GVertex *v = 0;
if(model()->getOCCInternals())
......
......@@ -1909,6 +1909,12 @@ static bool meshGeneratorPeriodic(GFace *gf, bool debug = true)
std::list<GVertex*> emb_vertx = gf->embeddedVertices();
std::list<GVertex*>::iterator itvx = emb_vertx.begin();
std::map<MVertex*, std::set<BDS_Point*> > invertedRecoverMap;
for (std::map<BDS_Point*, MVertex*, PointLessThan>::iterator it = recoverMap.begin();
it != recoverMap.end(); it++){
invertedRecoverMap[it->second].insert(it->first);
}
int pNum = m->MAXPOINTNUMBER;
nbPointsTotal += emb_vertx.size();
{
......@@ -1919,7 +1925,7 @@ static bool meshGeneratorPeriodic(GFace *gf, bool debug = true)
for(unsigned int i = 0; i< (*ite)->lines.size(); i++){
for(unsigned int j = 0; j< 2; j++){
MVertex *v = (*ite)->lines[i]->getVertex(j);
if (vs.find(v) == vs.end()){
if (invertedRecoverMap.find(v) == invertedRecoverMap.end() && vs.find(v) == vs.end()){
vs.insert(v);
}
}
......@@ -1963,7 +1969,46 @@ static bool meshGeneratorPeriodic(GFace *gf, bool debug = true)
for(unsigned int i = 0; i< (*ite)->lines.size(); i++){
for(unsigned int j = 0; j< 2; j++){
MVertex *v = (*ite)->lines[i]->getVertex(j);
if (vs.find(v) == vs.end()){
BDS_Point *pp = 0;
const std::map<MVertex*, std::set<BDS_Point*> >::iterator it = invertedRecoverMap.find(v);
if (it != invertedRecoverMap.end())
{
if (it->second.size() > 1) {
const GEdge *edge = (*ite);
const Range<double> parBounds = edge->parBounds(0);
GPoint firstPoint = edge->point(parBounds.low());
GPoint lastPoint = edge->point(parBounds.high());
double param;
if (v->point().distance(SPoint3(firstPoint.x(), firstPoint.y(), firstPoint.z()))
< v->point().distance(SPoint3(lastPoint.x(), lastPoint.y(), lastPoint.z()))) {
// Vertex lies on first point of edge
param = parBounds.low();
}
else {
// Vertex lies on last point of edge
param = parBounds.high();
}
SPoint2 pointOnSurface = edge->reparamOnFace(gf, param, 1);
const std::set<BDS_Point*> &possiblePoints = it->second;
for (std::set<BDS_Point*>::iterator pntIt = possiblePoints.begin(); pntIt != possiblePoints.end();
++pntIt) {
if (pointOnSurface.distance(SPoint2((*pntIt)->u, (*pntIt)->v)) < 1e-10) {
pp = (*pntIt);
break;
}
}
if (pp == 0){
Msg::Error("Embedded edge vertex %d is on the seam edge of surface %d and no appropriate point could be found!\n",
v->getNum(), gf->tag());
}
}
else {
pp = *(it->second.begin());
}
facile[v] = pp;
}
if (pp == 0 && vs.find(v) == vs.end()){
vs.insert(v);
double uv[2]={0,0};
GPoint gp = gf->closestPoint (SPoint3(v->x(),v->y(),v->z()),uv);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment