From 855faae858f6782cd25d023b906ca40c79109bdd Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Fri, 21 Dec 2018 18:37:39 +0100
Subject: [PATCH] STYLE: surfaceMeshTriangulate renamed to surfaceMeshExtract

- the utility had automatic triangulation removed some time ago, but
  never changed its name.

- catch old uses with a surfaceMeshTriangulate deprecated script
---
 applications/utilities/surface/README         |  7 ++---
 .../surface/surfaceMeshExtract/Make/files     |  3 +++
 .../Make/options                              |  1 -
 .../surfaceMeshExtract.C}                     |  0
 .../surface/surfaceMeshTriangulate/Make/files |  3 ---
 bin/deprecated/surfaceMeshTriangulate         | 27 +++++++++++++++++++
 bin/surfaceMeshTriangulate                    |  1 +
 etc/config.sh/completion_cache                |  2 +-
 .../pimpleFoam/RAS/ellipsekkLOmega/Allrun.pre |  2 +-
 .../straightDuctImplicit/README.txt           |  2 +-
 10 files changed, 38 insertions(+), 10 deletions(-)
 create mode 100644 applications/utilities/surface/surfaceMeshExtract/Make/files
 rename applications/utilities/surface/{surfaceMeshTriangulate => surfaceMeshExtract}/Make/options (99%)
 rename applications/utilities/surface/{surfaceMeshTriangulate/surfaceMeshTriangulate.C => surfaceMeshExtract/surfaceMeshExtract.C} (100%)
 delete mode 100644 applications/utilities/surface/surfaceMeshTriangulate/Make/files
 create mode 100755 bin/deprecated/surfaceMeshTriangulate
 create mode 120000 bin/surfaceMeshTriangulate

diff --git a/applications/utilities/surface/README b/applications/utilities/surface/README
index a66c2463a12..f7e8342ca54 100644
--- a/applications/utilities/surface/README
+++ b/applications/utilities/surface/README
@@ -17,12 +17,13 @@ surfaceCoarsen
 surfaceConvert
 - Converts surfaces to/from various formats
 
+surfaceMeshExtract
+- Extracts mesh patches (or faceSets) and writes as a single surface.
+- foamToSurface duplicates this
+
 surfaceFind
 - Finds nearest vertex and face to given point.
 
-surfaceMeshTriangulate
-- Triangulate external faces of mesh and write as surface.
-
 surfacePointMerge
 - Explicit point merge of surface.
 
diff --git a/applications/utilities/surface/surfaceMeshExtract/Make/files b/applications/utilities/surface/surfaceMeshExtract/Make/files
new file mode 100644
index 00000000000..859aca6c1f7
--- /dev/null
+++ b/applications/utilities/surface/surfaceMeshExtract/Make/files
@@ -0,0 +1,3 @@
+surfaceMeshExtract.C
+
+EXE = $(FOAM_APPBIN)/surfaceMeshExtract
diff --git a/applications/utilities/surface/surfaceMeshTriangulate/Make/options b/applications/utilities/surface/surfaceMeshExtract/Make/options
similarity index 99%
rename from applications/utilities/surface/surfaceMeshTriangulate/Make/options
rename to applications/utilities/surface/surfaceMeshExtract/Make/options
index 87ba656ac1d..02c293ceedb 100644
--- a/applications/utilities/surface/surfaceMeshTriangulate/Make/options
+++ b/applications/utilities/surface/surfaceMeshExtract/Make/options
@@ -5,4 +5,3 @@ EXE_INC = \
 EXE_LIBS = \
     -lmeshTools \
     -lsurfMesh
-
diff --git a/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C b/applications/utilities/surface/surfaceMeshExtract/surfaceMeshExtract.C
similarity index 100%
rename from applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C
rename to applications/utilities/surface/surfaceMeshExtract/surfaceMeshExtract.C
diff --git a/applications/utilities/surface/surfaceMeshTriangulate/Make/files b/applications/utilities/surface/surfaceMeshTriangulate/Make/files
deleted file mode 100644
index a258356ba2e..00000000000
--- a/applications/utilities/surface/surfaceMeshTriangulate/Make/files
+++ /dev/null
@@ -1,3 +0,0 @@
-surfaceMeshTriangulate.C
-
-EXE = $(FOAM_APPBIN)/surfaceMeshTriangulate
diff --git a/bin/deprecated/surfaceMeshTriangulate b/bin/deprecated/surfaceMeshTriangulate
new file mode 100755
index 00000000000..b3f518061e4
--- /dev/null
+++ b/bin/deprecated/surfaceMeshTriangulate
@@ -0,0 +1,27 @@
+#!/bin/sh
+#------------------------------------------------------------------------------
+# =========                 |
+# \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+#  \\    /   O peration     |
+#   \\  /    A nd           | Copyright (C) 2018 OpenCFD Ltd.
+#    \\/     M anipulation  |
+#------------------------------------------------------------------------------
+# License
+#     This file is part of OpenFOAM, licensed under GNU General Public License
+#     <http://www.gnu.org/licenses/>.
+#
+# File
+#     surfaceMeshTriangulate
+#
+# Description
+#     Renamed surfaceMeshTriangulate to surfaceMeshExtract (2018-12-21)
+#
+#------------------------------------------------------------------------------
+
+echo
+echo "FOAM FATAL"
+echo "${0##*/} has been superceded by surfaceMeshExtract (DEC-2018)"
+
+exit 1
+
+#------------------------------------------------------------------------------
diff --git a/bin/surfaceMeshTriangulate b/bin/surfaceMeshTriangulate
new file mode 120000
index 00000000000..0f667affaf6
--- /dev/null
+++ b/bin/surfaceMeshTriangulate
@@ -0,0 +1 @@
+deprecated/surfaceMeshTriangulate
\ No newline at end of file
diff --git a/etc/config.sh/completion_cache b/etc/config.sh/completion_cache
index c1d5a12450c..a4cff0bd8fb 100644
--- a/etc/config.sh/completion_cache
+++ b/etc/config.sh/completion_cache
@@ -258,9 +258,9 @@ _of_complete_cache_[surfaceInflate]="-case -featureAngle -fileHandler -nSmooth |
 _of_complete_cache_[surfaceLambdaMuSmooth]="-featureFile | -doc -doc-source -help"
 _of_complete_cache_[surfaceMeshConvert]="-case -dict -fileHandler -from -scaleIn -scaleOut -to | -clean -noFunctionObjects -tri -doc -doc-source -help"
 _of_complete_cache_[surfaceMeshExport]="-case -dict -fileHandler -from -name -scaleIn -scaleOut -to | -clean -noFunctionObjects -doc -doc-source -help"
+_of_complete_cache_[surfaceMeshExtract]="-case -decomposeParDict -faceZones -fileHandler -patches -region -time | -constant -excludeProcPatches -latestTime -noFunctionObjects -noZero -parallel -doc -doc-source -help"
 _of_complete_cache_[surfaceMeshImport]="-case -dict -fileHandler -from -name -scaleIn -scaleOut -to | -clean -noFunctionObjects -doc -doc-source -help"
 _of_complete_cache_[surfaceMeshInfo]="-case -fileHandler -scale | -areas -noFunctionObjects -xml -doc -doc-source -help"
-_of_complete_cache_[surfaceMeshTriangulate]="-case -decomposeParDict -faceZones -fileHandler -patches -region -time | -constant -excludeProcPatches -latestTime -noFunctionObjects -noZero -parallel -doc -doc-source -help"
 _of_complete_cache_[surfaceOrient]="-case -fileHandler -scale | -inside -noFunctionObjects -usePierceTest -doc -doc-source -help"
 _of_complete_cache_[surfacePatch]="-case -dict -fileHandler | -noFunctionObjects -doc -doc-source -help"
 _of_complete_cache_[surfacePointMerge]="-case -fileHandler -scale | -noFunctionObjects -doc -doc-source -help"
diff --git a/tutorials/incompressible/pimpleFoam/RAS/ellipsekkLOmega/Allrun.pre b/tutorials/incompressible/pimpleFoam/RAS/ellipsekkLOmega/Allrun.pre
index df81f8b6587..e56b451b786 100755
--- a/tutorials/incompressible/pimpleFoam/RAS/ellipsekkLOmega/Allrun.pre
+++ b/tutorials/incompressible/pimpleFoam/RAS/ellipsekkLOmega/Allrun.pre
@@ -14,7 +14,7 @@ runApplication topoSet
 
 runApplication createPatch -overwrite
 
-runApplication surfaceMeshTriangulate \
+runApplication surfaceMeshExtract \
     -patches hole ppGeometry.vtp -constant -time none
 
 echo "End"
diff --git a/tutorials/incompressible/porousSimpleFoam/straightDuctImplicit/README.txt b/tutorials/incompressible/porousSimpleFoam/straightDuctImplicit/README.txt
index 9b2628400a2..7bef08b8a32 100644
--- a/tutorials/incompressible/porousSimpleFoam/straightDuctImplicit/README.txt
+++ b/tutorials/incompressible/porousSimpleFoam/straightDuctImplicit/README.txt
@@ -16,7 +16,7 @@ constant/triSurface/boundaryAndFaceZones.stl
             faceSet porosityFaces subset cellToFace porosity all
             faceZoneSet porosityFaces new setToFaceZone porosityFaces
 
-        surfaceMeshTriangulate -faceZones '(porosityFaces)' boundaryAndFaceZones.stl
+        surfaceMeshExtract -faceZones '(porosityFaces)' boundaryAndFaceZones.obj
     )
 
 surfaceFeatureExtract
-- 
GitLab