ENH: add -verbose option to surface conversion, cleanup

- by default, reduce the amount of output

ENH: support default text description for -verbose option

- simplifies use in more places.
This commit is contained in:
Mark Olesen
2023-05-08 18:15:00 +02:00
parent bddda09a08
commit 16591012e9
22 changed files with 54 additions and 43 deletions

View File

@ -200,7 +200,7 @@ int main(int argc, char *argv[])
// Less frequently used - reduce some clutter // Less frequently used - reduce some clutter
argList::setAdvanced("decomposeParDict"); argList::setAdvanced("decomposeParDict");
argList::addVerboseOption("Additional verbosity"); argList::addVerboseOption();
#include "addAllRegionOptions.H" #include "addAllRegionOptions.H"

View File

@ -78,10 +78,7 @@ int main(int argc, char *argv[])
"detail", "detail",
"Additional detail" "Additional detail"
); );
argList::addVerboseOption argList::addVerboseOption();
(
"Additional verbosity"
);
argList::addArgument("lib..."); argList::addArgument("lib...");
argList::noMandatoryArgs(); // Arguments are optional argList::noMandatoryArgs(); // Arguments are optional

View File

@ -235,10 +235,7 @@ int main(int argc, char *argv[])
( (
"Report action without moving/renaming" "Report action without moving/renaming"
); );
argList::addVerboseOption argList::addVerboseOption();
(
"Additional verbosity"
);
// Arguments are optional (non-mandatory) // Arguments are optional (non-mandatory)
argList::noMandatoryArgs(); argList::noMandatoryArgs();

View File

@ -334,7 +334,7 @@ int main(int argc, char *argv[])
"Test without writing the decomposition. " "Test without writing the decomposition. "
"Changes -cellDist to only write VTK output." "Changes -cellDist to only write VTK output."
); );
argList::addVerboseOption("Additional verbosity"); argList::addVerboseOption();
argList::addOption argList::addOption
( (
"domains", "domains",

View File

@ -92,7 +92,7 @@ int main(int argc, char *argv[])
#include "addAllRegionOptions.H" #include "addAllRegionOptions.H"
argList::addVerboseOption("Additional verbosity"); argList::addVerboseOption();
argList::addOption argList::addOption
( (
"fields", "fields",

View File

@ -594,7 +594,7 @@ int main(int argc, char *argv[])
argList::noParallel(); argList::noParallel();
argList::addVerboseOption("Additional verbosity"); argList::addVerboseOption();
argList::addBoolOption argList::addBoolOption
( (
"addressing-only", "addressing-only",

View File

@ -1020,7 +1020,7 @@ int main(int argc, char *argv[])
#include "addOverwriteOption.H" #include "addOverwriteOption.H"
argList::addBoolOption("decompose", "Decompose case"); argList::addBoolOption("decompose", "Decompose case");
argList::addBoolOption("reconstruct", "Reconstruct case"); argList::addBoolOption("reconstruct", "Reconstruct case");
argList::addVerboseOption("Additional verbosity"); argList::addVerboseOption();
argList::addDryRunOption argList::addDryRunOption
( (
"Test without writing the decomposition. " "Test without writing the decomposition. "

View File

@ -169,7 +169,7 @@ int main(int argc, char *argv[])
// Less frequently used - reduce some clutter // Less frequently used - reduce some clutter
argList::setAdvanced("decomposeParDict"); argList::setAdvanced("decomposeParDict");
argList::addVerboseOption("Additional verbosity"); argList::addVerboseOption();
#include "addAllRegionOptions.H" #include "addAllRegionOptions.H"

View File

@ -269,7 +269,7 @@ int main(int argc, char *argv[])
// Less frequently used - reduce some clutter // Less frequently used - reduce some clutter
argList::setAdvanced("decomposeParDict"); argList::setAdvanced("decomposeParDict");
argList::addVerboseOption("Additional verbosity"); argList::addVerboseOption();
argList::addBoolOption argList::addBoolOption
( (

View File

@ -115,7 +115,7 @@ int main(int argc, char *argv[])
"The writer format " "The writer format "
"(default: vtk or 'setFormat' from dictionary)" "(default: vtk or 'setFormat' from dictionary)"
); );
argList::addVerboseOption("Additional verbosity"); argList::addVerboseOption();
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"

View File

@ -172,7 +172,7 @@ int main(int argc, char *argv[])
"file", "file",
"Alternative particleTrackDict dictionary" "Alternative particleTrackDict dictionary"
); );
argList::addVerboseOption("Additional verbosity"); argList::addVerboseOption();
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"

View File

@ -72,10 +72,7 @@ int main(int argc, char *argv[])
"Suppress calculation/display of point interpolators" "Suppress calculation/display of point interpolators"
); );
argList::addVerboseOption argList::addVerboseOption();
(
"Additional verbosity"
);
#include "addRegionOption.H" #include "addRegionOption.H"
#include "setRootCase.H" #include "setRootCase.H"

View File

@ -58,7 +58,7 @@ int main(int argc, char *argv[])
); );
argList::noCheckProcessorDirectories(); argList::noCheckProcessorDirectories();
argList::addVerboseOption("Additional verbosity"); argList::addVerboseOption();
argList::addArgument("input", "The input surface file"); argList::addArgument("input", "The input surface file");

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2021 OpenCFD Ltd. Copyright (C) 2016-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -80,6 +80,7 @@ int main(int argc, char *argv[])
"factor", "factor",
"Geometry scaling factor on input surfaces" "Geometry scaling factor on input surfaces"
); );
argList::addVerboseOption();
argList args(argc, argv); argList args(argc, argv);
@ -87,6 +88,7 @@ int main(int argc, char *argv[])
const auto inFileName2 = args.get<fileName>(2); const auto inFileName2 = args.get<fileName>(2);
const auto outFileName = args.get<fileName>(3); const auto outFileName = args.get<fileName>(3);
const int optVerbose = args.verbose();
const bool addPoint = args.found("points"); const bool addPoint = args.found("points");
const bool mergeRegions = args.found("mergeRegions"); const bool mergeRegions = args.found("mergeRegions");
@ -284,7 +286,7 @@ int main(int argc, char *argv[])
} }
// Merge all common points and do some checks // Merge all common points and do some checks
combinedSurf.cleanup(true); combinedSurf.cleanup(optVerbose);
Info<< "Merged surface:" << endl; Info<< "Merged surface:" << endl;

