From d2cc0513d73e85d264db27bef70089c2835d0a85 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 18 May 2010 14:04:03 +0000
Subject: [PATCH] option to only extract skin of visible entities

---
 Plugin/Skin.cpp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/Plugin/Skin.cpp b/Plugin/Skin.cpp
index 688787279b..5335388e8a 100644
--- a/Plugin/Skin.cpp
+++ b/Plugin/Skin.cpp
@@ -9,6 +9,7 @@
 #include "GmshDefines.h"
 
 StringXNumber SkinOptions_Number[] = {
+  {GMSH_FULLRC, "Visible", NULL, 1.},
   {GMSH_FULLRC, "View", NULL, -1.}
 };
 
@@ -23,7 +24,8 @@ extern "C"
 std::string GMSH_SkinPlugin::getHelp() const
 {
   return "Plugin(Skin) extracts the boundary (skin) of "
-    "the view `View'.\n\n"
+    "the view `View'. If `Visible' is set, the plugin only "
+    "extracts the skin of visible entities.\n\n"
     "If `View' < 0, the plugin is run on the current view.\n\n"
     "Plugin(Skin) creates one new view.";
 }
@@ -136,7 +138,8 @@ static int getBoundary(int type, const int (**boundary)[6][4])
 
 PView *GMSH_SkinPlugin::execute(PView *v)
 {
-  int iView = (int)SkinOptions_Number[0].def;
+  int visible = (int)SkinOptions_Number[0].def;
+  int iView = (int)SkinOptions_Number[1].def;
 
   PView *v1 = getView(iView, v);
   if(!v1) return v;
@@ -162,8 +165,9 @@ PView *GMSH_SkinPlugin::execute(PView *v)
   }
 
   for(int ent = 0; ent < data1->getNumEntities(firstNonEmptyStep); ent++){
+    if(visible && data1->skipEntity(firstNonEmptyStep, ent)) continue;
     for(int ele = 0; ele < data1->getNumElements(firstNonEmptyStep, ent); ele++){
-      if(data1->skipElement(firstNonEmptyStep, ent, ele)) continue;
+      if(data1->skipElement(firstNonEmptyStep, ent, ele, visible)) continue;
       int numComp = data1->getNumComponents(firstNonEmptyStep, ent, ele);
       int type = data1->getType(firstNonEmptyStep, ent, ele);
       const int (*boundary)[6][4];
-- 
GitLab