From c634c5446e0ad5547af4ebfe0aee455b72c953a9 Mon Sep 17 00:00:00 2001
From: Gaetan Bricteux <gaetan.bricteux@uclouvain.be>
Date: Wed, 19 Oct 2011 13:32:39 +0000
Subject: [PATCH] add physical names + fix

---
 Geo/GModelFactory.h   | 2 +-
 Geo/GModelIO_Mesh.cpp | 5 ++++-
 Geo/MElementCut.cpp   | 8 +++++++-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/Geo/GModelFactory.h b/Geo/GModelFactory.h
index c227f1db29..f4bbceb1b3 100644
--- a/Geo/GModelFactory.h
+++ b/Geo/GModelFactory.h
@@ -3,7 +3,7 @@
 // See the LICENSE.txt file for license information. Please report all
 // bugs and problems to <gmsh@geuz.org>.
 
-#ifndef _GMODEL_FACT@ORY_H_
+#ifndef _GMODEL_FACTORY_H_
 #define _GMODEL_FACTORY_H_
 
 #include <vector>
diff --git a/Geo/GModelIO_Mesh.cpp b/Geo/GModelIO_Mesh.cpp
index 8ff7dc3992..997c8cf560 100644
--- a/Geo/GModelIO_Mesh.cpp
+++ b/Geo/GModelIO_Mesh.cpp
@@ -54,8 +54,11 @@ 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);
+        }
       }
     }
   }
diff --git a/Geo/MElementCut.cpp b/Geo/MElementCut.cpp
index a438ffba8a..05501126c4 100644
--- a/Geo/MElementCut.cpp
+++ b/Geo/MElementCut.cpp
@@ -1313,7 +1313,13 @@ GModel *buildCutMesh(GModel *gm, gLevelset *ls,
         printf("\n");
       }
     }
-  }printf("\n");
+  }
+  printf("PHYS\n");
+  for(int i=0;i<4;i++)
+    for(std::map<int, std::map<int, std::string> >::iterator it=physicals[i].begin();it!=physicals[i].end();it++) 
+      for(std::map<int, std::string>::iterator it2 = it->second.begin(); it2!=it->second.end(); it2++)
+        printf(" dim=%d reg=%d phys=%d \"%s\"\n",i,it->first,it2->first,it2->second.c_str());
+  printf("\n");
 #endif
 
   for(newVerticesContainer::iterator it = newVertices.begin() ; it != newVertices.end(); ++it) {
-- 
GitLab