diff --git a/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C b/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C
index a3cc3221cd..8203f2d4e6 100644
--- a/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C
+++ b/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C
@@ -22,23 +22,29 @@ License
along with OpenFOAM. If not, see .
Description
- Extracts triSurface from a polyMesh. Triangulates all boundary faces.
- Region numbers on triangles are the patch numbers of the polyMesh.
+ Extracts surface from a polyMesh. Depending on output surface format
+ triangulates faces.
+
+ Region numbers on faces cannot be guaranteed to be the same as the patch
+ indices.
+
Optionally only triangulates named patches.
If run in parallel the processor patches get filtered out by default and
- the mesh gets merged. (based on vertex position, not topology, so might go
- wrong!).
+ the mesh gets merged (based on topology).
\*---------------------------------------------------------------------------*/
+#include "MeshedSurface.H"
+#include "UnsortedMeshedSurface.H"
#include "argList.H"
#include "Time.H"
#include "polyMesh.H"
-#include "triSurface.H"
-#include "triSurfaceTools.H"
#include "processorPolyPatch.H"
#include "ListListOps.H"
+#include "uindirectPrimitivePatch.H"
+#include "globalMeshData.H"
+#include "globalIndex.H"
using namespace Foam;
@@ -50,7 +56,7 @@ int main(int argc, char *argv[])
{
argList::addNote
(
- "extract surface from a polyMesh and triangulate boundary faces"
+ "extract surface from a polyMesh"
);
argList::validArgs.append("output file");
#include "addRegionOption.H"
@@ -63,27 +69,37 @@ int main(int argc, char *argv[])
(
"patches",
"(patch0 .. patchN)",
- "only triangulate named patches"
+ "only triangulate selected patches (wildcards supported)"
);
#include "setRootCase.H"
#include "createTime.H"
- const fileName outFileName(runTime.path()/args[1]);
+ const word outFileName(args[1]);
- Info<< "Extracting triSurface from boundaryMesh ..."
+ Info<< "Extracting surface from boundaryMesh ..."
<< endl << endl;
- Pout<< "Reading mesh from time " << runTime.value() << endl;
-
- #include "createNamedPolyMesh.H"
-
const bool includeProcPatches =
!(
args.optionFound("excludeProcPatches")
|| Pstream::parRun()
);
+ if (includeProcPatches)
+ {
+ Info<< "Including all processor patches." << nl << endl;
+ }
+ else if (Pstream::parRun())
+ {
+ Info<< "Excluding all processor patches." << nl << endl;
+ }
+
+ Info<< "Reading mesh from time " << runTime.value() << endl;
+
+ #include "createNamedPolyMesh.H"
+
+
// Create local surface from:
// - explicitly named patches only (-patches (at your option)
// - all patches (default in sequential mode)
@@ -98,24 +114,10 @@ int main(int argc, char *argv[])
if (args.optionFound("patches"))
{
- const wordList patchNames
+ includePatches = bMesh.patchSet
(
- args.optionLookup("patches")()
+ wordReList(args.optionLookup("patches")())
);
-
- forAll(patchNames, patchNameI)
- {
- const word& patchName = patchNames[patchNameI];
- const label patchI = bMesh.findPatchID(patchName);
-
- if (patchI == -1)
- {
- FatalErrorIn(args.executable()) << "No such patch "
- << patchName << endl << "Patches are " << bMesh.names()
- << exit(FatalError);
- }
- includePatches.insert(patchI);
- }
}
else
{
@@ -127,212 +129,155 @@ int main(int argc, char *argv[])
{
includePatches.insert(patchI);
}
- else
- {
- Pout<< patch.name() << " : skipped since processorPatch"
- << endl;
- }
}
}
- triSurface localSurface
+
+
+ // Collect sizes. Hash on names to handle local-only patches (e.g.
+ // processor patches)
+ HashTable