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

check if surface already exists on the boundary before adding it in setBoundFaces()

(cherry picked from commit 00c24dd8)
parent 71f82748
No related branches found
No related tags found
No related merge requests found
...@@ -291,10 +291,12 @@ int GRegion::delFace(GFace *face) ...@@ -291,10 +291,12 @@ int GRegion::delFace(GFace *face)
void GRegion::setBoundFaces(const std::set<int> &tagFaces) void GRegion::setBoundFaces(const std::set<int> &tagFaces)
{ {
for(auto it = tagFaces.begin(); it != tagFaces.end(); ++it) { for(auto it = tagFaces.begin(); it != tagFaces.end(); ++it) {
GFace *face = model()->getFaceByTag(*it); GFace *gf = model()->getFaceByTag(*it);
if(face) { if(gf) {
l_faces.push_back(face); if(std::find(l_faces.begin(), l_faces.end(), gf) == l_faces.end()) {
face->addRegion(this); l_faces.push_back(gf);
gf->addRegion(this);
}
} }
else { else {
Msg::Error("Unknown surface %d in volume %d", *it, tag()); Msg::Error("Unknown surface %d in volume %d", *it, tag());
...@@ -312,12 +314,14 @@ void GRegion::setBoundFaces(const std::vector<int> &tagFaces, ...@@ -312,12 +314,14 @@ void GRegion::setBoundFaces(const std::vector<int> &tagFaces,
setBoundFaces(tags); setBoundFaces(tags);
} }
for(std::size_t i = 0; i != tagFaces.size(); i++) { for(std::size_t i = 0; i != tagFaces.size(); i++) {
GFace *face = model()->getFaceByTag(tagFaces[i]); GFace *gf = model()->getFaceByTag(tagFaces[i]);
if(face) { if(gf) {
l_faces.push_back(face); if(std::find(l_faces.begin(), l_faces.end(), gf) == l_faces.end()) {
face->addRegion(this); l_faces.push_back(gf);
gf->addRegion(this);
l_dirs.push_back(signFaces[i]); l_dirs.push_back(signFaces[i]);
} }
}
else { else {
Msg::Error("Unknown surface %d in volume %d", tagFaces[i], tag()); Msg::Error("Unknown surface %d in volume %d", tagFaces[i], tag());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment