diff --git a/applications/test/argList/Test-argList.C b/applications/test/argList/Test-argList.C index adb36e3835..c882b85520 100644 --- a/applications/test/argList/Test-argList.C +++ b/applications/test/argList/Test-argList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,11 +38,13 @@ using namespace Foam; int main(int argc, char *argv[]) { argList::noBanner(); - argList::noParallel(); + argList::noCheckProcessorDirectories(); // parallel OK, but without checks + // argList::noFunctionObjects(); argList::addOption("label", "value", "Test parsing of label"); argList::addOption("scalar", "value", "Test parsing of scalar"); argList::addOption("string", "value", "Test string lookup"); + argList::addOption("relative", "PATH", "Test relativePath"); // These are actually lies (never had -parseLabel, -parseScalar etc), // but good for testing... @@ -70,20 +72,27 @@ int main(int argc, char *argv[]) argList::addArgument("label"); argList::noMandatoryArgs(); - argList args(argc, argv); + #include "setRootCase.H" - Info<< "command-line (" + Pout<< "command-line (" << args.options().size() << " options, " << args.args().size() << " args)" << nl << " " << args.commandLine().c_str() << nl << nl; - Info<< "rootPath: " << args.rootPath() << nl + Pout<< "rootPath: " << args.rootPath() << nl << "globalCase: " << args.globalCaseName() << nl << "globalPath: " << args.globalPath() << nl << nl; - Info<<"have: " - < timePaths; diff --git a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C index edd762a839..a0e33ad2ae 100644 --- a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C +++ b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C @@ -82,7 +82,8 @@ int main(int argc, char *argv[]) "Collapse faces that are in the supplied face set" ); - #include "addDictOption.H" + argList::addOption("dict", "file", "Use alternative collapseDict"); + #include "addOverwriteOption.H" argList::noFunctionObjects(); // Never use function objects diff --git a/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C b/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C index 2c482069c7..5323f25a97 100644 --- a/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C +++ b/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C @@ -342,7 +342,7 @@ int main(int argc, char *argv[]) "For example, moving points, splitting/collapsing edges etc." ); #include "addOverwriteOption.H" - #include "addDictOption.H" + argList::addOption("dict", "file", "Use alternative modifyMeshDict"); argList::noFunctionObjects(); // Never use function objects diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index 9569e7a253..46108ce780 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -1469,7 +1469,12 @@ int main(int argc, char *argv[]) #include "addRegionOption.H" #include "addOverwriteOption.H" - #include "addDictOption.H" + + argList::addOption + ( + "dict", "file", "Use alternative extrudeToRegionMeshDict" + ); + #include "setRootCase.H" #include "createTime.H" #include "createNamedMesh.H" diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index 0656083505..ab355019c1 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -684,6 +684,7 @@ int main(int argc, char *argv[]) #include "addRegionOption.H" #include "addOverwriteOption.H" + #include "addProfilingOption.H" argList::addBoolOption ( "checkGeometry", @@ -707,8 +708,7 @@ int main(int argc, char *argv[]) "file", "Name of the file to save the simplified surface to" ); - #include "addProfilingOption.H" - #include "addDictOption.H" + argList::addOption("dict", "file", "Use alternative snappyHexMeshDict"); argList::noFunctionObjects(); // Never use function objects diff --git a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C index dc2eda49c3..0bc75143f3 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C +++ b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C @@ -441,9 +441,8 @@ int main(int argc, char *argv[]) "Does not duplicate points." ); - #include "addDictOption.H" + argList::addOption("dict", "file", "Use alternative createBafflesDict"); #include "addOverwriteOption.H" - #include "addDictOption.H" #include "addRegionOption.H" argList::noFunctionObjects(); // Never use function objects diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatch.C b/applications/utilities/mesh/manipulation/createPatch/createPatch.C index d85cf460bd..d96c94fa71 100644 --- a/applications/utilities/mesh/manipulation/createPatch/createPatch.C +++ b/applications/utilities/mesh/manipulation/createPatch/createPatch.C @@ -518,7 +518,7 @@ int main(int argc, char *argv[]) #include "addOverwriteOption.H" #include "addRegionOption.H" - #include "addDictOption.H" + argList::addOption("dict", "file", "Use alternative createPatchDict"); argList::addBoolOption ( "writeObj", diff --git a/applications/utilities/mesh/manipulation/mirrorMesh/mirrorFvMesh.C b/applications/utilities/mesh/manipulation/mirrorMesh/mirrorFvMesh.C index 072933a381..ed1d9e50ff 100644 --- a/applications/utilities/mesh/manipulation/mirrorMesh/mirrorFvMesh.C +++ b/applications/utilities/mesh/manipulation/mirrorMesh/mirrorFvMesh.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -31,24 +31,37 @@ License Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io) : - fvMesh(io), - mirrorMeshDict_ + mirrorFvMesh ( - IOobject + io, + IOdictionary ( - "mirrorMeshDict", - time().system(), - *this, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE + IOobject + ( + "mirrorMeshDict", + io.time().system(), + io.time(), + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ) ) ) +{} + + +Foam::mirrorFvMesh::mirrorFvMesh +( + const IOobject& io, + const IOdictionary& mirrorDict +) +: + fvMesh(io) { - plane mirrorPlane(mirrorMeshDict_); + plane mirrorPlane(mirrorDict); const scalar planeTolerance ( - mirrorMeshDict_.get("planeTolerance") + mirrorDict.get("planeTolerance") ); const pointField& oldPoints = points(); @@ -57,6 +70,9 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io) const label nOldInternalFaces = nInternalFaces(); const polyPatchList& oldPatches = boundaryMesh(); + Info<< "Mirroring mesh at origin:" << mirrorPlane.origin() + << " normal:" << mirrorPlane.normal() << nl; + // Mirror the points Info<< "Mirroring points. Old points: " << oldPoints.size(); @@ -66,15 +82,15 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io) labelList mirrorPointLookup(oldPoints.size(), -1); // Grab the old points - forAll(oldPoints, pointi) + for (const point& pt : oldPoints) { - newPoints[nNewPoints] = oldPoints[pointi]; - nNewPoints++; + newPoints[nNewPoints] = pt; + ++nNewPoints; } forAll(oldPoints, pointi) { - scalar alpha = + const scalar alpha = mirrorPlane.normalIntersect ( oldPoints[pointi], @@ -121,7 +137,6 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io) } - Info<< "Mirroring faces. Old faces: " << oldFaces.size(); // Algorithm: @@ -325,7 +340,7 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io) Info<< "Mirroring patches. Old patches: " << boundary().size() << " New patches: " << boundary().size() << endl; - Info<< "Mirroring cells. Old cells: " << oldCells.size() + Info<< "Mirroring cells. Old cells: " << oldCells.size() << " New cells: " << 2*oldCells.size() << endl; cellList newCells(2*oldCells.size()); diff --git a/applications/utilities/mesh/manipulation/mirrorMesh/mirrorFvMesh.H b/applications/utilities/mesh/manipulation/mirrorMesh/mirrorFvMesh.H index 12e5b6f0f8..e5102edc5b 100644 --- a/applications/utilities/mesh/manipulation/mirrorMesh/mirrorFvMesh.H +++ b/applications/utilities/mesh/manipulation/mirrorMesh/mirrorFvMesh.H @@ -51,9 +51,6 @@ class mirrorFvMesh { // Private data - //- Mirror dictionary - IOdictionary mirrorMeshDict_; - //- Mirrored mesh autoPtr mirrorMeshPtr_; @@ -77,8 +74,11 @@ public: // Constructors - //- Construct from IOobject - mirrorFvMesh(const IOobject& io); + //- Construct from IOobject, using system mirrorMeshDict + explicit mirrorFvMesh(const IOobject& io); + + //- Construct from IOobject and specified mirrorMeshDict + mirrorFvMesh(const IOobject& io, const IOdictionary& mirrorDict); //- Destructor diff --git a/applications/utilities/mesh/manipulation/mirrorMesh/mirrorMesh.C b/applications/utilities/mesh/manipulation/mirrorMesh/mirrorMesh.C index 6d74e39d28..5f7efd8061 100644 --- a/applications/utilities/mesh/manipulation/mirrorMesh/mirrorMesh.C +++ b/applications/utilities/mesh/manipulation/mirrorMesh/mirrorMesh.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -49,12 +49,23 @@ int main(int argc, char *argv[]) "Mirrors a mesh around a given plane." ); + argList::addOption("dict", "file", "Use alternative mirrorMeshDict"); + argList::setAdvanced("decomposeParDict"); + #include "addOverwriteOption.H" #include "setRootCase.H" #include "createTime.H" const bool overwrite = args.found("overwrite"); + const word dictName("mirrorMeshDict"); + + #include "setSystemRunTimeDictionaryIO.H" + + Info<< "Reading " << dictName << "\n" << endl; + + const IOdictionary mirrorDict(dictIO); + mirrorFvMesh mesh ( IOobject @@ -62,7 +73,8 @@ int main(int argc, char *argv[]) mirrorFvMesh::defaultRegion, runTime.constant(), runTime - ) + ), + mirrorDict ); hexRef8Data refData diff --git a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C index 98f2bebe2c..fadffbdbbe 100644 --- a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C +++ b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C @@ -162,7 +162,8 @@ int main(int argc, char *argv[]) #include "addOverwriteOption.H" #include "addRegionOption.H" - #include "addDictOption.H" + + argList::addOption("dict", "file", "Use alternative refineMeshDict"); argList::addBoolOption ( diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C index c23210e68b..a9770456e3 100644 --- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C +++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C @@ -617,7 +617,8 @@ int main(int argc, char *argv[]) #include "addRegionOption.H" #include "addOverwriteOption.H" #include "addTimeOptions.H" - #include "addDictOption.H" + + argList::addOption("dict", "file", "Use alternative renumberMeshDict"); argList::addBoolOption ( diff --git a/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C b/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C index 47f47e7341..bf254a87e6 100644 --- a/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C +++ b/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C @@ -115,7 +115,8 @@ int main(int argc, char *argv[]) #include "addOverwriteOption.H" #include "addRegionOption.H" - #include "addDictOption.H" + + argList::addOption("dict", "file", "Use alternative stitchMeshDict"); argList::addBoolOption ( diff --git a/applications/utilities/mesh/manipulation/topoSet/topoSet.C b/applications/utilities/mesh/manipulation/topoSet/topoSet.C index bda18339c4..785a3ae34e 100644 --- a/applications/utilities/mesh/manipulation/topoSet/topoSet.C +++ b/applications/utilities/mesh/manipulation/topoSet/topoSet.C @@ -207,7 +207,9 @@ int main(int argc, char *argv[]) ); timeSelector::addOptions(true, false); // constant(true), zero(false) - #include "addDictOption.H" + + argList::addOption("dict", "file", "Use alternative topoSetDict"); + #include "addRegionOption.H" argList::addBoolOption ( diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/convertLagrangian.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/convertLagrangian.H index 9a2596b826..2719ccc85a 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/convertLagrangian.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/convertLagrangian.H @@ -94,7 +94,7 @@ if (doLagrangian) ); Info<< " Lagrangian: " - << writer.output().relative(runTime.globalPath()) << nl; + << runTime.relativePath(writer.output()) << nl; writer.writeTimeValue(mesh.time().value()); writer.writeGeometry(); diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/convertSurfaceFields.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/convertSurfaceFields.H index 75c7fb171e..5ab48ff99d 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/convertSurfaceFields.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/convertSurfaceFields.H @@ -107,7 +107,7 @@ Description ); Info<< " Surface : " - << writer.output().relative(runTime.globalPath()) << nl; + << runTime.relativePath(writer.output()) << nl; writer.writeTimeValue(timeValue); @@ -211,7 +211,7 @@ Description ); Info<< " FaceZone : " - << writer.output().relative(runTime.globalPath()) << nl; + << runTime.relativePath(writer.output()) << nl; writer.beginFile(fz.name()); diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/convertTopoSet.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/convertTopoSet.H index 49111ea890..e2a96e898f 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/convertTopoSet.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/convertTopoSet.H @@ -42,7 +42,7 @@ if (faceSetName.size()) ); Info<< " faceSet : " - << outputName.relative(runTime.globalPath()) << nl; + << runTime.relativePath(outputName) << nl; vtk::writeFaceSet ( @@ -70,7 +70,7 @@ if (pointSetName.size()) ); Info<< " pointSet : " - << outputName.relative(runTime.globalPath()) << nl; + << runTime.relativePath(outputName) << nl; vtk::writePointSet ( diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/convertVolumeFields.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/convertVolumeFields.H index ad8802f6a6..763b3fa3d9 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/convertVolumeFields.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/convertVolumeFields.H @@ -113,7 +113,7 @@ Description ); Info<< " Internal : " - << internalWriter->output().relative(runTime.globalPath()) << nl; + << runTime.relativePath(internalWriter->output()) << nl; internalWriter->writeTimeValue(mesh.time().value()); internalWriter->writeGeometry(); @@ -163,7 +163,7 @@ Description ); Info<< " Boundaries: " - << writer->output().relative(runTime.globalPath()) << nl; + << runTime.relativePath(writer->output()) << nl; writer->writeTimeValue(timeValue); writer->writeGeometry(); @@ -229,7 +229,7 @@ Description ); Info<< " Boundary : " - << writer->output().relative(runTime.globalPath()) << nl; + << runTime.relativePath(writer->output()) << nl; writer->writeTimeValue(timeValue); writer->writeGeometry(); diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C index 7c743c1619..b584822c21 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C @@ -650,7 +650,7 @@ int main(int argc, char *argv[]) if (args.found("overwrite") && isDir(regionDir)) { Info<< "Removing old directory " - << regionDir.relative(runTime.globalPath()) + << runTime.relativePath(regionDir) << nl << endl; rmDir(regionDir); } diff --git a/applications/utilities/postProcessing/noise/noise.C b/applications/utilities/postProcessing/noise/noise.C index 9f01b669c2..a0f239c8c3 100644 --- a/applications/utilities/postProcessing/noise/noise.C +++ b/applications/utilities/postProcessing/noise/noise.C @@ -109,7 +109,8 @@ int main(int argc, char *argv[]) argList::noCheckProcessorDirectories(); - #include "addDictOption.H" + argList::addOption("dict", "file", "Use alternative noiseDict"); + #include "setRootCase.H" #include "createTime.H" diff --git a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C index f767b62d9f..e448fca9c9 100644 --- a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C +++ b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C @@ -396,7 +396,8 @@ int main(int argc, char *argv[]) " (such as the patch type for fields and polyMesh/boundary files)." ); - #include "addDictOption.H" + argList::addOption("dict", "file", "Use alternative changeDictionaryDict"); + argList::addOption ( "subDict", diff --git a/applications/utilities/preProcessing/createExternalCoupledPatchGeometry/createExternalCoupledPatchGeometry.C b/applications/utilities/preProcessing/createExternalCoupledPatchGeometry/createExternalCoupledPatchGeometry.C index 2312e19d5f..dfb11117c2 100644 --- a/applications/utilities/preProcessing/createExternalCoupledPatchGeometry/createExternalCoupledPatchGeometry.C +++ b/applications/utilities/preProcessing/createExternalCoupledPatchGeometry/createExternalCoupledPatchGeometry.C @@ -81,7 +81,7 @@ int main(int argc, char *argv[]) ( "commsDir", "dir", - "Specify alternate communications directory (default is 'comms')" + "Specify communications directory (default is 'comms')" ); #include "setRootCase.H" #include "createTime.H" diff --git a/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C b/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C index 62c2c2e2ee..ae63469ff6 100644 --- a/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C +++ b/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C @@ -59,8 +59,9 @@ int main(int argc, char *argv[]) " algorithm. Writes a map of fine to coarse grid." ); + argList::addOption("dict", "file", "Use alternative viewFactorsDict"); #include "addRegionOption.H" - #include "addDictOption.H" + #include "setRootCase.H" #include "createTime.H" #include "createNamedMesh.H" diff --git a/applications/utilities/preProcessing/setFields/setFields.C b/applications/utilities/preProcessing/setFields/setFields.C index 01510ad72e..7fc5823714 100644 --- a/applications/utilities/preProcessing/setFields/setFields.C +++ b/applications/utilities/preProcessing/setFields/setFields.C @@ -401,7 +401,8 @@ int main(int argc, char *argv[]) "Set values on a selected set of cells/patch-faces via a dictionary" ); - #include "addDictOption.H" + argList::addOption("dict", "file", "Use alternative setFieldsDict"); + #include "addRegionOption.H" #include "setRootCase.H" #include "createTime.H" diff --git a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C index 0c2f9c06fb..344bd2a58d 100644 --- a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C +++ b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C @@ -693,8 +693,7 @@ int main(int argc, char *argv[]) vtkWriter->writeGeometry(); Info<< "Writing VTK to " - << ((vtkOutputDir/outputName).ext(vtkWriter->ext())) - .relative(runTime.globalPath()) << nl; + << runTime.relativePath(vtkWriter->output()) << nl; } } else diff --git a/applications/utilities/surface/surfaceHookUp/surfaceHookUp.C b/applications/utilities/surface/surfaceHookUp/surfaceHookUp.C index 8f86b60246..a93e9f1b5b 100644 --- a/applications/utilities/surface/surfaceHookUp/surfaceHookUp.C +++ b/applications/utilities/surface/surfaceHookUp/surfaceHookUp.C @@ -274,8 +274,7 @@ int main(int argc, char *argv[]) ); argList::noParallel(); argList::addArgument("hookTolerance", "The point merge tolerance"); - - #include "addDictOption.H" + argList::addOption("dict", "file", "Use alternative surfaceHookUpDict"); #include "setRootCase.H" #include "createTime.H" diff --git a/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C b/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C index b66a397f2b..dbce9c97eb 100644 --- a/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C +++ b/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C @@ -100,7 +100,8 @@ int main(int argc, char *argv[]) "factor", "Geometry scaling factor on output" ); - #include "addDictOption.H" + argList::addOption("dict", "file", "Use alternative coordinateSystems"); + argList::addOption ( "from", diff --git a/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C b/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C index 8498eb124e..f0c40bb4a0 100644 --- a/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C +++ b/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C @@ -107,7 +107,8 @@ int main(int argc, char *argv[]) "factor", "Geometry scaling factor on output - default is 1" ); - #include "addDictOption.H" + argList::addOption("dict", "file", "Use alternative coordinateSystems"); + argList::addOption ( "from", diff --git a/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C b/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C index eb8cb700a0..45596b9ec5 100644 --- a/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C +++ b/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C @@ -49,7 +49,7 @@ Usage Specify a scaling factor when writing files. - \par -dict \ - Specify an alternative dictionary for constant/coordinateSystems. + Use alternative dictionary for constant/coordinateSystems. - \par -from \ Specify a coordinate system when reading files. @@ -107,7 +107,8 @@ int main(int argc, char *argv[]) "factor", "Geometry scaling factor on output - default is 1" ); - #include "addDictOption.H" + argList::addOption("dict", "file", "Use alternative coordinateSystems"); + argList::addOption ( "from", diff --git a/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C b/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C index 9c2d94aaa7..e14d0b9024 100644 --- a/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C +++ b/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C @@ -28,16 +28,15 @@ Group grpSurfaceUtilities Description - Extracts surface from a polyMesh. Depending on output surface format - triangulates faces. + Extract patch or faceZone surfaces 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. + Region numbers on faces no guaranteed to be the same as the patch indices. - Optionally only triangulates named patches. + Optionally only extracts named patches. - If run in parallel the processor patches get filtered out by default and - the mesh gets merged (based on topology). + If run in parallel, processor patches get filtered out by default and + the mesh is merged (based on topology). \*---------------------------------------------------------------------------*/ @@ -62,7 +61,9 @@ int main(int argc, char *argv[]) { argList::addNote ( - "Extract surface from a polyMesh" + "Extract patch or faceZone surfaces from a polyMesh." + " The name is historical, it only triangulates faces" + " when the output format requires it." ); timeSelector::addOptions(); @@ -77,14 +78,16 @@ int main(int argc, char *argv[]) argList::addOption ( "patches", - "(patch0 .. patchN)", - "Only triangulate selected patches (wildcards supported)" + "wordRes" + "Specify single patch or multiple patches to extract.\n" + "Eg, 'top' or '( front \".*back\" )'" ); argList::addOption ( "faceZones", - "(fz0 .. fzN)", - "Triangulate selected faceZones (wildcards supported)" + "wordRes", + "Specify single or multiple faceZones to extract\n" + "Eg, 'cells' or '( slice \"mfp-.*\" )'" ); #include "setRootCase.H" @@ -99,8 +102,7 @@ int main(int argc, char *argv[]) << exit(FatalError); } - Info<< "Extracting surface from boundaryMesh ..." - << endl << endl; + Info<< "Extracting surface from boundaryMesh ..." << nl << nl; const bool includeProcPatches = !( @@ -134,7 +136,6 @@ int main(int argc, char *argv[]) if (timeDirs.size() == 1) { outFileName = userOutFileName; - Info<< nl; } else { @@ -144,15 +145,11 @@ int main(int argc, char *argv[]) Info<<" ... no mesh change." << nl; continue; } - else - { - Info<< nl; - } // The filename based on the original, but with additional // time information. The extension was previously checked that // it exists - std::string::size_type dot = userOutFileName.rfind('.'); + const auto dot = userOutFileName.rfind('.'); outFileName = userOutFileName.substr(0, dot) + "_" @@ -160,6 +157,8 @@ int main(int argc, char *argv[]) + userOutFileName.ext(); } + Info<< nl; + // Create local surface from: // - explicitly named patches only (-patches (at your option) // - all patches (default in sequential mode) @@ -170,37 +169,39 @@ int main(int argc, char *argv[]) // Construct table of patches to include. const polyBoundaryMesh& bMesh = mesh.boundaryMesh(); - labelHashSet includePatches(bMesh.size()); + labelList includePatches; if (args.found("patches")) { - includePatches = bMesh.patchSet(args.getList("patches")); + includePatches = + bMesh.patchSet(args.getList("patches")).sortedToc(); + } + else if (includeProcPatches) + { + includePatches = identity(bMesh.size()); } else { - forAll(bMesh, patchi) - { - const polyPatch& patch = bMesh[patchi]; - - if (includeProcPatches || !isA(patch)) - { - includePatches.insert(patchi); - } - } + includePatches = identity(bMesh.nNonProcessor()); } + labelList includeFaceZones; + const faceZoneMesh& fzm = mesh.faceZones(); - labelHashSet includeFaceZones(fzm.size()); if (args.found("faceZones")) { - wordReList zoneNames(args.getList("faceZones")); const wordList allZoneNames(fzm.names()); + + const wordRes zoneNames(args.getList("faceZones")); + + labelHashSet hashed(2*fzm.size()); + for (const wordRe& zoneName : zoneNames) { labelList zoneIDs = findStrings(zoneName, allZoneNames); - includeFaceZones.insert(zoneIDs); + hashed.insert(zoneIDs); if (zoneIDs.empty()) { @@ -209,17 +210,15 @@ int main(int argc, char *argv[]) << zoneName << endl; } } - Info<< "Additionally triangulating faceZones " - << UIndirectList - ( - allZoneNames, - includeFaceZones.sortedToc() - ) + + includeFaceZones = hashed.sortedToc(); + + Info<< "Additionally extracting faceZones " + << UIndirectList(allZoneNames, includeFaceZones) << endl; } - // From (name of) patch to compact 'zone' index HashTable