adjust solvers and utilities to use new argList methods

- also drop various unused time options from src/OpenFOAM/include
This commit is contained in:
Mark Olesen
2009-05-19 20:21:50 +02:00
parent 724b034cc7
commit d1295da31f
96 changed files with 344 additions and 513 deletions

View File

@ -47,11 +47,7 @@
); );
word kinematicCloudName("kinematicCloud"); word kinematicCloudName("kinematicCloud");
args.optionReadIfPresent("cloudName", kinematicCloudName);
if (args.options().found("cloudName"))
{
kinematicCloudName = args.options()["cloudName"];
}
Info<< "Constructing kinematicCloud " << kinematicCloudName << endl; Info<< "Constructing kinematicCloud " << kinematicCloudName << endl;
basicKinematicCloud kinematicCloud basicKinematicCloud kinematicCloud

View File

@ -97,7 +97,7 @@ int main(int argc, char *argv[])
U.write(); U.write();
phi.write(); phi.write();
if (args.options().found("writep")) if (args.optionFound("writep"))
{ {
p.write(); p.write();
} }

View File

@ -465,7 +465,7 @@ int main(int argc, char *argv[])
scalar minLen(readScalar(IStringStream(args.additionalArgs()[0])())); scalar minLen(readScalar(IStringStream(args.additionalArgs()[0])()));
scalar angle(readScalar(IStringStream(args.additionalArgs()[1])())); scalar angle(readScalar(IStringStream(args.additionalArgs()[1])()));
bool overwrite = args.options().found("overwrite"); bool overwrite = args.optionFound("overwrite");
scalar maxCos = Foam::cos(angle*180/mathematicalConstant::pi); scalar maxCos = Foam::cos(angle*180/mathematicalConstant::pi);

View File

@ -448,19 +448,12 @@ int main(int argc, char *argv[])
scalar minCos = Foam::cos(featureAngle*mathematicalConstant::pi/180.0); scalar minCos = Foam::cos(featureAngle*mathematicalConstant::pi/180.0);
scalar concaveAngle = defaultConcaveAngle; scalar concaveAngle = defaultConcaveAngle;
args.optionReadIfPresent("concaveAngle", concaveAngle);
if (args.options().found("concaveAngle"))
{
concaveAngle = readScalar
(
IStringStream(args.options()["concaveAngle"])()
);
}
scalar concaveSin = Foam::sin(concaveAngle*mathematicalConstant::pi/180.0); scalar concaveSin = Foam::sin(concaveAngle*mathematicalConstant::pi/180.0);
bool snapMeshDict = args.options().found("snapMesh"); bool snapMeshDict = args.optionFound("snapMesh");
bool overwrite = args.options().found("overwrite"); bool overwrite = args.optionFound("overwrite");
Info<< "Merging all faces of a cell" << nl Info<< "Merging all faces of a cell" << nl
<< " - which are on the same patch" << nl << " - which are on the same patch" << nl

View File

@ -336,7 +336,7 @@ int main(int argc, char *argv[])
# include "createPolyMesh.H" # include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();
bool overwrite = args.options().found("overwrite"); bool overwrite = args.optionFound("overwrite");
Info<< "Reading modifyMeshDict\n" << endl; Info<< "Reading modifyMeshDict\n" << endl;

View File

@ -63,7 +63,7 @@ int main(int argc, char *argv[])
pointMesh pMesh(mesh); pointMesh pMesh(mesh);
word cellSetName(args.args()[1]); word cellSetName(args.args()[1]);
bool overwrite = args.options().found("overwrite"); bool overwrite = args.optionFound("overwrite");
Info<< "Reading cells to refine from cellSet " << cellSetName Info<< "Reading cells to refine from cellSet " << cellSetName
<< nl << endl; << nl << endl;

View File

