From d1f97610ddf771fb9f87cece3c057be66b1882fd Mon Sep 17 00:00:00 2001 From: Gaetan Bricteux <gaetan.bricteux@uclouvain.be> Date: Wed, 19 Oct 2011 15:45:01 +0000 Subject: [PATCH] fix physical names --- Geo/GModel.cpp | 10 +++++++++- Geo/GModelIO_Mesh.cpp | 5 +---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp index 8d7615a0ef..5cbea99e09 100644 --- a/Geo/GModel.cpp +++ b/Geo/GModel.cpp @@ -1818,8 +1818,16 @@ GModel *GModel::buildCutGModel(gLevelset *ls, bool cutElem, bool saveTri) cutGM->_associateEntityWithMeshVertices(); cutGM->_storeVerticesInEntities(vertexMap); - for(int i = 0; i < 4; i++) + for(int i = 0; i < 4; i++){ cutGM->_storePhysicalTagsInEntities(i, physicals[i]); + std::map<int, std::map<int, std::string> >::iterator it = physicals[i].begin(); + for(; it != physicals[i].end(); it++){ + std::map<int, std::string>::iterator it2 = it->second.begin(); + for(; it2 != it->second.end(); it2++) + if(it2->second != "") + cutGM->setPhysicalName(it2->second, i, it2->first); + } + } Msg::Info("Mesh cutting complete (%g s)", Cpu() - t1); return cutGM; diff --git a/Geo/GModelIO_Mesh.cpp b/Geo/GModelIO_Mesh.cpp index 997c8cf560..8ff7dc3992 100644 --- a/Geo/GModelIO_Mesh.cpp +++ b/Geo/GModelIO_Mesh.cpp @@ -54,11 +54,8 @@ void GModel::_storePhysicalTagsInEntities(int dim, std::map<int, std::string>::const_iterator it2 = it->second.begin(); for(; it2 != it->second.end(); ++it2){ if(std::find(ge->physicals.begin(), ge->physicals.end(), it2->first) == - ge->physicals.end()){ + ge->physicals.end()) ge->physicals.push_back(it2->first); - if(it2->second != "") - setPhysicalName(it2->second, dim, it2->first); - } } } } -- GitLab