diff --git a/Geo/GFace.cpp b/Geo/GFace.cpp index 2363410532526632a129da4271a4414e2844a171..dd32bae429307458ac7efecab083b4bc6265f317 100644 --- a/Geo/GFace.cpp +++ b/Geo/GFace.cpp @@ -276,6 +276,26 @@ surface_params GFace::getSurfaceParams() const return p; } +std::vector<MVertex*> GFace::getEmbeddedMeshVertices() const +{ + std::set<MVertex*> tmp; + for(std::list<GEdge *>::const_iterator it = embedded_edges.begin(); + it != embedded_edges.end(); it++){ + tmp.insert((*it)->mesh_vertices.begin(), (*it)->mesh_vertices.end()); + tmp.insert((*it)->getBeginVertex()->mesh_vertices.begin(), + (*it)->getBeginVertex()->mesh_vertices.end()); + tmp.insert((*it)->getEndVertex()->mesh_vertices.begin(), + (*it)->getEndVertex()->mesh_vertices.end()); + } + for(std::list<GVertex *>::const_iterator it = embedded_vertices.begin(); + it != embedded_vertices.end(); it++){ + tmp.insert((*it)->mesh_vertices.begin(), (*it)->mesh_vertices.end()); + } + std::vector<MVertex*> res; + res.insert(res.end(), tmp.begin(), tmp.end()); + return res; +} + std::list<GVertex*> GFace::vertices() const { std::set<GVertex*> v; diff --git a/Geo/GFace.h b/Geo/GFace.h index ec2d27231a38c2f217656b942809da142f3a558e..a4432a81ecc48f8425b9be3156b3b8c52958e5f3 100644 --- a/Geo/GFace.h +++ b/Geo/GFace.h @@ -67,7 +67,7 @@ class GFace : public GEntity // vertices are classifed on this GFace, their type is MFaceVertex. // After mesh generation, those are moved to the mesh_vertices array std::vector<MVertex*> additionalVertices; - + public: GFace(GModel *model, int tag); virtual ~GFace(); @@ -121,6 +121,8 @@ class GFace : public GEntity // edges that are embedded in the face virtual std::list<GVertex*> embeddedVertices() const { return embedded_vertices; } + std::vector<MVertex*> getEmbeddedMeshVertices() const; + // vertices that bound the face virtual std::list<GVertex*> vertices() const; diff --git a/Mesh/meshGFaceExtruded.cpp b/Mesh/meshGFaceExtruded.cpp index bbcc3a651d2b6a6a3dec1f4648156c4149e94927..6aea9520edc78ceb65d122d9d2cb2d3e1493db79 100644 --- a/Mesh/meshGFaceExtruded.cpp +++ b/Mesh/meshGFaceExtruded.cpp @@ -152,9 +152,16 @@ static void copyMesh(GFace *from, GFace *to, MVertexRTree &pos) { ExtrudeParams *ep = to->meshAttributes.extrude; - // create vertices - for(unsigned int i = 0; i < from->mesh_vertices.size(); i++){ - MVertex *v = from->mesh_vertices[i]; + // interior vertices + std::vector<MVertex*> mesh_vertices = from->mesh_vertices; + + // add all embedded vertices + std::vector<MVertex*> embedded = from->getEmbeddedMeshVertices(); + mesh_vertices.insert(mesh_vertices.end(), embedded.begin(), embedded.end()); + + // create extruded vertices + for(unsigned int i = 0; i < mesh_vertices.size(); i++){ + MVertex *v = mesh_vertices[i]; double x = v->x(), y = v->y(), z = v->z(); ep->Extrude(ep->mesh.NbLayer - 1, ep->mesh.NbElmLayer[ep->mesh.NbLayer - 1], x, y, z); @@ -261,8 +268,9 @@ int MeshExtrudedSurface(GFace *gf, // if the edges of the mesh are constrained, the vertices already // exist on the face--so we add them to the set - if(constrainedEdges) + if(constrainedEdges){ pos.insert(gf->mesh_vertices); + } if(ep->geo.Mode == EXTRUDED_ENTITY) { // surface is extruded from a curve diff --git a/Mesh/meshGRegionExtruded.cpp b/Mesh/meshGRegionExtruded.cpp index 32958b7a0e6534a0e4e80508f2af714fb2ce1101..50c392dcad56ec5bb2bc4547a43c87e15eea478a 100644 --- a/Mesh/meshGRegionExtruded.cpp +++ b/Mesh/meshGRegionExtruded.cpp @@ -136,9 +136,16 @@ static void extrudeMesh(GFace *from, GRegion *to, MVertexRTree &pos) { ExtrudeParams *ep = to->meshAttributes.extrude; - // create vertices - for(unsigned int i = 0; i < from->mesh_vertices.size(); i++){ - MVertex *v = from->mesh_vertices[i]; + // interior vertices + std::vector<MVertex*> mesh_vertices = from->mesh_vertices; + + // add all embedded vertices + std::vector<MVertex*> embedded = from->getEmbeddedMeshVertices(); + mesh_vertices.insert(mesh_vertices.end(), embedded.begin(), embedded.end()); + + // create extruded vertices + for(unsigned int i = 0; i < mesh_vertices.size(); i++){ + MVertex *v = mesh_vertices[i]; for(int j = 0; j < ep->mesh.NbLayer; j++) { for(int k = 0; k < ep->mesh.NbElmLayer[j]; k++) { double x = v->x(), y = v->y(), z = v->z(); @@ -194,6 +201,8 @@ static void insertAllVertices(GRegion *gr, MVertexRTree &pos) std::list<GFace*>::iterator itf = faces.begin(); while(itf != faces.end()){ pos.insert((*itf)->mesh_vertices); + std::vector<MVertex*> embedded = (*itf)->getEmbeddedMeshVertices(); + pos.insert(embedded); std::list<GEdge*> edges = (*itf)->edges(); std::list<GEdge*>::iterator ite = edges.begin(); while(ite != edges.end()){