@ -61,7 +61,7 @@ int main(int argc, char *argv[])
word patchName(args.additionalArgs()[0]); word patchName(args.additionalArgs()[0]);
scalar weight(readScalar(IStringStream(args.additionalArgs()[1])())); scalar weight(readScalar(IStringStream(args.additionalArgs()[1])()));
bool overwrite = args.options().found("overwrite"); bool overwrite = args.optionFound("overwrite");
label patchID = mesh.boundaryMesh().findPatchID(patchName); label patchID = mesh.boundaryMesh().findPatchID(patchName);
@ -101,11 +101,11 @@ int main(int argc, char *argv[])
// List of cells to refine // List of cells to refine
// //
bool useSet = args.options().found("useSet"); bool useSet = args.optionFound("useSet");
if (useSet) if (useSet)
{ {
word setName(args.options()["useSet"]); word setName(args.option("useSet"));
Info<< "Subsetting cells to cut based on cellSet" << setName << endl Info<< "Subsetting cells to cut based on cellSet" << setName << endl
<< endl; << endl;

View File

@ -110,7 +110,7 @@ int main(int argc, char *argv[])
<< " to allow for some truncation error." << " to allow for some truncation error."
<< nl << endl; << nl << endl;
bool readLevel = args.options().found("readLevel"); bool readLevel = args.optionFound("readLevel");
const scalarField& vols = mesh.cellVolumes(); const scalarField& vols = mesh.cellVolumes();

View File

@ -57,7 +57,7 @@ int main(int argc, char *argv[])
# include "createMesh.H" # include "createMesh.H"
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();
bool overwrite = args.options().found("overwrite"); bool overwrite = args.optionFound("overwrite");
word setName(args.additionalArgs()[0]); word setName(args.additionalArgs()[0]);

View File

@ -542,23 +542,19 @@ int main(int argc, char *argv[])
scalar minCos = Foam::cos(radAngle); scalar minCos = Foam::cos(radAngle);
scalar minSin = Foam::sin(radAngle); scalar minSin = Foam::sin(radAngle);
bool readSet = args.options().found("set"); bool readSet = args.optionFound("set");
bool geometry = args.options().found("geometry"); bool geometry = args.optionFound("geometry");
bool overwrite = args.options().found("overwrite"); bool overwrite = args.optionFound("overwrite");
scalar edgeTol = 0.2; scalar edgeTol = 0.2;
args.optionReadIfPresent("tol", edgeTol);
if (args.options().found("tol"))
{
edgeTol = readScalar(IStringStream(args.options()["tol"])());
}
Info<< "Trying to split cells with internal angles > feature angle\n" << nl Info<< "Trying to split cells with internal angles > feature angle\n" << nl
<< "featureAngle : " << featureAngle << nl << "featureAngle : " << featureAngle << nl
<< "edge snapping tol : " << edgeTol << nl; << "edge snapping tol : " << edgeTol << nl;
if (readSet) if (readSet)
{ {
Info<< "candidate cells : cellSet " << args.options()["set"] << nl; Info<< "candidate cells : cellSet " << args.option("set") << nl;
} }
else else
{ {
@ -586,7 +582,7 @@ int main(int argc, char *argv[])
if (readSet) if (readSet)
{ {
// Read cells to cut from cellSet // Read cells to cut from cellSet
cellSet cells(mesh, args.options()["set"]); cellSet cells(mesh, args.option("set"));
cellsToCut = cells; cellsToCut = cells;
} }

View File

@ -1,4 +1,4 @@
/*---------------------------------------------------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
@ -246,10 +246,7 @@ int main(int argc, char *argv[])
} }
scalar scaleFactor = 1.0; scalar scaleFactor = 1.0;
if (args.options().found("scale")) args.optionReadIfPresent("scale", scaleFactor);
{
scaleFactor = atof(args.options()["scale"].c_str());
}
# include "createTime.H" # include "createTime.H"

View File

@ -60,10 +60,7 @@ int main(int argc, char *argv[])
} }
scalar scaleFactor = 1.0; scalar scaleFactor = 1.0;
if (args.options().found("scale")) args.optionReadIfPresent("scale", scaleFactor);
{
scaleFactor = atof(args.options()["scale"].c_str());
}
# include "createTime.H" # include "createTime.H"

View File

@ -1,4 +1,4 @@
/*---------------------------------------------------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
@ -760,21 +760,18 @@ int main(int argc, char *argv[])
FatalError.exit(); FatalError.exit();
} }
if (args.options().found("scale")) args.optionReadIfPresent("scale", scaleFactor);
{
scaleFactor = atof(args.options()["scale"].c_str());
}
HashSet<word> ignoreCellGroups; HashSet<word> ignoreCellGroups;
if (args.options().found("ignoreCellGroups")) if (args.optionFound("ignoreCellGroups"))
{ {
IStringStream(args.options()["ignoreCellGroups"])() >> ignoreCellGroups; args.optionLookup("ignoreCellGroups")() >> ignoreCellGroups;
} }
HashSet<word> ignoreFaceGroups; HashSet<word> ignoreFaceGroups;
if (args.options().found("ignoreFaceGroups")) if (args.optionFound("ignoreFaceGroups"))
{ {
IStringStream(args.options()["ignoreFaceGroups"])() >> ignoreFaceGroups; args.optionLookup("ignoreFaceGroups")() >> ignoreFaceGroups;
} }
# include "createTime.H" # include "createTime.H"

View File

@ -879,13 +879,10 @@ int main(int argc, char *argv[])
} }
scalar scaleFactor = 1.0; scalar scaleFactor = 1.0;
if (args.options().found("scale")) args.optionReadIfPresent("scale", scaleFactor);
{
scaleFactor = atof(args.options()["scale"].c_str());
}
bool writeSets = args.options().found("writeSets"); bool writeSets = args.optionFound("writeSets");
bool writeZones = args.options().found("writeZones"); bool writeZones = args.optionFound("writeZones");
# include "createTime.H" # include "createTime.H"

View File

@ -87,7 +87,7 @@ int main(int argc, char *argv[])
instantList timeDirs = timeSelector::select0(runTime, args); instantList timeDirs = timeSelector::select0(runTime, args);
bool surfaceOnly = false; bool surfaceOnly = false;
if (args.options().found("surface") or args.options().found("tri")) if (args.optionFound("surface") || args.optionFound("tri"))
{ {
surfaceOnly = true; surfaceOnly = true;
} }
@ -98,16 +98,15 @@ int main(int argc, char *argv[])
exportName = meshWriter::defaultSurfaceName; exportName = meshWriter::defaultSurfaceName;
} }
if (args.options().found("case")) if (args.optionFound("case"))
{ {
exportName += '-' + args.globalCaseName(); exportName += '-' + args.globalCaseName();
} }
// default: rescale from [m] to [mm] // default: rescale from [m] to [mm]
scalar scaleFactor = 1000; scalar scaleFactor = 1000;
if (args.options().found("scale")) if (args.optionReadIfPresent("scale", scaleFactor))
{ {
scaleFactor = readScalar(IStringStream(args.options()["scale"])());
if (scaleFactor <= 0) if (scaleFactor <= 0)
{ {
scaleFactor = 1; scaleFactor = 1;
@ -129,7 +128,7 @@ int main(int argc, char *argv[])
{ {
meshWriters::STARCD writer(mesh, scaleFactor); meshWriters::STARCD writer(mesh, scaleFactor);
if (args.options().found("noBnd")) if (args.optionFound("noBnd"))
{ {
writer.noBoundary(); writer.noBoundary();
} }
@ -142,7 +141,7 @@ int main(int argc, char *argv[])
if (surfaceOnly) if (surfaceOnly)
{ {
if (args.options().found("tri")) if (args.optionFound("tri"))
{ {
writer.writeSurface(meshName, true); writer.writeSurface(meshName, true);
} }

View File

@ -1,4 +1,4 @@
/*---------------------------------------------------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
@ -646,10 +646,7 @@ int main(int argc, char *argv[])
} }
scalar scaleFactor = 1.0; scalar scaleFactor = 1.0;
if (args.options().found("scale")) args.optionReadIfPresent("scale", scaleFactor);
{
scaleFactor = atof(args.options()["scale"].c_str());
}
# include "createTime.H" # include "createTime.H"

View File

@ -689,7 +689,7 @@ int main(int argc, char *argv[])
fileName mshName(args.additionalArgs()[0]); fileName mshName(args.additionalArgs()[0]);
bool keepOrientation = args.options().found("keepOrientation"); bool keepOrientation = args.optionFound("keepOrientation");
// Storage for points // Storage for points
pointField points; pointField points;

View File

@ -852,7 +852,7 @@ int main(int argc, char *argv[])
// For debugging: dump boundary faces as triSurface // For debugging: dump boundary faces as triSurface
if (args.options().found("dump")) if (args.optionFound("dump"))
{ {
DynamicList<labelledTri> triangles(boundaryFaces.size()); DynamicList<labelledTri> triangles(boundaryFaces.size());

View File

@ -68,15 +68,15 @@ int main(int argc, char *argv[])
# include "createTime.H" # include "createTime.H"
fileName kivaFileName("otape17"); fileName kivaFileName("otape17");
if (args.options().found("file")) if (args.optionFound("file"))
{ {
kivaFileName = args.options()["file"]; kivaFileName = args.option("file");
} }
kivaVersions kivaVersion = kiva3v; kivaVersions kivaVersion = kiva3v;
if (args.options().found("version")) if (args.optionFound("version"))
{ {
word kivaVersionName = args.options()["version"]; word kivaVersionName = args.option("version");
if (kivaVersionName == "kiva3") if (kivaVersionName == "kiva3")
{ {
@ -99,10 +99,7 @@ int main(int argc, char *argv[])
} }
scalar zHeadMin = -GREAT; scalar zHeadMin = -GREAT;
if (args.options().found("zHeadMin")) args.optionReadIfPresent("zHeadMin", zHeadMin);
{
zHeadMin = atof(args.options()["zHeadMin"].c_str());
}
# include "readKivaGrid.H" # include "readKivaGrid.H"

View File

@ -62,14 +62,12 @@ int main(int argc, char *argv[])
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
bool readHex(args.options().found("hex")); bool readHex = args.optionFound("hex");
fileName mshFile(args.additionalArgs()[0]); fileName mshFile(args.additionalArgs()[0]);
IFstream mshStream(mshFile); IFstream mshStream(mshFile);
label nCells; label nCells;
mshStream >> nCells; mshStream >> nCells;
if (readHex) if (readHex)

View File

@ -71,18 +71,14 @@ int main(int argc, char *argv[])
} }
scalar scaleFactor = 1.0; scalar scaleFactor = 1.0;
if (args.options().found("scale")) args.optionReadIfPresent("scale", scaleFactor);
{
scaleFactor = atof(args.options()["scale"].c_str());
}
bool readBlank = !args.options().found("noBlank"); bool readBlank = !args.optionFound("noBlank");
bool singleBlock = args.options().found("singleBlock"); bool singleBlock = args.optionFound("singleBlock");
scalar twoDThicknes = -1; scalar twoDThickness = -1;
if (args.options().found("2D")) if (args.optionReadIfPresent("2D", twoDThickness))
{ {
twoDThicknes = readScalar(IStringStream(args.options()["2D"])()); Info<< "Reading 2D case by extruding points by " << twoDThickness
Info<< "Reading 2D case by extruding points by " << twoDThicknes
<< " in z direction." << nl << endl; << " in z direction." << nl << endl;
} }
@ -114,7 +110,7 @@ int main(int argc, char *argv[])
forAll (blocks, blockI) forAll (blocks, blockI)
{ {
if (twoDThicknes > 0) if (twoDThickness > 0)
{ {
// Fake second set of points (done in readPoints below) // Fake second set of points (done in readPoints below)
plot3dFile >> nx >> ny; plot3dFile >> nx >> ny;
@ -139,7 +135,7 @@ int main(int argc, char *argv[])
forAll (blocks, blockI) forAll (blocks, blockI)
{ {
Info<< "block " << blockI << ":" << nl; Info<< "block " << blockI << ":" << nl;
blocks[blockI].readPoints(readBlank, twoDThicknes, plot3dFile); blocks[blockI].readPoints(readBlank, twoDThickness, plot3dFile);
sumPoints += blocks[blockI].nBlockPoints(); sumPoints += blocks[blockI].nBlockPoints();
nMeshCells += blocks[blockI].nBlockCells(); nMeshCells += blocks[blockI].nBlockCells();
Info<< nl; Info<< nl;

View File

@ -381,9 +381,9 @@ int main(int argc, char *argv[])
<< endl; << endl;
const bool splitAllFaces = args.options().found("splitAllFaces"); const bool splitAllFaces = args.optionFound("splitAllFaces");
const bool overwrite = args.options().found("overwrite"); const bool overwrite = args.optionFound("overwrite");
const bool doNotPreserveFaceZones = args.options().found const bool doNotPreserveFaceZones = args.optionFound
( (
"doNotPreserveFaceZones" "doNotPreserveFaceZones"
); );

View File

@ -51,10 +51,7 @@ int main(int argc, char *argv[])
} }
scalar scaleFactor = 1.0; scalar scaleFactor = 1.0;
if (args.options().found("scale")) args.optionReadIfPresent("scale", scaleFactor);
{
scaleFactor = atof(args.options()["scale"].c_str());
}
# include "createTime.H" # include "createTime.H"

View File

@ -68,27 +68,26 @@ int main(int argc, char *argv[])
argList args(argc, argv); argList args(argc, argv);
Time runTime(args.rootPath(), args.caseName()); Time runTime(args.rootPath(), args.caseName());
stringList const& params = args.additionalArgs(); const stringList& params = args.additionalArgs();
// default rescale from [mm] to [m] // default rescale from [mm] to [m]
scalar scaleFactor = 0.001; scalar scaleFactor = 0.001;
if (args.options().found("scale")) if (args.optionReadIfPresent("scale", scaleFactor))
{ {
scaleFactor = readScalar(IStringStream(args.options()["scale"])());
if (scaleFactor <= 0) if (scaleFactor <= 0)
{ {
scaleFactor = 1; scaleFactor = 1;
} }
} }
if (args.options().found("solids")) if (args.optionFound("solids"))
{ {
meshReaders::STARCD::keepSolids = true; meshReaders::STARCD::keepSolids = true;
} }
// default to binary output, unless otherwise specified // default to binary output, unless otherwise specified
IOstream::streamFormat format = IOstream::BINARY; IOstream::streamFormat format = IOstream::BINARY;
if (args.options().found("ascii")) if (args.optionFound("ascii"))
{ {
format = IOstream::ASCII; format = IOstream::ASCII;
} }

View File

@ -51,10 +51,7 @@ int main(int argc, char *argv[])
} }
scalar scaleFactor = 1.0; scalar scaleFactor = 1.0;
if (args.options().found("scale")) args.optionReadIfPresent("scale", scaleFactor);
{
scaleFactor = atof(args.options()["scale"].c_str());
}
# include "createTime.H" # include "createTime.H"

View File

@ -103,7 +103,7 @@ int main(int argc, char *argv[])
# include "createTime.H" # include "createTime.H"
bool readFaceFile = !args.options().found("noFaceFile"); bool readFaceFile = !args.optionFound("noFaceFile");
fileName prefix(args.additionalArgs()[0]); fileName prefix(args.additionalArgs()[0]);

View File

@ -350,12 +350,12 @@ int main(int argc, char *argv[])
# include "createTime.H" # include "createTime.H"
runTime.functionObjects().off(); runTime.functionObjects().off();
bool patchFaces = args.options().found("patchFaces"); bool patchFaces = args.optionFound("patchFaces");
bool doCell = args.options().found("cell"); bool doCell = args.optionFound("cell");
bool doPoint = args.options().found("point"); bool doPoint = args.optionFound("point");
bool doFace = args.options().found("face"); bool doFace = args.optionFound("face");
bool doCellSet = args.options().found("cellSet"); bool doCellSet = args.optionFound("cellSet");
bool doFaceSet = args.options().found("faceSet"); bool doFaceSet = args.optionFound("faceSet");
Info<< "Writing mesh objects as .obj files such that the object" Info<< "Writing mesh objects as .obj files such that the object"
@ -383,22 +383,19 @@ int main(int argc, char *argv[])
} }
else if (doCell) else if (doCell)
{ {
label cellI = label cellI = args.optionRead<label>("cell");
readLabel(IStringStream(args.options()["cell"])());
writePoints(mesh, cellI, runTime.timeName()); writePoints(mesh, cellI, runTime.timeName());
} }
else if (doPoint) else if (doPoint)
{ {
label pointI = label pointI = args.optionRead<label>("point");
readLabel(IStringStream(args.options()["point"])());
writePointCells(mesh, pointI, runTime.timeName()); writePointCells(mesh, pointI, runTime.timeName());
} }
else if (doFace) else if (doFace)
{ {
label faceI = label faceI = args.optionRead<label>("face");
readLabel(IStringStream(args.options()["face"])());
fileName fName fileName fName
( (
@ -420,7 +417,7 @@ int main(int argc, char *argv[])
} }
else if (doCellSet) else if (doCellSet)
{ {
word setName(args.options()["cellSet"]); word setName(args.option("cellSet"));
cellSet cells(mesh, setName); cellSet cells(mesh, setName);
@ -432,7 +429,7 @@ int main(int argc, char *argv[])
} }
else if (doFaceSet) else if (doFaceSet)
{ {
word setName(args.options()["faceSet"]); word setName(args.option("faceSet"));
faceSet faces(mesh, setName); faceSet faces(mesh, setName);

View File

@ -83,10 +83,10 @@ int main(int argc, char *argv[])
word regionName; word regionName;
fileName polyMeshDir; fileName polyMeshDir;
if (args.options().found("region")) if (args.optionFound("region"))
{ {
// constant/<region>/polyMesh/blockMeshDict // constant/<region>/polyMesh/blockMeshDict
regionName = args.options()["region"]; regionName = args.option("region");
polyMeshDir = regionName/polyMesh::meshSubDir; polyMeshDir = regionName/polyMesh::meshSubDir;
Info<< nl << "Generating mesh for region " << regionName << endl; Info<< nl << "Generating mesh for region " << regionName << endl;
@ -100,9 +100,9 @@ int main(int argc, char *argv[])
autoPtr<IOobject> meshDictIoPtr; autoPtr<IOobject> meshDictIoPtr;
if (args.options().found("dict")) if (args.optionFound("dict"))
{ {
fileName dictPath(args.options()["dict"]); fileName dictPath(args.option("dict"));
meshDictIoPtr.set meshDictIoPtr.set
( (
@ -110,7 +110,7 @@ int main(int argc, char *argv[])
( (
( (
isDir(dictPath) isDir(dictPath)
? dictPath/dictName ? dictPath/dictName
: dictPath : dictPath
), ),
runTime, runTime,
@ -153,7 +153,7 @@ int main(int argc, char *argv[])
blockMesh blocks(meshDict); blockMesh blocks(meshDict);
if (args.options().found("blockTopology")) if (args.optionFound("blockTopology"))
{ {
// Write mesh as edges. // Write mesh as edges.
{ {

View File

@ -66,7 +66,7 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();
scalar thickness(readScalar(IStringStream(args.additionalArgs()[0])())); scalar thickness(readScalar(IStringStream(args.additionalArgs()[0])()));
bool overwrite = args.options().found("overwrite"); bool overwrite = args.optionFound("overwrite");
// Check that mesh is 2D // Check that mesh is 2D

View File

@ -55,7 +55,7 @@ int main(int argc, char *argv[])
#include "setRoots.H" #include "setRoots.H"
#include "createTimeExtruded.H" #include "createTimeExtruded.H"
if (args.options().found("sourceCase") == args.options().found("surface")) if (args.optionFound("sourceCase") == args.optionFound("surface"))
{ {
FatalErrorIn(args.executable()) FatalErrorIn(args.executable())
<< "Specify either -sourceCase and -sourcePatch" << "Specify either -sourceCase and -sourcePatch"
@ -83,12 +83,12 @@ int main(int argc, char *argv[])
) )
); );
if (args.options().found("sourceCase")) if (args.optionFound("sourceCase"))
{ {
fileName sourceCasePath(args.options()["sourceCase"]); fileName sourceCasePath(args.option("sourceCase"));
fileName sourceRootDir = sourceCasePath.path(); fileName sourceRootDir = sourceCasePath.path();
fileName sourceCaseDir = sourceCasePath.name(); fileName sourceCaseDir = sourceCasePath.name();
word patchName(args.options()["sourcePatch"]); word patchName(args.option("sourcePatch"));
Info<< "Extruding patch " << patchName Info<< "Extruding patch " << patchName
<< " on mesh " << sourceCasePath << nl << " on mesh " << sourceCasePath << nl
@ -144,7 +144,7 @@ int main(int argc, char *argv[])
else else
{ {
// Read from surface // Read from surface
fileName surfName(args.options()["surface"]); fileName surfName(args.option("surface"));
Info<< "Extruding surfaceMesh read from file " << surfName << nl Info<< "Extruding surfaceMesh read from file " << surfName << nl
<< endl; << endl;
@ -250,7 +250,7 @@ int main(int argc, char *argv[])
// Merging front and back patch faces // Merging front and back patch faces
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (args.options().found("mergeFaces")) if (args.optionFound("mergeFaces"))
{ {
Info<< "Assuming full 360 degree axisymmetric case;" Info<< "Assuming full 360 degree axisymmetric case;"
<< " stitching faces on patches " << " stitching faces on patches "

View File

@ -50,7 +50,7 @@ int main(int argc, char *argv[])
# include "createPolyMesh.H" # include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();
bool overwrite = args.options().found("overwrite"); bool overwrite = args.optionFound("overwrite");
if (!overwrite) if (!overwrite)
{ {

View File

@ -91,7 +91,7 @@ int main(int argc, char *argv[])
boundaryMesh bMesh; boundaryMesh bMesh;
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])())); scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
bool overwrite = args.options().found("overwrite"); bool overwrite = args.optionFound("overwrite");
scalar minCos = Foam::cos(featureAngle * mathematicalConstant::pi/180.0); scalar minCos = Foam::cos(featureAngle * mathematicalConstant::pi/180.0);

View File

@ -58,9 +58,9 @@ int main(int argc, char *argv[])
instantList timeDirs = timeSelector::select0(runTime, args); instantList timeDirs = timeSelector::select0(runTime, args);
# include "createNamedPolyMesh.H" # include "createNamedPolyMesh.H"
const bool noTopology = args.options().found("noTopology"); const bool noTopology = args.optionFound("noTopology");
const bool allGeometry = args.options().found("allGeometry"); const bool allGeometry = args.optionFound("allGeometry");
const bool allTopology = args.options().found("allTopology"); const bool allTopology = args.optionFound("allTopology");
forAll(timeDirs, timeI) forAll(timeDirs, timeI)
{ {

View File

@ -93,11 +93,11 @@ int main(int argc, char *argv[])
// Additional patches // Additional patches
if (args.options().found("additionalPatches")) if (args.optionFound("additionalPatches"))
{ {
const wordList patchNames const wordList patchNames
( (
IStringStream(args.options()["additionalPatches"])() args.optionLookup("additionalPatches")()
); );
newPatches.reserve(patchNames.size() + 1); newPatches.reserve(patchNames.size() + 1);
@ -120,7 +120,7 @@ int main(int argc, char *argv[])
} }
bool overwrite = args.options().found("overwrite"); bool overwrite = args.optionFound("overwrite");

View File

@ -539,7 +539,7 @@ int main(int argc, char *argv[])
# include "createTime.H" # include "createTime.H"
runTime.functionObjects().off(); runTime.functionObjects().off();
const bool overwrite = args.options().found("overwrite"); const bool overwrite = args.optionFound("overwrite");
Info<< "Reading createPatchDict." << nl << endl; Info<< "Reading createPatchDict." << nl << endl;

View File

@ -231,9 +231,9 @@ int main(int argc, char *argv[])
# include "createMesh.H" # include "createMesh.H"
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();
bool split = args.options().found("split"); bool split = args.optionFound("split");
bool overwrite = args.options().found("overwrite"); bool overwrite = args.optionFound("overwrite");
bool detectOnly = args.options().found("detectOnly"); bool detectOnly = args.optionFound("detectOnly");
// Collect all boundary faces // Collect all boundary faces
labelList boundaryFaces(mesh.nFaces() - mesh.nInternalFaces()); labelList boundaryFaces(mesh.nFaces() - mesh.nInternalFaces());

View File

@ -309,8 +309,8 @@ int main(int argc, char *argv[])
// Read/construct control dictionary // Read/construct control dictionary
// //
bool readDict = args.options().found("dict"); bool readDict = args.optionFound("dict");
bool overwrite = args.options().found("overwrite"); bool overwrite = args.optionFound("overwrite");
// List of cells to refine // List of cells to refine
labelList refCells; labelList refCells;

View File

@ -386,7 +386,7 @@ int main(int argc, char *argv[])
# include "createMesh.H" # include "createMesh.H"
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();
const bool blockOrder = args.options().found("blockOrder"); const bool blockOrder = args.optionFound("blockOrder");
if (blockOrder) if (blockOrder)
{ {
@ -395,7 +395,7 @@ int main(int argc, char *argv[])
<< endl; << endl;
} }
const bool orderPoints = args.options().found("orderPoints"); const bool orderPoints = args.optionFound("orderPoints");
if (orderPoints) if (orderPoints)
{ {
@ -403,7 +403,7 @@ int main(int argc, char *argv[])
<< endl; << endl;
} }
const bool writeMaps = args.options().found("writeMaps"); const bool writeMaps = args.optionFound("writeMaps");
if (writeMaps) if (writeMaps)
{ {
@ -411,7 +411,7 @@ int main(int argc, char *argv[])
<< endl; << endl;
} }
bool overwrite = args.options().found("overwrite"); bool overwrite = args.optionFound("overwrite");
label band = getBand(mesh.faceOwner(), mesh.faceNeighbour()); label band = getBand(mesh.faceOwner(), mesh.faceNeighbour());

View File

@ -723,7 +723,7 @@ int main(int argc, char *argv[])
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
bool writeVTK = !args.options().found("noVTK"); bool writeVTK = !args.optionFound("noVTK");
// Get times list // Get times list
instantList Times = runTime.times(); instantList Times = runTime.times();
@ -740,9 +740,9 @@ int main(int argc, char *argv[])
std::ifstream* fileStreamPtr(NULL); std::ifstream* fileStreamPtr(NULL);
if (args.options().found("batch")) if (args.optionFound("batch"))
{ {
fileName batchFile(args.options()["batch"]); fileName batchFile(args.option("batch"));
Pout<< "Reading commands from file " << batchFile << endl; Pout<< "Reading commands from file " << batchFile << endl;

View File

@ -65,7 +65,7 @@ int main(int argc, char *argv[])
# include "createTime.H" # include "createTime.H"
bool noFlipMap = args.options().found("noFlipMap"); bool noFlipMap = args.optionFound("noFlipMap");
// Get times list // Get times list
instantList Times = runTime.times(); instantList Times = runTime.times();

View File

@ -126,7 +126,7 @@ int main(int argc, char *argv[])
word setName(args.additionalArgs()[0]); word setName(args.additionalArgs()[0]);
word masterPatch(args.additionalArgs()[1]); word masterPatch(args.additionalArgs()[1]);
word slavePatch(args.additionalArgs()[2]); word slavePatch(args.additionalArgs()[2]);
bool overwrite = args.options().found("overwrite"); bool overwrite = args.optionFound("overwrite");
// List of faces to split // List of faces to split
faceSet facesSet(mesh, setName); faceSet facesSet(mesh, setName);

View File

@ -1239,20 +1239,20 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();
word blockedFacesName; word blockedFacesName;
if (args.options().found("blockedFaces")) if (args.optionFound("blockedFaces"))
{ {
blockedFacesName = args.options()["blockedFaces"]; blockedFacesName = args.option("blockedFaces");
Info<< "Reading blocked internal faces from faceSet " Info<< "Reading blocked internal faces from faceSet "
<< blockedFacesName << nl << endl; << blockedFacesName << nl << endl;
} }
bool makeCellZones = args.options().found("makeCellZones"); bool makeCellZones = args.optionFound("makeCellZones");
bool largestOnly = args.options().found("largestOnly"); bool largestOnly = args.optionFound("largestOnly");
bool insidePoint = args.options().found("insidePoint"); bool insidePoint = args.optionFound("insidePoint");
bool useCellZones = args.options().found("cellZones"); bool useCellZones = args.optionFound("cellZones");
bool overwrite = args.options().found("overwrite"); bool overwrite = args.optionFound("overwrite");
bool detectOnly = args.options().found("detectOnly"); bool detectOnly = args.optionFound("detectOnly");
bool sloppyCellZones = args.options().found("sloppyCellZones"); bool sloppyCellZones = args.optionFound("sloppyCellZones");
if (insidePoint && largestOnly) if (insidePoint && largestOnly)
{ {
@ -1771,7 +1771,7 @@ int main(int argc, char *argv[])
if (insidePoint) if (insidePoint)
{ {
point insidePoint(IStringStream(args.options()["insidePoint"])()); point insidePoint(args.optionLookup("insidePoint")());
label regionI = -1; label regionI = -1;

View File

@ -142,9 +142,9 @@ int main(int argc, char *argv[])
word masterPatchName(args.additionalArgs()[0]); word masterPatchName(args.additionalArgs()[0]);
word slavePatchName(args.additionalArgs()[1]); word slavePatchName(args.additionalArgs()[1]);
bool partialCover = args.options().found("partial"); bool partialCover = args.optionFound("partial");
bool perfectCover = args.options().found("perfect"); bool perfectCover = args.optionFound("perfect");
bool overwrite = args.options().found("overwrite"); bool overwrite = args.optionFound("overwrite");
if (partialCover && perfectCover) if (partialCover && perfectCover)
{ {

View File

@ -162,7 +162,7 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();
word setName(args.additionalArgs()[0]); word setName(args.additionalArgs()[0]);
bool overwrite = args.options().found("overwrite"); bool overwrite = args.optionFound("overwrite");
Info<< "Reading cell set from " << setName << endl << endl; Info<< "Reading cell set from " << setName << endl << endl;
@ -172,9 +172,9 @@ int main(int argc, char *argv[])
label patchI = -1; label patchI = -1;
if (args.options().found("patch")) if (args.optionFound("patch"))
{ {
word patchName(args.options()["patch"]); word patchName(args.option("patch"));
patchI = mesh.boundaryMesh().findPatchID(patchName); patchI = mesh.boundaryMesh().findPatchID(patchName);

View File

@ -144,7 +144,7 @@ int main(int argc, char *argv[])
argList::validOptions.insert("yawPitchRoll", "(yaw pitch roll)"); argList::validOptions.insert("yawPitchRoll", "(yaw pitch roll)");
argList::validOptions.insert("rotateFields", ""); argList::validOptions.insert("rotateFields", "");
argList::validOptions.insert("scale", "vector"); argList::validOptions.insert("scale", "vector");
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
@ -171,18 +171,18 @@ int main(int argc, char *argv[])
<< exit(FatalError); << exit(FatalError);
} }
if (args.options().found("translate")) if (args.optionFound("translate"))
{ {
vector transVector(IStringStream(args.options()["translate"])()); vector transVector(args.optionLookup("translate")());
Info<< "Translating points by " << transVector << endl; Info<< "Translating points by " << transVector << endl;
points += transVector; points += transVector;
} }
if (args.options().found("rotate")) if (args.optionFound("rotate"))
{ {
Pair<vector> n1n2(IStringStream(args.options()["rotate"])()); Pair<vector> n1n2(args.optionLookup("rotate")());
n1n2[0] /= mag(n1n2[0]); n1n2[0] /= mag(n1n2[0]);
n1n2[1] /= mag(n1n2[1]); n1n2[1] /= mag(n1n2[1]);
tensor T = rotationTensor(n1n2[0], n1n2[1]); tensor T = rotationTensor(n1n2[0], n1n2[1]);
@ -191,14 +191,14 @@ int main(int argc, char *argv[])
points = transform(T, points); points = transform(T, points);
if (args.options().found("rotateFields")) if (args.optionFound("rotateFields"))
{ {
rotateFields(runTime, T); rotateFields(runTime, T);
} }
} }
else if (args.options().found("rollPitchYaw")) else if (args.optionFound("rollPitchYaw"))
{ {
vector v(IStringStream(args.options()["rollPitchYaw"])()); vector v(args.optionLookup("rollPitchYaw")());
Info<< "Rotating points by" << nl Info<< "Rotating points by" << nl
<< " roll " << v.x() << nl << " roll " << v.x() << nl
@ -214,14 +214,14 @@ int main(int argc, char *argv[])
Info<< "Rotating points by quaternion " << R << endl; Info<< "Rotating points by quaternion " << R << endl;
points = transform(R, points); points = transform(R, points);
if (args.options().found("rotateFields")) if (args.optionFound("rotateFields"))
{ {
rotateFields(runTime, R.R()); rotateFields(runTime, R.R());
} }
} }
else if (args.options().found("yawPitchRoll")) else if (args.optionFound("yawPitchRoll"))
{ {
vector v(IStringStream(args.options()["yawPitchRoll"])()); vector v(args.optionLookup("yawPitchRoll")());
Info<< "Rotating points by" << nl Info<< "Rotating points by" << nl
<< " yaw " << v.x() << nl << " yaw " << v.x() << nl
@ -243,15 +243,15 @@ int main(int argc, char *argv[])
Info<< "Rotating points by quaternion " << R << endl; Info<< "Rotating points by quaternion " << R << endl;
points = transform(R, points); points = transform(R, points);
if (args.options().found("rotateFields")) if (args.optionFound("rotateFields"))
{ {
rotateFields(runTime, R.R()); rotateFields(runTime, R.R());
} }
} }
if (args.options().found("scale")) if (args.optionFound("scale"))
{ {
vector scaleVector(IStringStream(args.options()["scale"])()); vector scaleVector(args.optionLookup("scale")());
Info<< "Scaling points by " << scaleVector << endl; Info<< "Scaling points by " << scaleVector << endl;

View File

@ -50,7 +50,7 @@ int main(int argc, char *argv[])
wordList currInfo(debug::infoSwitches().toc()); wordList currInfo(debug::infoSwitches().toc());
wordList currOpt(debug::optimisationSwitches().toc()); wordList currOpt(debug::optimisationSwitches().toc());
if (args.options().found("old") || args.options().found("new")) if (args.optionFound("old") || args.optionFound("new"))
{ {
dictionary controlDict(IFstream(findEtcFile("controlDict", true))()); dictionary controlDict(IFstream(findEtcFile("controlDict", true))());
@ -80,7 +80,7 @@ int main(int argc, char *argv[])
// 1. run without any options (get complete list) // 1. run without any options (get complete list)
// 2. comment out DebugSwitches, run again with -new to find new ones // 2. comment out DebugSwitches, run again with -new to find new ones
// and do a diff // and do a diff
if (args.options().found("old")) if (args.optionFound("old"))
{ {
IOobject::writeDivider(Info); IOobject::writeDivider(Info);
@ -104,7 +104,7 @@ int main(int argc, char *argv[])
} }
// list new switches // list new switches
if (args.options().found("new")) if (args.optionFound("new"))
{ {
IOobject::writeDivider(Info); IOobject::writeDivider(Info);

View File

@ -49,9 +49,9 @@ int main(int argc, char *argv[])
Info<< endl; Info<< endl;
if (args.options().found("times")) if (args.optionFound("times"))
{ {
instantList times instantList times
( (
Foam::Time::findTimes(args.rootPath()/args.caseName()) Foam::Time::findTimes(args.rootPath()/args.caseName())
); );
@ -62,11 +62,11 @@ int main(int argc, char *argv[])
} }
} }
if (args.options().found("dictionary")) if (args.optionFound("dictionary"))
{ {
fileName dictFileName fileName dictFileName
( (
args.rootPath()/args.caseName()/args.options()["dictionary"] args.rootPath()/args.caseName()/args.option("dictionary")
); );
IFstream dictFile(dictFileName); IFstream dictFile(dictFileName);
@ -75,11 +75,7 @@ int main(int argc, char *argv[])
{ {
dictionary dict(dictFile); dictionary dict(dictFile);
if if (args.optionFound("keywords") && !args.optionFound("entry"))
(
args.options().found("keywords")
&& !args.options().found("entry")
)
{ {
for for
( (
@ -91,11 +87,11 @@ int main(int argc, char *argv[])
Info<< iter().keyword() << endl; Info<< iter().keyword() << endl;
} }
} }
else if (args.options().found("entry")) else if (args.optionFound("entry"))
{ {
wordList entryNames wordList entryNames
( (
fileName(args.options()["entry"]).components(':') fileName(args.option("entry")).components(':')
); );
if (dict.found(entryNames[0])) if (dict.found(entryNames[0]))
@ -122,20 +118,20 @@ int main(int argc, char *argv[])
{ {
FatalErrorIn(args.executable()) FatalErrorIn(args.executable())
<< "Cannot find sub-entry " << entryNames[i] << "Cannot find sub-entry " << entryNames[i]
<< " in entry " << args.options()["entry"] << " in entry " << args.option("entry")
<< " in dictionary " << dictFileName; << " in dictionary " << dictFileName;
FatalError.exit(3); FatalError.exit(3);
} }
} }
if (args.options().found("keywords")) if (args.optionFound("keywords"))
{ {
/* /*
if (ent[1] != token::BEGIN_BLOCK) if (ent[1] != token::BEGIN_BLOCK)
{ {
FatalErrorIn(args.executable()) FatalErrorIn(args.executable())
<< "Cannot find entry " << "Cannot find entry "
<< args.options()["entry"] << args.option("entry")
<< " in dictionary " << dictFileName << " in dictionary " << dictFileName
<< " is not a sub-dictionary"; << " is not a sub-dictionary";
FatalError.exit(4); FatalError.exit(4);

View File

@ -99,20 +99,20 @@ int main(int argc, char *argv[])
word regionName = fvMesh::defaultRegion; word regionName = fvMesh::defaultRegion;
word regionDir = word::null; word regionDir = word::null;
if (args.options().found("region")) if (args.optionFound("region"))
{ {
regionName = args.options()["region"]; regionName = args.option("region");
regionDir = regionName; regionDir = regionName;
Info<< "Decomposing mesh " << regionName << nl << endl; Info<< "Decomposing mesh " << regionName << nl << endl;
} }
bool writeCellDist(args.options().found("cellDist")); bool writeCellDist = args.optionFound("cellDist");
bool copyUniform(args.options().found("copyUniform")); bool copyUniform = args.optionFound("copyUniform");
bool decomposeFieldsOnly(args.options().found("fields")); bool decomposeFieldsOnly = args.optionFound("fields");
bool filterPatches(args.options().found("filterPatches")); bool filterPatches = args.optionFound("filterPatches");
bool forceOverwrite(args.options().found("force")); bool forceOverwrite = args.optionFound("force");
bool ifRequiredDecomposition(args.options().found("ifRequired")); bool ifRequiredDecomposition = args.optionFound("ifRequired");
# include "createTime.H" # include "createTime.H"

View File

@ -57,12 +57,12 @@ int main(int argc, char *argv[])
# include "createTime.H" # include "createTime.H"
HashSet<word> selectedFields; HashSet<word> selectedFields;
if (args.options().found("fields")) if (args.optionFound("fields"))
{ {
IStringStream(args.options()["fields"])() >> selectedFields; args.optionLookup("fields")() >> selectedFields;
} }
bool noLagrangian = args.options().found("noLagrangian"); bool noLagrangian = args.optionFound("noLagrangian");
// determine the processor count directly // determine the processor count directly
label nProcs = 0; label nProcs = 0;

View File

@ -306,18 +306,16 @@ int main(int argc, char *argv[])
word regionName = polyMesh::defaultRegion; word regionName = polyMesh::defaultRegion;
fileName regionPrefix = ""; fileName regionPrefix = "";
if (args.options().found("region")) if (args.optionFound("region"))
{ {
regionName = args.options()["region"]; regionName = args.option("region");
regionPrefix = regionName; regionPrefix = regionName;
Info<< "Operating on region " << regionName << nl << endl; Info<< "Operating on region " << regionName << nl << endl;
} }
scalar mergeTol = defaultMergeTol; scalar mergeTol = defaultMergeTol;
if (args.options().found("mergeTol")) args.optionReadIfPresent("mergeTol", mergeTol);
{
mergeTol = readScalar(IStringStream(args.options()["mergeTol"])());
}
scalar writeTol = Foam::pow(10.0, -scalar(IOstream::defaultPrecision())); scalar writeTol = Foam::pow(10.0, -scalar(IOstream::defaultPrecision()));
Info<< "Merge tolerance : " << mergeTol << nl Info<< "Merge tolerance : " << mergeTol << nl
@ -337,7 +335,7 @@ int main(int argc, char *argv[])
} }
const bool fullMatch = args.options().found("fullMatch"); const bool fullMatch = args.optionFound("fullMatch");
if (fullMatch) if (fullMatch)
{ {

View File

@ -240,10 +240,7 @@ scalar getMergeDistance
) )
{ {
scalar mergeTol = defaultMergeTol; scalar mergeTol = defaultMergeTol;
if (args.options().found("mergeTol")) args.optionReadIfPresent("mergeTol", mergeTol);
{
mergeTol = readScalar(IStringStream(args.options()["mergeTol"])());
}
scalar writeTol = scalar writeTol =
Foam::pow(scalar(10.0), -scalar(IOstream::defaultPrecision())); Foam::pow(scalar(10.0), -scalar(IOstream::defaultPrecision()));

View File

@ -107,7 +107,7 @@ Foam::ensightMesh::ensightMesh
const cellModel& wedge = *(cellModeller::lookup("wedge")); const cellModel& wedge = *(cellModeller::lookup("wedge"));
const cellModel& hex = *(cellModeller::lookup("hex")); const cellModel& hex = *(cellModeller::lookup("hex"));
if (!args.options().found("noPatches")) if (!args.optionFound("noPatches"))
{ {
forAll (mesh_.boundaryMesh(), patchI) forAll (mesh_.boundaryMesh(), patchI)
{ {
@ -136,9 +136,9 @@ Foam::ensightMesh::ensightMesh
combineReduce(allPatchNames_, concatPatchNames()); combineReduce(allPatchNames_, concatPatchNames());
if (args.options().found("patches")) if (args.optionFound("patches"))
{ {
wordList patchNameList(IStringStream(args.options()["patches"])()); wordList patchNameList(args.optionLookup("patches")());
if (patchNameList.empty()) if (patchNameList.empty())
{ {
@ -228,7 +228,7 @@ Foam::ensightMesh::ensightMesh
reduce(meshCellSets_.nPolys, sumOp<label>()); reduce(meshCellSets_.nPolys, sumOp<label>());
} }
if (!args.options().found("noPatches")) if (!args.optionFound("noPatches"))
{ {
forAll (mesh.boundary(), patchI) forAll (mesh.boundary(), patchI)
{ {

View File

@ -100,11 +100,7 @@ int main(int argc, char *argv[])
# include "setRootCase.H" # include "setRootCase.H"
// Check options // Check options
bool binary = true; bool binary = !args.optionFound("ascii");
if (args.options().found("ascii"))
{
binary = false;
}
# include "createTime.H" # include "createTime.H"

View File

@ -107,7 +107,7 @@ int main(int argc, char *argv[])
// default to binary output, unless otherwise specified // default to binary output, unless otherwise specified
IOstream::streamFormat format = IOstream::BINARY; IOstream::streamFormat format = IOstream::BINARY;
if (args.options().found("ascii")) if (args.optionFound("ascii"))
{ {
format = IOstream::ASCII; format = IOstream::ASCII;
} }
@ -115,14 +115,14 @@ int main(int argc, char *argv[])
// control for renumbering iterations // control for renumbering iterations
bool optIndex = false; bool optIndex = false;
label indexingNumber = 0; label indexingNumber = 0;
if (args.options().found("index")) if (args.optionFound("index"))
{ {
optIndex = true; optIndex = true;
indexingNumber = readLabel(IStringStream(args.options()["index"])()); indexingNumber = args.optionRead<label>("index");
} }
// always write the geometry, unless the -noMesh option is specified // always write the geometry, unless the -noMesh option is specified
bool optNoMesh = args.options().found("noMesh"); bool optNoMesh = args.optionFound("noMesh");
fileName ensightDir = args.rootPath()/args.globalCaseName()/"Ensight"; fileName ensightDir = args.rootPath()/args.globalCaseName()/"Ensight";
fileName dataDir = ensightDir/"data"; fileName dataDir = ensightDir/"data";

View File

@ -1,26 +0,0 @@
if (args.options().found("time"))
{
scalar time(readScalar(IStringStream(args.options()["time"])()));
int nearestIndex = -1;
scalar nearestDiff = Foam::GREAT;
forAll(Times, timeIndex)
{
scalar diff = fabs(Times[timeIndex].value() - time);
if (diff < nearestDiff)
{
nearestDiff = diff;
nearestIndex = timeIndex;
}
}
startTime = nearestIndex;
endTime = nearestIndex + 1;
}
else
{
startTime = 0;
endTime = Times.size();
}

View File

@ -307,7 +307,7 @@ int main(int argc, char *argv[])
new fieldviewTopology new fieldviewTopology
( (
mesh, mesh,
!args.options().found("noWall") !args.optionFound("noWall")
) )
); );

View File

@ -246,11 +246,10 @@ int main(int argc, char *argv[])
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
bool doWriteInternal = !args.options().found("noInternal"); bool doWriteInternal = !args.optionFound("noInternal");
bool doFaceZones = !args.options().found("noFaceZones"); bool doFaceZones = !args.optionFound("noFaceZones");
bool doLinks = !args.options().found("noLinks"); bool doLinks = !args.optionFound("noLinks");
bool binary = !args.optionFound("ascii");
bool binary = !args.options().found("ascii");
if (binary && (sizeof(floatScalar) != 4 || sizeof(label) != 4)) if (binary && (sizeof(floatScalar) != 4 || sizeof(label) != 4))
{ {
@ -260,7 +259,7 @@ int main(int argc, char *argv[])
<< exit(FatalError); << exit(FatalError);
} }
bool nearCellValue = args.options().found("nearCellValue"); bool nearCellValue = args.optionFound("nearCellValue");
if (nearCellValue) if (nearCellValue)
{ {
@ -269,7 +268,7 @@ int main(int argc, char *argv[])
<< nl << endl; << nl << endl;
} }
bool noPointValues = args.options().found("noPointValues"); bool noPointValues = args.optionFound("noPointValues");
if (noPointValues) if (noPointValues)
{ {
@ -277,12 +276,12 @@ int main(int argc, char *argv[])
<< "Outputting cell values only" << nl << endl; << "Outputting cell values only" << nl << endl;
} }
bool allPatches = args.options().found("allPatches"); bool allPatches = args.optionFound("allPatches");
HashSet<word> excludePatches; HashSet<word> excludePatches;
if (args.options().found("excludePatches")) if (args.optionFound("excludePatches"))
{ {
IStringStream(args.options()["excludePatches"])() >> excludePatches; args.optionLookup("excludePatches")() >> excludePatches;
Info<< "Not including patches " << excludePatches << nl << endl; Info<< "Not including patches " << excludePatches << nl << endl;
} }
@ -290,9 +289,9 @@ int main(int argc, char *argv[])
word cellSetName; word cellSetName;
string vtkName; string vtkName;
if (args.options().found("cellSet")) if (args.optionFound("cellSet"))
{ {
cellSetName = args.options()["cellSet"]; cellSetName = args.option("cellSet");
vtkName = cellSetName; vtkName = cellSetName;
} }
else if (Pstream::parRun()) else if (Pstream::parRun())
@ -332,8 +331,8 @@ int main(int argc, char *argv[])
{ {
if if
( (
args.options().found("time") args.optionFound("time")
|| args.options().found("latestTime") || args.optionFound("latestTime")
|| cellSetName.size() || cellSetName.size()
|| regionName != polyMesh::defaultRegion || regionName != polyMesh::defaultRegion
) )
@ -377,10 +376,10 @@ int main(int argc, char *argv[])
// If faceSet: write faceSet only (as polydata) // If faceSet: write faceSet only (as polydata)
if (args.options().found("faceSet")) if (args.optionFound("faceSet"))
{ {
// Load the faceSet // Load the faceSet
faceSet set(mesh, args.options()["faceSet"]); faceSet set(mesh, args.option("faceSet"));
// Filename as if patch with same name. // Filename as if patch with same name.
mkDir(fvPath/set.name()); mkDir(fvPath/set.name());
@ -400,10 +399,10 @@ int main(int argc, char *argv[])
continue; continue;
} }
// If pointSet: write pointSet only (as polydata) // If pointSet: write pointSet only (as polydata)
if (args.options().found("pointSet")) if (args.optionFound("pointSet"))
{ {
// Load the pointSet // Load the pointSet
pointSet set(mesh, args.options()["pointSet"]); pointSet set(mesh, args.option("pointSet"));
// Filename as if patch with same name. // Filename as if patch with same name.
mkDir(fvPath/set.name()); mkDir(fvPath/set.name());
@ -428,9 +427,9 @@ int main(int argc, char *argv[])
IOobjectList objects(mesh, runTime.timeName()); IOobjectList objects(mesh, runTime.timeName());
HashSet<word> selectedFields; HashSet<word> selectedFields;
if (args.options().found("fields")) if (args.optionFound("fields"))
{ {
IStringStream(args.options()["fields"])() >> selectedFields; args.optionLookup("fields")() >> selectedFields;
} }
// Construct the vol fields (on the original mesh if subsetted) // Construct the vol fields (on the original mesh if subsetted)
@ -608,7 +607,7 @@ int main(int argc, char *argv[])
// //
//--------------------------------------------------------------------- //---------------------------------------------------------------------
if (args.options().found("surfaceFields")) if (args.optionFound("surfaceFields"))
{ {
PtrList<surfaceScalarField> ssf; PtrList<surfaceScalarField> ssf;
readFields readFields

View File

@ -82,7 +82,7 @@ namespace Foam
void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
{ {
bool writeResults = !args.options().found("noWrite"); bool writeResults = !args.optionFound("noWrite");
wordList extensiveVSFNames wordList extensiveVSFNames
( (

View File

@ -53,15 +53,13 @@ namespace Foam
{ {
void execFlowFunctionObjects(const argList& args, const Time& runTime) void execFlowFunctionObjects(const argList& args, const Time& runTime)
{ {
if (args.options().found("dict")) if (args.optionFound("dict"))
{ {
fileName dictName(args.options()["dict"]);
IOdictionary dict IOdictionary dict
( (
IOobject IOobject
( (
dictName, args.option("dict"),
runTime.system(), runTime.system(),
runTime, runTime,
IOobject::MUST_READ IOobject::MUST_READ

View File

@ -86,7 +86,7 @@ namespace Foam
void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
{ {
bool writeResults = !args.options().found("noWrite"); bool writeResults = !args.optionFound("noWrite");
IOobject phiHeader IOobject phiHeader
( (

View File

@ -38,7 +38,7 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
{ {
bool writeResults = !args.options().found("noWrite"); bool writeResults = !args.optionFound("noWrite");
IOobject Uheader IOobject Uheader
( (

View File

@ -47,7 +47,7 @@ Description
void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
{ {
bool writeResults = !args.options().found("noWrite"); bool writeResults = !args.optionFound("noWrite");
IOobject phiHeader IOobject phiHeader
( (

View File

@ -39,7 +39,7 @@ Description
void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
{ {
bool writeResults = !args.options().found("noWrite"); bool writeResults = !args.optionFound("noWrite");
IOobject Uheader IOobject Uheader
( (

View File

@ -39,7 +39,7 @@ Description
void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
{ {
bool writeResults = !args.options().found("noWrite"); bool writeResults = !args.optionFound("noWrite");
IOobject Uheader IOobject Uheader
( (

View File

@ -39,7 +39,7 @@ Description
void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
{ {
bool writeResults = !args.options().found("noWrite"); bool writeResults = !args.optionFound("noWrite");
IOobject kheader IOobject kheader
( (

View File

@ -39,7 +39,7 @@ Description
void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
{ {
bool writeResults = !args.options().found("noWrite"); bool writeResults = !args.optionFound("noWrite");
IOobject Uheader IOobject Uheader
( (

View File

@ -76,16 +76,15 @@ int main(int argc, char *argv[])
// Set the mean boundary-layer thickness // Set the mean boundary-layer thickness
dimensionedScalar ybl("ybl", dimLength, 0); dimensionedScalar ybl("ybl", dimLength, 0);
if (args.options().found("ybl")) if (args.optionFound("ybl"))
{ {
// If the boundary-layer thickness is provided use it // If the boundary-layer thickness is provided use it
ybl.value() = readScalar(IStringStream(args.options()["ybl"])()); ybl.value() = args.optionRead<scalar>("ybl");
} }
else if (args.options().found("Cbl")) else if (args.optionFound("Cbl"))
{ {
// Calculate boundary layer thickness as Cbl * mean distance to wall // Calculate boundary layer thickness as Cbl * mean distance to wall
ybl.value() = ybl.value() = gAverage(y) * args.optionRead<scalar>("Cbl");
gAverage(y)*readScalar(IStringStream(args.options()["Cbl"])());
} }
else else
{ {
@ -155,7 +154,7 @@ int main(int argc, char *argv[])
sqr(kappa*min(y, ybl))*::sqrt(2)*mag(dev(symm(fvc::grad(U)))) sqr(kappa*min(y, ybl))*::sqrt(2)*mag(dev(symm(fvc::grad(U))))
); );
if (args.options().found("writenut")) if (args.optionFound("writenut"))
{ {
Info<< "Writing nut" << endl; Info<< "Writing nut" << endl;
nut.write(); nut.write();

View File

@ -240,7 +240,7 @@ int main(int argc, char *argv[])
# include "createTime.H" # include "createTime.H"
# include "createMesh.H" # include "createMesh.H"
bool compressible = args.options().found("compressible"); bool compressible = args.optionFound("compressible");
Info<< "Updating turbulence fields to operate using new run time " Info<< "Updating turbulence fields to operate using new run time "
<< "selectable" << nl << "wall functions" << "selectable" << nl << "wall functions"

View File

@ -78,7 +78,7 @@ int main(int argc, char *argv[])
Info<< nChanged << " solver settings changed" << nl << endl; Info<< nChanged << " solver settings changed" << nl << endl;
if (nChanged) if (nChanged)
{ {
if (args.options().found("test")) if (args.optionFound("test"))
{ {
Info<< "-test option: no changes made" << nl << endl; Info<< "-test option: no changes made" << nl << endl;
} }

View File

@ -24,20 +24,7 @@
Info<< "Source: " << rootDirSource << " " << caseDirSource << nl Info<< "Source: " << rootDirSource << " " << caseDirSource << nl
<< "Target: " << rootDirTarget << " " << caseDirTarget << endl; << "Target: " << rootDirTarget << " " << caseDirTarget << endl;
bool parallelSource = false; bool parallelSource = args.optionFound("parallelSource");
if (args.options().found("parallelSource")) bool parallelTarget = args.optionFound("parallelTarget");
{ bool consistent = args.optionFound("consistent");
parallelSource = true;
}
bool parallelTarget = false;
if (args.options().found("parallelTarget"))
{
parallelTarget = true;
}
bool consistent = false;
if (args.options().found("consistent"))
{
consistent = true;
}

View File

@ -1,15 +1,14 @@
instantList sourceTimes = runTimeSource.times(); instantList sourceTimes = runTimeSource.times();
label sourceTimeIndex = runTimeSource.timeIndex(); label sourceTimeIndex = runTimeSource.timeIndex();
if (args.options().found("sourceTime")) if (args.optionFound("sourceTime"))
{ {
if ((args.options()["sourceTime"]) == "latestTime") if (args.option("sourceTime") == "latestTime")
{ {
sourceTimeIndex = sourceTimes.size() - 1; sourceTimeIndex = sourceTimes.size() - 1;
} }
else else
{ {
scalar sourceTime = scalar sourceTime = args.optionRead<scalar>("sourceTime");
readScalar(IStringStream(args.options()["sourceTime"])());
sourceTimeIndex = getTimeIndex(sourceTimes, sourceTime); sourceTimeIndex = getTimeIndex(sourceTimes, sourceTime);
} }
} }

View File

@ -59,8 +59,8 @@ int main(int argc, char *argv[])
fileName inFileName2(args.additionalArgs()[1]); fileName inFileName2(args.additionalArgs()[1]);
fileName outFileName(args.additionalArgs()[2]); fileName outFileName(args.additionalArgs()[2]);
bool addPoint = args.options().found("points"); bool addPoint = args.optionFound("points");
bool mergeRegions = args.options().found("mergeRegions"); bool mergeRegions = args.optionFound("mergeRegions");
if (addPoint) if (addPoint)
{ {
@ -69,7 +69,7 @@ int main(int argc, char *argv[])
<< nl << endl; << nl << endl;
Info<< "Surface : " << inFileName1<< nl Info<< "Surface : " << inFileName1<< nl
<< "Points : " << args.options()["points"] << nl << "Points : " << args.option("points") << nl
<< "Writing : " << outFileName << nl << endl; << "Writing : " << outFileName << nl << endl;
} }
else else
@ -111,8 +111,8 @@ int main(int argc, char *argv[])
if (addPoint) if (addPoint)
{ {
IFstream pointStr(args.options()["points"]); IFstream pointsFile(args.option("points"));
pointField extraPoints(pointStr); pointField extraPoints(pointsFile);
Info<< "Additional Points:" << extraPoints.size() << endl; Info<< "Additional Points:" << extraPoints.size() << endl;
@ -252,7 +252,7 @@ int main(int argc, char *argv[])
newPatches[newPatchI++] = surface2.patches()[ patchI]; newPatches[newPatchI++] = surface2.patches()[ patchI];
} }
} }
Info<< "New patches:" << nl; Info<< "New patches:" << nl;
forAll(newPatches, patchI) forAll(newPatches, patchI)

View File

@ -176,8 +176,8 @@ int main(int argc, char *argv[])
argList::validOptions.insert("verbose", ""); argList::validOptions.insert("verbose", "");
argList args(argc, argv); argList args(argc, argv);
bool checkSelfIntersection = args.options().found("checkSelfIntersection"); bool checkSelfIntersection = args.optionFound("checkSelfIntersection");
bool verbose = args.options().found("verbose"); bool verbose = args.optionFound("verbose");
fileName surfFileName(args.additionalArgs()[0]); fileName surfFileName(args.additionalArgs()[0]);
Pout<< "Reading surface from " << surfFileName << " ..." << nl << endl; Pout<< "Reading surface from " << surfFileName << " ..." << nl << endl;

View File

@ -70,12 +70,6 @@ int main(int argc, char *argv[])
argList args(argc, argv); argList args(argc, argv);
const stringList& params = args.additionalArgs(); const stringList& params = args.additionalArgs();
scalar scaleFactor = 0;
if (args.options().found("scale"))
{
IStringStream(args.options()["scale"])() >> scaleFactor;
}
fileName importName(params[0]); fileName importName(params[0]);
fileName exportName(params[1]); fileName exportName(params[1]);
@ -93,7 +87,7 @@ int main(int argc, char *argv[])
surf.writeStats(Info); surf.writeStats(Info);
Info<< endl; Info<< endl;
if (args.options().found("clean")) if (args.optionFound("clean"))
{ {
Info<< "Cleaning up surface" << endl; Info<< "Cleaning up surface" << endl;
surf.cleanup(true); surf.cleanup(true);
@ -103,7 +97,7 @@ int main(int argc, char *argv[])
Info<< endl; Info<< endl;
} }
bool sortByRegion = args.options().found("group"); bool sortByRegion = args.optionFound("group");
if (sortByRegion) if (sortByRegion)
{ {
@ -115,7 +109,9 @@ int main(int argc, char *argv[])
} }
Info<< "writing " << exportName; Info<< "writing " << exportName;
if (scaleFactor > 0)
scalar scaleFactor = 0;
if (args.optionReadIfPresent("scale", scaleFactor) && scaleFactor > 0)
{ {
Info<< " with scaling " << scaleFactor; Info<< " with scaling " << scaleFactor;
surf.scalePoints(scaleFactor); surf.scalePoints(scaleFactor);

View File

@ -110,7 +110,7 @@ int main(int argc, char *argv[])
argList::validOptions.insert("deleteBox", "((x0 y0 z0)(x1 y1 z1))"); argList::validOptions.insert("deleteBox", "((x0 y0 z0)(x1 y1 z1))");
argList args(argc, argv); argList args(argc, argv);
Pout<< "Feature line extraction is only valid on closed manifold surfaces." Pout<< "Feature line extraction is only valid on closed manifold surfaces."
<< endl; << endl;
@ -139,27 +139,24 @@ int main(int argc, char *argv[])
surfaceFeatures set(surf); surfaceFeatures set(surf);
if (args.options().found("set")) if (args.optionFound("set"))
{ {
fileName setName(args.options()["set"]); fileName setName(args.option("set"));
Pout<< "Reading existing feature set from file " << setName << endl; Pout<< "Reading existing feature set from file " << setName << endl;
set = surfaceFeatures(surf, setName); set = surfaceFeatures(surf, setName);
} }
else if (args.options().found("includedAngle")) else if (args.optionFound("includedAngle"))
{ {
scalar includedAngle scalar includedAngle = args.optionRead<scalar>("includedAngle");
(
readScalar(IStringStream(args.options()["includedAngle"])())
);
Pout<< "Constructing feature set from included angle " << includedAngle Pout<< "Constructing feature set from included angle " << includedAngle
<< endl; << endl;
set = surfaceFeatures(surf, includedAngle); set = surfaceFeatures(surf, includedAngle);
Pout<< endl << "Writing initial features" << endl; Pout<< endl << "Writing initial features" << endl;
set.write("initial.fSet"); set.write("initial.fSet");
set.writeObj("initial"); set.writeObj("initial");
} }
@ -190,16 +187,14 @@ int main(int argc, char *argv[])
// ~~~~~~~~ // ~~~~~~~~
scalar minLen = -GREAT; scalar minLen = -GREAT;
if (args.options().found("minLen")) if (args.optionReadIfPresent("minLen", minLen))
{ {
minLen = readScalar(IStringStream(args.options()["minLen"])());
Pout<< "Removing features of length < " << minLen << endl; Pout<< "Removing features of length < " << minLen << endl;
} }
label minElem = 0; label minElem = 0;
if (args.options().found("minElem")) if (args.optionReadIfPresent("minElem", minElem))
{ {
minElem = readLabel(IStringStream(args.options()["minElem"])());
Pout<< "Removing features with number of edges < " << minElem << endl; Pout<< "Removing features with number of edges < " << minElem << endl;
} }
@ -207,7 +202,7 @@ int main(int argc, char *argv[])
if (minLen > 0 || minLen > 0) if (minLen > 0 || minLen > 0)
{ {
set.trimFeatures(minLen, minElem); set.trimFeatures(minLen, minElem);
Pout<< endl << "Removed small features" << endl; Pout<< endl << "Removed small features" << endl;
} }
@ -218,9 +213,9 @@ int main(int argc, char *argv[])
// Convert to marked edges, points // Convert to marked edges, points
List<surfaceFeatures::edgeStatus> edgeStat(set.toStatus()); List<surfaceFeatures::edgeStatus> edgeStat(set.toStatus());
if (args.options().found("subsetBox")) if (args.optionFound("subsetBox"))
{ {
treeBoundBox bb(IStringStream(args.options()["subsetBox"])()); treeBoundBox bb(args.optionLookup("subsetBox")());
Pout<< "Removing all edges outside bb " << bb << endl; Pout<< "Removing all edges outside bb " << bb << endl;
dumpBox(bb, "subsetBox.obj"); dumpBox(bb, "subsetBox.obj");
@ -233,9 +228,9 @@ int main(int argc, char *argv[])
edgeStat edgeStat
); );
} }
else if (args.options().found("deleteBox")) else if (args.optionFound("deleteBox"))
{ {
treeBoundBox bb(IStringStream(args.options()["deleteBox"])()); treeBoundBox bb(args.optionLookup("deleteBox")());
Pout<< "Removing all edges inside bb " << bb << endl; Pout<< "Removing all edges inside bb " << bb << endl;
dumpBox(bb, "deleteBox.obj"); dumpBox(bb, "deleteBox.obj");
@ -254,7 +249,7 @@ int main(int argc, char *argv[])
Pout<< endl << "Writing trimmed features to " << outFileName << endl; Pout<< endl << "Writing trimmed features to " << outFileName << endl;
newSet.write(outFileName); newSet.write(outFileName);
Pout<< endl << "Writing edge objs." << endl; Pout<< endl << "Writing edge objs." << endl;
newSet.writeObj("final"); newSet.writeObj("final");

View File

@ -52,10 +52,12 @@ int main(int argc, char *argv[])
argList args(argc, argv); argList args(argc, argv);
scalar x(readScalar(IStringStream(args.options()["x"])())); point samplePt
scalar y(readScalar(IStringStream(args.options()["y"])())); (
scalar z(readScalar(IStringStream(args.options()["z"])())); args.optionRead<scalar>("x"),
point samplePt(x, y, z); args.optionRead<scalar>("y"),
args.optionRead<scalar>("z")
);
Info<< "Looking for nearest face/vertex to " << samplePt << endl; Info<< "Looking for nearest face/vertex to " << samplePt << endl;

View File

@ -110,13 +110,13 @@ int main(int argc, char *argv[])
autoPtr<coordinateSystem> fromCsys; autoPtr<coordinateSystem> fromCsys;
autoPtr<coordinateSystem> toCsys; autoPtr<coordinateSystem> toCsys;
if (args.options().found("from") || args.options().found("to")) if (args.optionFound("from") || args.optionFound("to"))
{ {
autoPtr<IOobject> csDictIoPtr; autoPtr<IOobject> csDictIoPtr;
if (args.options().found("dict")) if (args.optionFound("dict"))
{ {
fileName dictPath(args.options()["dict"]); fileName dictPath(args.option("dict"));
csDictIoPtr.set csDictIoPtr.set
( (
@ -161,9 +161,9 @@ int main(int argc, char *argv[])
coordinateSystems csLst(csDictIoPtr()); coordinateSystems csLst(csDictIoPtr());
if (args.options().found("from")) if (args.optionFound("from"))
{ {
const word csName(args.options()["from"]); const word csName(args.option("from"));
label csId = csLst.find(csName); label csId = csLst.find(csName);
if (csId < 0) if (csId < 0)
@ -177,9 +177,9 @@ int main(int argc, char *argv[])
fromCsys.reset(new coordinateSystem(csLst[csId])); fromCsys.reset(new coordinateSystem(csLst[csId]));
} }
if (args.options().found("to")) if (args.optionFound("to"))
{ {
const word csName(args.options()["to"]); const word csName(args.option("to"));
label csId = csLst.find(csName); label csId = csLst.find(csName);
if (csId < 0) if (csId < 0)
@ -203,32 +203,23 @@ int main(int argc, char *argv[])
} }
} }
scalar scaleIn = 0;
scalar scaleOut = 0;
if (args.options().found("scaleIn"))
{
IStringStream(args.options()["scaleIn"])() >> scaleIn;
}
if (args.options().found("scaleOut"))
{
IStringStream(args.options()["scaleOut"])() >> scaleOut;
}
{ {
MeshedSurface<face> surf(importName); MeshedSurface<face> surf(importName);
if (args.options().found("clean")) if (args.optionFound("clean"))
{ {
surf.cleanup(true); surf.cleanup(true);
} }
if (scaleIn > 0) scalar scaleIn = 0;
if (args.optionReadIfPresent("scaleIn", scaleIn) && scaleIn > 0)
{ {
Info<< " -scaleIn " << scaleIn << endl; Info<< " -scaleIn " << scaleIn << endl;
surf.scalePoints(scaleIn); surf.scalePoints(scaleIn);
} }
if (fromCsys.valid()) if (fromCsys.valid())
{ {
Info<< " -from " << fromCsys().name() << endl; Info<< " -from " << fromCsys().name() << endl;
@ -243,7 +234,8 @@ int main(int argc, char *argv[])
surf.movePoints(tpf()); surf.movePoints(tpf());
} }
if (scaleOut > 0) scalar scaleOut = 0;
if (args.optionReadIfPresent("scaleOut", scaleOut) && scaleOut > 0)
{ {
Info<< " -scaleOut " << scaleOut << endl; Info<< " -scaleOut " << scaleOut << endl;
surf.scalePoints(scaleOut); surf.scalePoints(scaleOut);

View File

@ -86,10 +86,7 @@ int main(int argc, char *argv[])
const stringList& params = args.additionalArgs(); const stringList& params = args.additionalArgs();
scalar scaleFactor = 0; scalar scaleFactor = 0;
if (args.options().found("scale")) args.optionReadIfPresent("scale", scaleFactor);
{
IStringStream(args.options()["scale"])() >> scaleFactor;
}
fileName importName(params[0]); fileName importName(params[0]);
fileName exportName(params[1]); fileName exportName(params[1]);
@ -110,7 +107,7 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
if (args.options().found("triSurface")) if (args.optionFound("triSurface"))
{ {
triSurface surf(importName); triSurface surf(importName);
@ -118,14 +115,14 @@ int main(int argc, char *argv[])
surf.writeStats(Info); surf.writeStats(Info);
Info<< endl; Info<< endl;
if (args.options().found("orient")) if (args.optionFound("orient"))
{ {
Info<< "Checking surface orientation" << endl; Info<< "Checking surface orientation" << endl;
PatchTools::checkOrientation(surf, true); PatchTools::checkOrientation(surf, true);
Info<< endl; Info<< endl;
} }
if (args.options().found("clean")) if (args.optionFound("clean"))
{ {
Info<< "Cleaning up surface" << endl; Info<< "Cleaning up surface" << endl;
surf.cleanup(true); surf.cleanup(true);
@ -149,7 +146,7 @@ int main(int argc, char *argv[])
// write sorted by region // write sorted by region
surf.write(exportName, true); surf.write(exportName, true);
} }
else if (args.options().found("unsorted")) else if (args.optionFound("unsorted"))
{ {
UnsortedMeshedSurface<face> surf(importName); UnsortedMeshedSurface<face> surf(importName);
@ -157,14 +154,14 @@ int main(int argc, char *argv[])
surf.writeStats(Info); surf.writeStats(Info);
Info<< endl; Info<< endl;
if (args.options().found("orient")) if (args.optionFound("orient"))
{ {
Info<< "Checking surface orientation" << endl; Info<< "Checking surface orientation" << endl;
PatchTools::checkOrientation(surf, true); PatchTools::checkOrientation(surf, true);
Info<< endl; Info<< endl;
} }
if (args.options().found("clean")) if (args.optionFound("clean"))
{ {
Info<< "Cleaning up surface" << endl; Info<< "Cleaning up surface" << endl;
surf.cleanup(true); surf.cleanup(true);
@ -187,7 +184,7 @@ int main(int argc, char *argv[])
surf.write(exportName); surf.write(exportName);
} }
#if 1 #if 1
else if (args.options().found("triFace")) else if (args.optionFound("triFace"))
{ {
MeshedSurface<triFace> surf(importName); MeshedSurface<triFace> surf(importName);
@ -195,14 +192,14 @@ int main(int argc, char *argv[])
surf.writeStats(Info); surf.writeStats(Info);
Info<< endl; Info<< endl;
if (args.options().found("orient")) if (args.optionFound("orient"))
{ {
Info<< "Checking surface orientation" << endl; Info<< "Checking surface orientation" << endl;
PatchTools::checkOrientation(surf, true); PatchTools::checkOrientation(surf, true);
Info<< endl; Info<< endl;
} }
if (args.options().found("clean")) if (args.optionFound("clean"))
{ {
Info<< "Cleaning up surface" << endl; Info<< "Cleaning up surface" << endl;
surf.cleanup(true); surf.cleanup(true);
@ -233,14 +230,14 @@ int main(int argc, char *argv[])
surf.writeStats(Info); surf.writeStats(Info);
Info<< endl; Info<< endl;
if (args.options().found("orient")) if (args.optionFound("orient"))
{ {
Info<< "Checking surface orientation" << endl; Info<< "Checking surface orientation" << endl;
PatchTools::checkOrientation(surf, true); PatchTools::checkOrientation(surf, true);
Info<< endl; Info<< endl;
} }
if (args.options().found("clean")) if (args.optionFound("clean"))
{ {
Info<< "Cleaning up surface" << endl; Info<< "Cleaning up surface" << endl;
surf.cleanup(true); surf.cleanup(true);
@ -263,7 +260,7 @@ int main(int argc, char *argv[])
} }
surf.write(exportName); surf.write(exportName);
if (args.options().found("surfMesh")) if (args.optionFound("surfMesh"))
{ {
Foam::Time runTime Foam::Time runTime
( (

View File

@ -89,6 +89,7 @@ int main(int argc, char *argv[])
fileName exportName(params[0]); fileName exportName(params[0]);
word importName("default"); word importName("default");
args.optionReadIfPresent("name", importName);
// check that writing is supported // check that writing is supported
if (!MeshedSurface<face>::canWriteType(exportName.ext(), true)) if (!MeshedSurface<face>::canWriteType(exportName.ext(), true))
@ -96,23 +97,18 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
if (args.options().found("name"))
{
importName = args.options()["name"];
}
// get the coordinate transformations // get the coordinate transformations
autoPtr<coordinateSystem> fromCsys; autoPtr<coordinateSystem> fromCsys;
autoPtr<coordinateSystem> toCsys; autoPtr<coordinateSystem> toCsys;
if (args.options().found("from") || args.options().found("to")) if (args.optionFound("from") || args.optionFound("to"))
{ {
autoPtr<IOobject> ioPtr; autoPtr<IOobject> ioPtr;
if (args.options().found("dict")) if (args.optionFound("dict"))
{ {
fileName dictPath(args.options()["dict"]); fileName dictPath(args.option("dict"));
ioPtr.set ioPtr.set
( (
@ -157,9 +153,9 @@ int main(int argc, char *argv[])
coordinateSystems csLst(ioPtr()); coordinateSystems csLst(ioPtr());
if (args.options().found("from")) if (args.optionFound("from"))
{ {
const word csName(args.options()["from"]); const word csName(args.option("from"));
label csId = csLst.find(csName); label csId = csLst.find(csName);
if (csId < 0) if (csId < 0)
@ -173,9 +169,9 @@ int main(int argc, char *argv[])
fromCsys.reset(new coordinateSystem(csLst[csId])); fromCsys.reset(new coordinateSystem(csLst[csId]));
} }
if (args.options().found("to")) if (args.optionFound("to"))
{ {
const word csName(args.options()["to"]); const word csName(args.option("to"));
label csId = csLst.find(csName); label csId = csLst.find(csName);
if (csId < 0) if (csId < 0)
@ -219,24 +215,13 @@ int main(int argc, char *argv[])
MeshedSurface<face> surf(smesh); MeshedSurface<face> surf(smesh);
if (args.options().found("clean")) if (args.optionFound("clean"))
{ {
surf.cleanup(true); surf.cleanup(true);
} }
scalar scaleIn = 0; scalar scaleIn = 0;
scalar scaleOut = 0; if (args.optionReadIfPresent("scaleIn", scaleIn) && scaleIn > 0)
if (args.options().found("scaleIn"))
{
IStringStream(args.options()["scaleIn"])() >> scaleIn;
}
if (args.options().found("scaleOut"))
{
IStringStream(args.options()["scaleOut"])() >> scaleOut;
}
if (scaleIn > 0)
{ {
Info<< " -scaleIn " << scaleIn << endl; Info<< " -scaleIn " << scaleIn << endl;
surf.scalePoints(scaleIn); surf.scalePoints(scaleIn);
@ -256,7 +241,8 @@ int main(int argc, char *argv[])
surf.movePoints(tpf()); surf.movePoints(tpf());
} }
if (scaleOut > 0) scalar scaleOut = 0;
if (args.optionReadIfPresent("scaleOut", scaleOut) && scaleOut > 0)
{ {
Info<< " -scaleOut " << scaleOut << endl; Info<< " -scaleOut " << scaleOut << endl;
surf.scalePoints(scaleOut); surf.scalePoints(scaleOut);

View File

@ -103,6 +103,7 @@ int main(int argc, char *argv[])
fileName importName(params[0]); fileName importName(params[0]);
word exportName("default"); word exportName("default");
args.optionReadIfPresent("name", exportName);
// check that reading is supported // check that reading is supported
if (!MeshedSurface<face>::canRead(importName, true)) if (!MeshedSurface<face>::canRead(importName, true))
@ -110,23 +111,18 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
if (args.options().found("name"))
{
exportName = args.options()["name"];
}
// get the coordinate transformations // get the coordinate transformations
autoPtr<coordinateSystem> fromCsys; autoPtr<coordinateSystem> fromCsys;
autoPtr<coordinateSystem> toCsys; autoPtr<coordinateSystem> toCsys;
if (args.options().found("from") || args.options().found("to")) if (args.optionFound("from") || args.optionFound("to"))
{ {
autoPtr<IOobject> ioPtr; autoPtr<IOobject> ioPtr;
if (args.options().found("dict")) if (args.optionFound("dict"))
{ {
fileName dictPath(args.options()["dict"]); fileName dictPath(args.option("dict"));
ioPtr.set ioPtr.set
( (
@ -171,9 +167,9 @@ int main(int argc, char *argv[])
coordinateSystems csLst(ioPtr()); coordinateSystems csLst(ioPtr());
if (args.options().found("from")) if (args.optionFound("from"))
{ {
const word csName(args.options()["from"]); const word csName(args.option("from"));
label csId = csLst.find(csName); label csId = csLst.find(csName);
if (csId < 0) if (csId < 0)
@ -187,9 +183,9 @@ int main(int argc, char *argv[])
fromCsys.reset(new coordinateSystem(csLst[csId])); fromCsys.reset(new coordinateSystem(csLst[csId]));
} }
if (args.options().found("to")) if (args.optionFound("to"))
{ {
const word csName(args.options()["to"]); const word csName(args.option("to"));
label csId = csLst.find(csName); label csId = csLst.find(csName);
if (csId < 0) if (csId < 0)
@ -217,25 +213,14 @@ int main(int argc, char *argv[])
MeshedSurface<face> surf(importName); MeshedSurface<face> surf(importName);
if (args.options().found("clean")) if (args.optionFound("clean"))
{ {
surf.cleanup(true); surf.cleanup(true);
} }
scalar scaleIn = 0; scalar scaleIn = 0;
scalar scaleOut = 0; if (args.optionReadIfPresent("scaleIn", scaleIn) && scaleIn > 0)
if (args.options().found("scaleIn"))
{
IStringStream(args.options()["scaleIn"])() >> scaleIn;
}
if (args.options().found("scaleOut"))
{
IStringStream(args.options()["scaleOut"])() >> scaleOut;
}
if (scaleIn > 0)
{ {
Info<< " -scaleIn " << scaleIn << endl; Info<< " -scaleIn " << scaleIn << endl;
surf.scalePoints(scaleIn); surf.scalePoints(scaleIn);
@ -255,7 +240,8 @@ int main(int argc, char *argv[])
surf.movePoints(tpf()); surf.movePoints(tpf());
} }
if (scaleOut > 0) scalar scaleOut = 0;
if (args.optionReadIfPresent("scaleOut", scaleOut) && scaleOut > 0)
{ {
Info<< " -scaleOut " << scaleOut << endl; Info<< " -scaleOut " << scaleOut << endl;
surf.scalePoints(scaleOut); surf.scalePoints(scaleOut);

View File

@ -69,7 +69,7 @@ int main(int argc, char *argv[])
bool includeProcPatches = bool includeProcPatches =
!( !(
args.options().found("excludeProcPatches") args.optionFound("excludeProcPatches")
|| Pstream::parRun() || Pstream::parRun()
); );
@ -78,15 +78,15 @@ int main(int argc, char *argv[])
// - all patches (default in sequential mode) // - all patches (default in sequential mode)
// - all non-processor patches (default in parallel mode) // - all non-processor patches (default in parallel mode)
// - all non-processor patches (sequential mode, -excludeProcPatches option) // - all non-processor patches (sequential mode, -excludeProcPatches option)
// Construct table of patches to include. // Construct table of patches to include.
const polyBoundaryMesh& bMesh = mesh.boundaryMesh(); const polyBoundaryMesh& bMesh = mesh.boundaryMesh();
labelHashSet includePatches(bMesh.size()); labelHashSet includePatches(bMesh.size());
if (args.options().found("patches")) if (args.optionFound("patches"))
{ {
wordList patchNames(IStringStream(args.options()["patches"])()); wordList patchNames(args.optionLookup("patches")());
forAll(patchNames, patchNameI) forAll(patchNames, patchNameI)
{ {

View File

@ -54,7 +54,7 @@ int main(int argc, char *argv[])
point visiblePoint(IStringStream(args.additionalArgs()[1])()); point visiblePoint(IStringStream(args.additionalArgs()[1])());
Info<< "Visible point " << visiblePoint << endl; Info<< "Visible point " << visiblePoint << endl;
bool orientInside = args.options().found("inside"); bool orientInside = args.optionFound("inside");
if (orientInside) if (orientInside)
{ {

View File

@ -692,7 +692,7 @@ int main(int argc, char *argv[])
fileName inSurfName(args.additionalArgs()[0]); fileName inSurfName(args.additionalArgs()[0]);
fileName outSurfName(args.additionalArgs()[1]); fileName outSurfName(args.additionalArgs()[1]);
bool debug = args.options().found("debug"); bool debug = args.optionFound("debug");
Info<< "Reading surface from " << inSurfName << endl; Info<< "Reading surface from " << inSurfName << endl;

View File

@ -177,12 +177,12 @@ int main(int argc, char *argv[])
Info<< "Reading surface from " << surfName << " ..." << endl; Info<< "Reading surface from " << surfName << " ..." << endl;
bool readSet = args.options().found("faceSet"); bool readSet = args.optionFound("faceSet");
word setName; word setName;
if (readSet) if (readSet)
{ {
setName = args.options()["faceSet"]; setName = args.option("faceSet");
Info<< "Repatching only the faces in faceSet " << setName Info<< "Repatching only the faces in faceSet " << setName
<< " according to nearest surface triangle ..." << endl; << " according to nearest surface triangle ..." << endl;
@ -194,11 +194,7 @@ int main(int argc, char *argv[])
} }
scalar searchTol = 1E-3; scalar searchTol = 1E-3;
args.optionReadIfPresent("tol", searchTol);
if (args.options().found("tol"))
{
searchTol = readScalar(IStringStream(args.options()["tol"])());
}
// Get search box. Anything not within this box will not be considered. // Get search box. Anything not within this box will not be considered.
const boundBox& meshBb = mesh.globalData().bb(); const boundBox& meshBb = mesh.globalData().bb();

View File

@ -86,18 +86,18 @@ int main(int argc, char *argv[])
pointField points(surf1.points()); pointField points(surf1.points());
if (args.options().found("translate")) if (args.optionFound("translate"))
{ {
vector transVector(IStringStream(args.options()["translate"])()); vector transVector(args.optionLookup("translate")());
Info<< "Translating points by " << transVector << endl; Info<< "Translating points by " << transVector << endl;
points += transVector; points += transVector;
} }
if (args.options().found("rotate")) if (args.optionFound("rotate"))
{ {
Pair<vector> n1n2(IStringStream(args.options()["rotate"])()); Pair<vector> n1n2(args.optionLookup("rotate")());
n1n2[0] /= mag(n1n2[0]); n1n2[0] /= mag(n1n2[0]);
n1n2[1] /= mag(n1n2[1]); n1n2[1] /= mag(n1n2[1]);
@ -107,9 +107,9 @@ int main(int argc, char *argv[])
points = transform(T, points); points = transform(T, points);
} }
else if (args.options().found("rollPitchYaw")) else if (args.optionFound("rollPitchYaw"))
{ {
vector v(IStringStream(args.options()["rollPitchYaw"])()); vector v(args.optionLookup("rollPitchYaw")());
Info<< "Rotating points by" << nl Info<< "Rotating points by" << nl
<< " roll " << v.x() << nl << " roll " << v.x() << nl
@ -125,9 +125,9 @@ int main(int argc, char *argv[])
Info<< "Rotating points by quaternion " << R << endl; Info<< "Rotating points by quaternion " << R << endl;
points = transform(R, points); points = transform(R, points);
} }
else if (args.options().found("yawPitchRoll")) else if (args.optionFound("yawPitchRoll"))
{ {
vector v(IStringStream(args.options()["yawPitchRoll"])()); vector v(args.optionLookup("yawPitchRoll")());
Info<< "Rotating points by" << nl Info<< "Rotating points by" << nl
<< " yaw " << v.x() << nl << " yaw " << v.x() << nl
@ -150,9 +150,9 @@ int main(int argc, char *argv[])
points = transform(R, points); points = transform(R, points);
} }
if (args.options().found("scale")) if (args.optionFound("scale"))
{ {
vector scaleVector(IStringStream(args.options()["scale"])()); vector scaleVector(args.optionLookup("scale")());
Info<< "Scaling points by " << scaleVector << endl; Info<< "Scaling points by " << scaleVector << endl;

View File

@ -1 +0,0 @@
argList::validOptions.insert("constant", "");

View File

@ -1 +0,0 @@
argList::validOptions.insert("latestTime", "");

View File

@ -1 +0,0 @@
argList::validOptions.insert("noZero", "");

View File

@ -1 +0,0 @@
argList::validOptions.insert("time", "time");

View File

@ -1,4 +1,8 @@
#include "addConstantOption.H" //
#include "addTimeOption.H" // addTimeOptions.H
#include "addLatestTimeOption.H" // ~~~~~~~~~~~~~~~~
#include "addNoZeroOption.H"
argList::validOptions.insert("constant", "");
argList::validOptions.insert("latestTime", "");
argList::validOptions.insert("noZero", "");
argList::validOptions.insert("time", "time");

View File

@ -1,2 +0,0 @@
#include "addTimeOption.H"
#include "addLatestTimeOption.H"

View File

@ -1,8 +1,4 @@
if if (Times.size() > 1 && !args.optionFound("constant"))
( {
!args.options().found("constant")
&& Times.size() > 1
)
{
startTime = 1; startTime = 1;
} }

View File

@ -1,4 +1,4 @@
if (args.options().found("latestTime")) if (args.optionFound("latestTime"))
{ {
startTime = Times.size() - 1; startTime = Times.size() - 1;
} }

View File

@ -1,6 +1,6 @@
if (args.options().found("time")) if (args.optionFound("time"))
{ {
scalar timeValue(readScalar(IStringStream(args.options()["time"])())); scalar timeValue = args.optionRead<scalar>("time");
startTime = Time::findClosestTimeIndex(Times, timeValue); startTime = Time::findClosestTimeIndex(Times, timeValue);
endTime = startTime + 1; endTime = startTime + 1;

View File

@ -1,16 +1,13 @@
word regionName; word regionName;
if (args.options().found("region")) if (args.optionReadIfPresent("region", regionName))
{ {
regionName = args.options()["region"];
Info<< "Create mesh " << regionName << " for time = " Info<< "Create mesh " << regionName << " for time = "
<< runTime.timeName() << nl << endl; << runTime.timeName() << nl << endl;
} }
else else
{ {
regionName = fvMesh::defaultRegion; regionName = fvMesh::defaultRegion;
Info<< "Create mesh for time = " Info<< "Create mesh for time = "
<< runTime.timeName() << nl << endl; << runTime.timeName() << nl << endl;
} }

View File

@ -1,16 +1,13 @@
word regionName; word regionName;
if (args.options().found("region")) if (args.optionReadIfPresent("region", regionName))
{ {
regionName = args.options()["region"];
Info<< "Create polyMesh " << regionName << " for time = " Info<< "Create polyMesh " << regionName << " for time = "
<< runTime.timeName() << nl << endl; << runTime.timeName() << nl << endl;
} }
else else
{ {
regionName = polyMesh::defaultRegion; regionName = polyMesh::defaultRegion;
Info<< "Create polyMesh for time = " Info<< "Create polyMesh for time = "
<< runTime.timeName() << nl << endl; << runTime.timeName() << nl << endl;
} }