diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp index 39072bc6728c68ac9cb027c0aaa01a13f3f10045..1fbc053cade4092add7612f38c03b054b6022dbe 100644 --- a/Geo/GModel.cpp +++ b/Geo/GModel.cpp @@ -2017,7 +2017,8 @@ void GModel::alignPeriodicBoundaries() MVertex* tgtVtcs[2]; for (int iVtx=0;iVtx<2;iVtx++) { MVertex* tgtVtx = tgtLine->getVertex(iVtx); - std::map<MVertex*,MVertex*>& v2v = tgtVtx->onWhat()->correspondingVertices; + // std::map<MVertex*,MVertex*>& v2v = tgtVtx->onWhat()->correspondingVertices; + std::map<MVertex*,MVertex*>& v2v = tgt->correspondingVertices; std::map<MVertex*,MVertex*>::iterator srcIter = v2v.find(tgtVtx); if (srcIter == v2v.end()) { Msg::Error("Cannot find periodic counterpart of vertex %d" @@ -2089,8 +2090,13 @@ void GModel::alignPeriodicBoundaries() for (int iVtx=0;iVtx<nbVtcs;iVtx++) { MVertex* vtx = tgtElmt->getVertex(iVtx); GEntity* ge = vtx->onWhat(); - if (ge->meshMaster() == ge) throw; - std::map<MVertex*,MVertex*>& v2v = ge->correspondingVertices; + if (ge->meshMaster() == ge) { + std::cout << "Point classified on " << ge->dim() << " " << ge->tag() << std::endl; + throw; + } + // std::map<MVertex*,MVertex*>& v2v = ge->correspondingVertices; + std::map<MVertex*,MVertex*>& v2v = tgt->correspondingVertices; + std::map<MVertex*,MVertex*>::iterator vIter = v2v.find(vtx); if (vIter==v2v.end()) { Msg::Error("Could not find copy of %d in %d", diff --git a/Mesh/meshGEdge.cpp b/Mesh/meshGEdge.cpp index 89e8da37185c866a79502fb2b037c9125d4c5fc4..a95e14da7070a61bbe2f83e915dfc0de8e914d18 100644 --- a/Mesh/meshGEdge.cpp +++ b/Mesh/meshGEdge.cpp @@ -314,6 +314,17 @@ void copyMesh(GEdge *from, GEdge *to, int direction) Range<double> to_u_bounds = to->parBounds(0); double to_u_min = to_u_bounds.low(); + // include begin and end point to avoid conflicts when realigning + + MVertex* vt0 = to->getBeginVertex()->mesh_vertices[0]; + MVertex* vt1 = to->getEndVertex()->mesh_vertices[0]; + + MVertex* vs0 = from->getBeginVertex()->mesh_vertices[0]; + MVertex* vs1 = from->getEndVertex()->mesh_vertices[0]; + + to->correspondingVertices[vt0] = direction > 0 ? vs0 : vs1; + to->correspondingVertices[vt1] = direction > 0 ? vs1 : vs0; + for(unsigned int i = 0; i < from->mesh_vertices.size(); i++){ int index = (direction < 0) ? (from->mesh_vertices.size() - 1 - i) : i; MVertex *v = from->mesh_vertices[index]; diff --git a/Mesh/meshGFace.cpp b/Mesh/meshGFace.cpp index 53b4b42faf15526e94aae633e789dde7ba96d20c..3d27ba5c8e0a801176b89160565c221987be5bb9 100644 --- a/Mesh/meshGFace.cpp +++ b/Mesh/meshGFace.cpp @@ -276,7 +276,10 @@ static void copyMesh(GFace *source, GFace *target) target->tag(),source->tag(),gvt->tag()); } - vs2vt[gvs->mesh_vertices[0]] = gvt->mesh_vertices[0]; + MVertex* vs = gvs->mesh_vertices[0]; + MVertex* vt = gvt->mesh_vertices[0]; + vs2vt[vs] = vt; + target->correspondingVertices[vt] = vs; } // add corresponding edge nodes assuming edges were correctly meshed already @@ -319,7 +322,10 @@ static void copyMesh(GFace *source, GFace *target) int is = orientation == 1 ? 0 : get->mesh_vertices.size()-1; for (unsigned it=0;it<get->mesh_vertices.size();it++,is+=orientation) { - vs2vt[ges->mesh_vertices[is]] = get->mesh_vertices[it]; + MVertex* vs = ges->mesh_vertices[is]; + MVertex* vt = get->mesh_vertices[it]; + vs2vt[vs] = vt; + target->correspondingVertices[vt] = vs; } }