View File

@ -308,10 +308,7 @@ int main(int argc, char *argv[])
"Split surface along non-manifold edges " "Split surface along non-manifold edges "
"(default split is fully disconnected)" "(default split is fully disconnected)"
); );
argList::addVerboseOption argList::addVerboseOption();
(
"Additional verbosity"
);
argList::addBoolOption argList::addBoolOption
( (
"blockMesh", "blockMesh",

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2013 OpenFOAM Foundation Copyright (C) 2011-2013 OpenFOAM Foundation
Copyright (C) 2020-2021 OpenCFD Ltd. Copyright (C) 2020-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -73,6 +73,7 @@ int main(int argc, char *argv[])
"Suppress surface checking/cleanup on the input surface" "Suppress surface checking/cleanup on the input surface"
); );
argList::addOptionCompat("no-clean", {"noClean", -2006}); argList::addOptionCompat("no-clean", {"noClean", -2006});
argList::addVerboseOption();
argList::addOption argList::addOption
( (
@ -87,6 +88,8 @@ int main(int argc, char *argv[])
const auto minQuality = args.get<scalar>(3); const auto minQuality = args.get<scalar>(3);
const auto outFileName = args.get<fileName>(4); const auto outFileName = args.get<fileName>(4);
const int optVerbose = args.verbose();
Info<< "Reading surface " << inFileName << nl Info<< "Reading surface " << inFileName << nl
<< "Collapsing all triangles with" << nl << "Collapsing all triangles with" << nl
<< " edges or heights < " << minLen << nl << " edges or heights < " << minLen << nl
@ -106,7 +109,7 @@ int main(int argc, char *argv[])
if (!args.found("no-clean")) if (!args.found("no-clean"))
{ {
Info<< "Removing duplicate and illegal triangles ..." << nl << endl; Info<< "Removing duplicate and illegal triangles ..." << nl << endl;
surf.cleanup(true); surf.cleanup(optVerbose);
} }
Info<< "Collapsing triangles to edges ..." << nl << endl; Info<< "Collapsing triangles to edges ..." << nl << endl;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020-2022 OpenCFD Ltd. Copyright (C) 2020-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -144,6 +144,7 @@ int main(int argc, char *argv[])
"The output precision" "The output precision"
); );
argList::addOptionCompat("precision", {"writePrecision", 1812}); argList::addOptionCompat("precision", {"writePrecision", 1812});
argList::addVerboseOption();
argList args(argc, argv); argList args(argc, argv);
@ -161,6 +162,8 @@ int main(int argc, char *argv[])
const auto importName = args.get<fileName>(1); const auto importName = args.get<fileName>(1);
const auto exportName = args.get<fileName>(2); const auto exportName = args.get<fileName>(2);
const int optVerbose = args.verbose();
if (importName == exportName) if (importName == exportName)
{ {
FatalError FatalError
@ -207,7 +210,7 @@ int main(int argc, char *argv[])
if (args.found("clean")) if (args.found("clean"))
{ {
Info<< "Cleaning up surface" << endl; Info<< "Cleaning up surface" << endl;
surf.cleanup(true); surf.cleanup(optVerbose);
Info<< "After cleaning up surface:" << endl; Info<< "After cleaning up surface:" << endl;
surf.writeStats(Info); surf.writeStats(Info);

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2022 OpenCFD Ltd. Copyright (C) 2018-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -127,6 +127,7 @@ int main(int argc, char *argv[])
"clean", "clean",
"Perform some surface checking/cleanup on the input surface" "Perform some surface checking/cleanup on the input surface"
); );
argList::addVerboseOption();
argList::addOption argList::addOption
( (
"read-format", "read-format",
@ -177,13 +178,14 @@ int main(int argc, char *argv[])
"Triangulate surface" "Triangulate surface"
); );
argList args(argc, argv); argList args(argc, argv);
Time runTime(args.rootPath(), args.caseName()); Time runTime(args.rootPath(), args.caseName());
const auto importName = args.get<fileName>(1); const auto importName = args.get<fileName>(1);
const auto exportName = args.get<fileName>(2); const auto exportName = args.get<fileName>(2);
const int optVerbose = args.verbose();
if (importName == exportName) if (importName == exportName)
{ {
FatalError FatalError
@ -298,7 +300,7 @@ int main(int argc, char *argv[])
if (args.found("clean")) if (args.found("clean"))
{ {
surf.cleanup(true); surf.cleanup(optVerbose);
} }
if (fromCsys) if (fromCsys)

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2022 OpenCFD Ltd. Copyright (C) 2018-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -105,6 +105,7 @@ int main(int argc, char *argv[])
"clean", "clean",
"Perform some surface checking/cleanup on the input surface" "Perform some surface checking/cleanup on the input surface"
); );
argList::addVerboseOption();
argList::addOption argList::addOption
( (
"name", "name",
@ -157,6 +158,8 @@ int main(int argc, char *argv[])
const auto exportName = args.get<fileName>(1); const auto exportName = args.get<fileName>(1);
const auto importName = args.getOrDefault<word>("name", "default"); const auto importName = args.getOrDefault<word>("name", "default");
const int optVerbose = args.verbose();
const word writeFileType const word writeFileType
( (
args.getOrDefault<word>("write-format", getExtension(exportName)) args.getOrDefault<word>("write-format", getExtension(exportName))
@ -273,7 +276,7 @@ int main(int argc, char *argv[])
if (args.found("clean")) if (args.found("clean"))
{ {
surf.cleanup(true); surf.cleanup(optVerbose);
} }
if (fromCsys) if (fromCsys)

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2022 OpenCFD Ltd. Copyright (C) 2018-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -105,6 +105,7 @@ int main(int argc, char *argv[])
"clean", "clean",
"Perform some surface checking/cleanup on the input surface" "Perform some surface checking/cleanup on the input surface"
); );
argList::addVerboseOption();
argList::addOption argList::addOption
( (
"name", "name",
@ -169,6 +170,8 @@ int main(int argc, char *argv[])
const auto importName = args.get<fileName>(1); const auto importName = args.get<fileName>(1);
const auto exportName = args.getOrDefault<word>("name", "default"); const auto exportName = args.getOrDefault<word>("name", "default");
const int optVerbose = args.verbose();
const word readFileType const word readFileType
( (
args.getOrDefault<word>("read-format", getExtension(importName)) args.getOrDefault<word>("read-format", getExtension(importName))
@ -268,7 +271,7 @@ int main(int argc, char *argv[])
if (args.found("clean")) if (args.found("clean"))
{ {
surf.cleanup(true); surf.cleanup(optVerbose);
} }
if (fromCsys) if (fromCsys)

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2022 OpenCFD Ltd. Copyright (C) 2015-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -514,7 +514,14 @@ void Foam::argList::addVerboseOption
bool advanced bool advanced
) )
{ {
argList::addBoolOption("verbose", usage, advanced); if (usage.empty())
{
argList::addBoolOption("verbose", "Additional verbosity", advanced);
}
else
{
argList::addBoolOption("verbose", usage, advanced);
}
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2016-2022 OpenCFD Ltd. Copyright (C) 2016-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -628,7 +628,7 @@ public:
//- Enable a 'verbose' bool option, with usage information //- Enable a 'verbose' bool option, with usage information
static void addVerboseOption static void addVerboseOption
( (
const string& usage, //! usage information (expected) const string& usage = "", //! usage information (optional)
bool advanced = false bool advanced = false
); );