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

surface extrusions now handle embedded points/edges

parent 1c77588c
No related branches found
No related tags found
No related merge requests found
...@@ -276,6 +276,26 @@ surface_params GFace::getSurfaceParams() const ...@@ -276,6 +276,26 @@ surface_params GFace::getSurfaceParams() const
return p; 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::list<GVertex*> GFace::vertices() const
{ {
std::set<GVertex*> v; std::set<GVertex*> v;
......
...@@ -121,6 +121,8 @@ class GFace : public GEntity ...@@ -121,6 +121,8 @@ class GFace : public GEntity
// edges that are embedded in the face // edges that are embedded in the face
virtual std::list<GVertex*> embeddedVertices() const { return embedded_vertices; } virtual std::list<GVertex*> embeddedVertices() const { return embedded_vertices; }
std::vector<MVertex*> getEmbeddedMeshVertices() const;
// vertices that bound the face // vertices that bound the face
virtual std::list<GVertex*> vertices() const; virtual std::list<GVertex*> vertices() const;
......
...@@ -152,9 +152,16 @@ static void copyMesh(GFace *from, GFace *to, MVertexRTree &pos) ...@@ -152,9 +152,16 @@ static void copyMesh(GFace *from, GFace *to, MVertexRTree &pos)
{ {
ExtrudeParams *ep = to->meshAttributes.extrude; ExtrudeParams *ep = to->meshAttributes.extrude;
// create vertices // interior vertices
for(unsigned int i = 0; i < from->mesh_vertices.size(); i++){ std::vector<MVertex*> mesh_vertices = from->mesh_vertices;
MVertex *v = from->mesh_vertices[i];
// 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(); double x = v->x(), y = v->y(), z = v->z();
ep->Extrude(ep->mesh.NbLayer - 1, ep->mesh.NbElmLayer[ep->mesh.NbLayer - 1], ep->Extrude(ep->mesh.NbLayer - 1, ep->mesh.NbElmLayer[ep->mesh.NbLayer - 1],
x, y, z); x, y, z);
...@@ -261,8 +268,9 @@ int MeshExtrudedSurface(GFace *gf, ...@@ -261,8 +268,9 @@ int MeshExtrudedSurface(GFace *gf,
// if the edges of the mesh are constrained, the vertices already // if the edges of the mesh are constrained, the vertices already
// exist on the face--so we add them to the set // exist on the face--so we add them to the set
if(constrainedEdges) if(constrainedEdges){
pos.insert(gf->mesh_vertices); pos.insert(gf->mesh_vertices);
}
if(ep->geo.Mode == EXTRUDED_ENTITY) { if(ep->geo.Mode == EXTRUDED_ENTITY) {
// surface is extruded from a curve // surface is extruded from a curve
......
...@@ -136,9 +136,16 @@ static void extrudeMesh(GFace *from, GRegion *to, MVertexRTree &pos) ...@@ -136,9 +136,16 @@ static void extrudeMesh(GFace *from, GRegion *to, MVertexRTree &pos)
{ {
ExtrudeParams *ep = to->meshAttributes.extrude; ExtrudeParams *ep = to->meshAttributes.extrude;
// create vertices // interior vertices
for(unsigned int i = 0; i < from->mesh_vertices.size(); i++){ std::vector<MVertex*> mesh_vertices = from->mesh_vertices;
MVertex *v = from->mesh_vertices[i];
// 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 j = 0; j < ep->mesh.NbLayer; j++) {
for(int k = 0; k < ep->mesh.NbElmLayer[j]; k++) { for(int k = 0; k < ep->mesh.NbElmLayer[j]; k++) {
double x = v->x(), y = v->y(), z = v->z(); double x = v->x(), y = v->y(), z = v->z();
...@@ -194,6 +201,8 @@ static void insertAllVertices(GRegion *gr, MVertexRTree &pos) ...@@ -194,6 +201,8 @@ static void insertAllVertices(GRegion *gr, MVertexRTree &pos)
std::list<GFace*>::iterator itf = faces.begin(); std::list<GFace*>::iterator itf = faces.begin();
while(itf != faces.end()){ while(itf != faces.end()){
pos.insert((*itf)->mesh_vertices); pos.insert((*itf)->mesh_vertices);
std::vector<MVertex*> embedded = (*itf)->getEmbeddedMeshVertices();
pos.insert(embedded);
std::list<GEdge*> edges = (*itf)->edges(); std::list<GEdge*> edges = (*itf)->edges();
std::list<GEdge*>::iterator ite = edges.begin(); std::list<GEdge*>::iterator ite = edges.begin();
while(ite != edges.end()){ while(ite != edges.end()){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment