From ec94c078e3322379747473b24567bfeafcf720bc Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@Germany>
Date: Fri, 3 Feb 2017 09:33:22 +0000
Subject: [PATCH] BUG: STL patch names not being passed through

- regression introduced by a7195288321096a7

STYLE: add meaningful solid names for some stl files
---
 src/triSurface/triSurface/interfaces/STL/readSTL.C | 14 ++++++++++++++
 .../constant/triSurface/porosity.stl               |  4 ++--
 .../constant/triSurface/porosity_inflated.stl      |  4 ++--
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/triSurface/triSurface/interfaces/STL/readSTL.C b/src/triSurface/triSurface/interfaces/STL/readSTL.C
index d12e78b0371..43c9453a524 100644
--- a/src/triSurface/triSurface/interfaces/STL/readSTL.C
+++ b/src/triSurface/triSurface/interfaces/STL/readSTL.C
@@ -84,6 +84,20 @@ bool Foam::triSurface::readSTL(const fileName& STLfileName, bool forceBinary)
         f.region() = zoneIds[i];
     }
 
+    // Set patch names (and sizes)
+    // - there is likely a more efficient means of doing this
+    if (reader.stlFormat() == fileFormats::STLCore::ASCII)
+    {
+        const List<word>& names = reader.names();
+
+        patches_.setSize(names.size());
+        forAll(names, namei)
+        {
+            patches_[namei].name() = names[namei];
+        }
+        setDefaultPatches();
+    }
+
     return true;
 }
 
diff --git a/tutorials/incompressible/porousSimpleFoam/straightDuctImplicit/constant/triSurface/porosity.stl b/tutorials/incompressible/porousSimpleFoam/straightDuctImplicit/constant/triSurface/porosity.stl
index 2737bdf9279..1d4c5e88ed4 100644
--- a/tutorials/incompressible/porousSimpleFoam/straightDuctImplicit/constant/triSurface/porosity.stl
+++ b/tutorials/incompressible/porousSimpleFoam/straightDuctImplicit/constant/triSurface/porosity.stl
@@ -1,4 +1,4 @@
-solid ascii
+solid porosity
  facet normal 0 -1 0
   outer loop
    vertex 0 0 -0.025
@@ -33599,4 +33599,4 @@ solid ascii
    vertex 0.1 0.0475 0.025
   endloop
  endfacet
-endsolid
+endsolid porosity
diff --git a/tutorials/incompressible/porousSimpleFoam/straightDuctImplicit/constant/triSurface/porosity_inflated.stl b/tutorials/incompressible/porousSimpleFoam/straightDuctImplicit/constant/triSurface/porosity_inflated.stl
index 6c7c264eb0e..7df4b08619e 100644
--- a/tutorials/incompressible/porousSimpleFoam/straightDuctImplicit/constant/triSurface/porosity_inflated.stl
+++ b/tutorials/incompressible/porousSimpleFoam/straightDuctImplicit/constant/triSurface/porosity_inflated.stl
@@ -1,4 +1,4 @@
-solid ascii
+solid porosity_inflated
  facet normal 0 -1 0
   outer loop
    vertex 0 -0.005 -0.031
@@ -33599,4 +33599,4 @@ solid ascii
    vertex 0.1 0.052 0.029
   endloop
  endfacet
-endsolid
+endsolid porosity_inflated
-- 
GitLab