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");
if (args.options().found("cloudName"))
{
kinematicCloudName = args.options()["cloudName"];
}
args.optionReadIfPresent("cloudName", kinematicCloudName);
Info<< "Constructing kinematicCloud " << kinematicCloudName << endl;
basicKinematicCloud kinematicCloud

View File

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

View File

@ -465,7 +465,7 @@ int main(int argc, char *argv[])
scalar minLen(readScalar(IStringStream(args.additionalArgs()[0])()));
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);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -68,15 +68,15 @@ int main(int argc, char *argv[])
# include "createTime.H"
fileName kivaFileName("otape17");
if (args.options().found("file"))
if (args.optionFound("file"))
{
kivaFileName = args.options()["file"];
kivaFileName = args.option("file");
}
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")
{
@ -99,10 +99,7 @@ int main(int argc, char *argv[])
}
scalar zHeadMin = -GREAT;
if (args.options().found("zHeadMin"))
{
zHeadMin = atof(args.options()["zHeadMin"].c_str());
}
args.optionReadIfPresent("zHeadMin", zHeadMin);
# include "readKivaGrid.H"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -91,7 +91,7 @@ int main(int argc, char *argv[])
boundaryMesh bMesh;
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);

View File

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

View File

@ -93,11 +93,11 @@ int main(int argc, char *argv[])
// Additional patches
if (args.options().found("additionalPatches"))
if (args.optionFound("additionalPatches"))
{
const wordList patchNames
(
IStringStream(args.options()["additionalPatches"])()
args.optionLookup("additionalPatches")()
);
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"
runTime.functionObjects().off();
const bool overwrite = args.options().found("overwrite");
const bool overwrite = args.optionFound("overwrite");
Info<< "Reading createPatchDict." << nl << endl;

View File

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

View File

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

View File

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

View File

@ -723,7 +723,7 @@ int main(int argc, char *argv[])
# include "setRootCase.H"
# include "createTime.H"
bool writeVTK = !args.options().found("noVTK");
bool writeVTK = !args.optionFound("noVTK");
// Get times list
instantList Times = runTime.times();
@ -740,9 +740,9 @@ int main(int argc, char *argv[])
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;

View File

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

View File

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

View File

@ -1239,20 +1239,20 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance();
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 "
<< blockedFacesName << nl << endl;
}
bool makeCellZones = args.options().found("makeCellZones");
bool largestOnly = args.options().found("largestOnly");
bool insidePoint = args.options().found("insidePoint");
bool useCellZones = args.options().found("cellZones");
bool overwrite = args.options().found("overwrite");
bool detectOnly = args.options().found("detectOnly");
bool sloppyCellZones = args.options().found("sloppyCellZones");
bool makeCellZones = args.optionFound("makeCellZones");
bool largestOnly = args.optionFound("largestOnly");
bool insidePoint = args.optionFound("insidePoint");
bool useCellZones = args.optionFound("cellZones");
bool overwrite = args.optionFound("overwrite");
bool detectOnly = args.optionFound("detectOnly");
bool sloppyCellZones = args.optionFound("sloppyCellZones");
if (insidePoint && largestOnly)
{
@ -1771,7 +1771,7 @@ int main(int argc, char *argv[])
if (insidePoint)
{
point insidePoint(IStringStream(args.options()["insidePoint"])());
point insidePoint(args.optionLookup("insidePoint")());
label regionI = -1;

View File

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

View File

@ -162,7 +162,7 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance();
word setName(args.additionalArgs()[0]);
bool overwrite = args.options().found("overwrite");
bool overwrite = args.optionFound("overwrite");
Info<< "Reading cell set from " << setName << endl << endl;
@ -172,9 +172,9 @@ int main(int argc, char *argv[])
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);

View File

@ -171,18 +171,18 @@ int main(int argc, char *argv[])
<< 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;
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[1] /= mag(n1n2[1]);
tensor T = rotationTensor(n1n2[0], n1n2[1]);
@ -191,14 +191,14 @@ int main(int argc, char *argv[])
points = transform(T, points);
if (args.options().found("rotateFields"))
if (args.optionFound("rotateFields"))
{
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
<< " roll " << v.x() << nl
@ -214,14 +214,14 @@ int main(int argc, char *argv[])
Info<< "Rotating points by quaternion " << R << endl;
points = transform(R, points);
if (args.options().found("rotateFields"))
if (args.optionFound("rotateFields"))
{
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
<< " yaw " << v.x() << nl
@ -243,15 +243,15 @@ int main(int argc, char *argv[])
Info<< "Rotating points by quaternion " << R << endl;
points = transform(R, points);
if (args.options().found("rotateFields"))
if (args.optionFound("rotateFields"))
{
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;

View File

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

View File

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

View File

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

View File

@ -57,12 +57,12 @@ int main(int argc, char *argv[])
# include "createTime.H"
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
label nProcs = 0;

View File

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

View File

@ -240,10 +240,7 @@ scalar getMergeDistance
)
{
scalar mergeTol = defaultMergeTol;
if (args.options().found("mergeTol"))
{
mergeTol = readScalar(IStringStream(args.options()["mergeTol"])());
}
args.optionReadIfPresent("mergeTol", mergeTol);
scalar writeTol =
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& hex = *(cellModeller::lookup("hex"));
if (!args.options().found("noPatches"))
if (!args.optionFound("noPatches"))
{
forAll (mesh_.boundaryMesh(), patchI)
{
@ -136,9 +136,9 @@ Foam::ensightMesh::ensightMesh
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())
{
@ -228,7 +228,7 @@ Foam::ensightMesh::ensightMesh
reduce(meshCellSets_.nPolys, sumOp<label>());
}
if (!args.options().found("noPatches"))
if (!args.optionFound("noPatches"))
{
forAll (mesh.boundary(), patchI)
{

View File

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

View File

@ -107,7 +107,7 @@ int main(int argc, char *argv[])
// default to binary output, unless otherwise specified
IOstream::streamFormat format = IOstream::BINARY;
if (args.options().found("ascii"))
if (args.optionFound("ascii"))
{
format = IOstream::ASCII;
}
@ -115,14 +115,14 @@ int main(int argc, char *argv[])
// control for renumbering iterations
bool optIndex = false;
label indexingNumber = 0;
if (args.options().found("index"))
if (args.optionFound("index"))
{
optIndex = true;
indexingNumber = readLabel(IStringStream(args.options()["index"])());
indexingNumber = args.optionRead<label>("index");
}
// 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 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
(
mesh,
!args.options().found("noWall")
!args.optionFound("noWall")
)
);

View File

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

View File

@ -82,7 +82,7 @@ namespace Foam
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
(

View File

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

View File

@ -86,7 +86,7 @@ namespace Foam
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
(

View File

@ -38,7 +38,7 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
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
(

View File

@ -47,7 +47,7 @@ Description
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
(

View File

@ -39,7 +39,7 @@ Description
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
(

View File

@ -39,7 +39,7 @@ Description
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
(

View File

@ -39,7 +39,7 @@ Description
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
(

View File

@ -39,7 +39,7 @@ Description
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
(

View File

@ -76,16 +76,15 @@ int main(int argc, char *argv[])
// Set the mean boundary-layer thickness
dimensionedScalar ybl("ybl", dimLength, 0);
if (args.options().found("ybl"))
if (args.optionFound("ybl"))
{
// 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
ybl.value() =
gAverage(y)*readScalar(IStringStream(args.options()["Cbl"])());
ybl.value() = gAverage(y) * args.optionRead<scalar>("Cbl");
}
else
{
@ -155,7 +154,7 @@ int main(int argc, char *argv[])
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;
nut.write();

View File

@ -240,7 +240,7 @@ int main(int argc, char *argv[])
# include "createTime.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 "
<< "selectable" << nl << "wall functions"

View File

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

View File

@ -24,20 +24,7 @@
Info<< "Source: " << rootDirSource << " " << caseDirSource << nl
<< "Target: " << rootDirTarget << " " << caseDirTarget << endl;
bool parallelSource = false;
if (args.options().found("parallelSource"))
{
parallelSource = true;
}
bool parallelSource = args.optionFound("parallelSource");
bool parallelTarget = args.optionFound("parallelTarget");
bool consistent = args.optionFound("consistent");
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();
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;
}
else
{
scalar sourceTime =
readScalar(IStringStream(args.options()["sourceTime"])());
scalar sourceTime = args.optionRead<scalar>("sourceTime");
sourceTimeIndex = getTimeIndex(sourceTimes, sourceTime);
}
}

View File

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

View File

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

View File

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

View File

@ -139,20 +139,17 @@ int main(int argc, char *argv[])
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;
set = surfaceFeatures(surf, setName);
}
else if (args.options().found("includedAngle"))
else if (args.optionFound("includedAngle"))
{
scalar includedAngle
(
readScalar(IStringStream(args.options()["includedAngle"])())
);
scalar includedAngle = args.optionRead<scalar>("includedAngle");
Pout<< "Constructing feature set from included angle " << includedAngle
<< endl;
@ -190,16 +187,14 @@ int main(int argc, char *argv[])
// ~~~~~~~~
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;
}
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;
}
@ -218,9 +213,9 @@ int main(int argc, char *argv[])
// Convert to marked edges, points
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;
dumpBox(bb, "subsetBox.obj");
@ -233,9 +228,9 @@ int main(int argc, char *argv[])
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;
dumpBox(bb, "deleteBox.obj");

View File

@ -52,10 +52,12 @@ int main(int argc, char *argv[])
argList args(argc, argv);
scalar x(readScalar(IStringStream(args.options()["x"])()));
scalar y(readScalar(IStringStream(args.options()["y"])()));
scalar z(readScalar(IStringStream(args.options()["z"])()));
point samplePt(x, y, z);
point samplePt
(
args.optionRead<scalar>("x"),
args.optionRead<scalar>("y"),
args.optionRead<scalar>("z")
);
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> toCsys;
if (args.options().found("from") || args.options().found("to"))
if (args.optionFound("from") || args.optionFound("to"))
{
autoPtr<IOobject> csDictIoPtr;
if (args.options().found("dict"))
if (args.optionFound("dict"))
{
fileName dictPath(args.options()["dict"]);
fileName dictPath(args.option("dict"));
csDictIoPtr.set
(
@ -161,9 +161,9 @@ int main(int argc, char *argv[])
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);
if (csId < 0)
@ -177,9 +177,9 @@ int main(int argc, char *argv[])
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);
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);
if (args.options().found("clean"))
if (args.optionFound("clean"))
{
surf.cleanup(true);
}
if (scaleIn > 0)
scalar scaleIn = 0;
if (args.optionReadIfPresent("scaleIn", scaleIn) && scaleIn > 0)
{
Info<< " -scaleIn " << scaleIn << endl;
surf.scalePoints(scaleIn);
}
if (fromCsys.valid())
{
Info<< " -from " << fromCsys().name() << endl;
@ -243,7 +234,8 @@ int main(int argc, char *argv[])
surf.movePoints(tpf());
}
if (scaleOut > 0)
scalar scaleOut = 0;
if (args.optionReadIfPresent("scaleOut", scaleOut) && scaleOut > 0)
{
Info<< " -scaleOut " << scaleOut << endl;
surf.scalePoints(scaleOut);

View File

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

View File

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

View File

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

View File

@ -69,7 +69,7 @@ int main(int argc, char *argv[])
bool includeProcPatches =
!(
args.options().found("excludeProcPatches")
args.optionFound("excludeProcPatches")
|| Pstream::parRun()
);
@ -84,9 +84,9 @@ int main(int argc, char *argv[])
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)
{

View File

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

View File

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

View File

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

View File

@ -86,18 +86,18 @@ int main(int argc, char *argv[])
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;
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[1] /= mag(n1n2[1]);
@ -107,9 +107,9 @@ int main(int argc, char *argv[])
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
<< " roll " << v.x() << nl
@ -125,9 +125,9 @@ int main(int argc, char *argv[])
Info<< "Rotating points by quaternion " << R << endl;
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
<< " yaw " << v.x() << nl
@ -150,9 +150,9 @@ int main(int argc, char *argv[])
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;

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"
#include "addLatestTimeOption.H"
#include "addNoZeroOption.H"
//
// addTimeOptions.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
(
!args.options().found("constant")
&& Times.size() > 1
)
if (Times.size() > 1 && !args.optionFound("constant"))
{
startTime = 1;
}

View File

@ -1,4 +1,4 @@
if (args.options().found("latestTime"))
if (args.optionFound("latestTime"))
{
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);
endTime = startTime + 1;

View File

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

View File

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