mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: provide operator[] for accessing argList options.
- operator[] with label -> get args at index - operator[] with word -> get named option
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -90,7 +90,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (args.optionFound("flag"))
|
if (args.optionFound("flag"))
|
||||||
{
|
{
|
||||||
Info<<"-flag:" << args.option("flag") << endl;
|
Info<<"-flag:" << args["flag"] << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.optionReadIfPresent<scalar>("float", xxx))
|
if (args.optionReadIfPresent<scalar>("float", xxx))
|
||||||
|
|||||||
@ -58,7 +58,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (args.optionFound("ext"))
|
if (args.optionFound("ext"))
|
||||||
{
|
{
|
||||||
if (mvBak(srcFile, args.option("ext")))
|
if (mvBak(srcFile, args["ext"]))
|
||||||
{
|
{
|
||||||
ok++;
|
ok++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -94,11 +94,11 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
for (label count = 0; count < repeat; ++count)
|
for (label count = 0; count < repeat; ++count)
|
||||||
{
|
{
|
||||||
IFstream is(args.option("file"));
|
IFstream is(args["file"]);
|
||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
Info<< "tokenizing file: " << args.option("file") << nl;
|
Info<< "tokenizing file: " << args["file"] << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (is.good())
|
while (is.good())
|
||||||
|
|||||||
@ -101,20 +101,17 @@ int main(int argc, char *argv[])
|
|||||||
// List of cells to refine
|
// List of cells to refine
|
||||||
//
|
//
|
||||||
|
|
||||||
bool useSet = args.optionFound("useSet");
|
word setName;
|
||||||
|
if (args.optionReadIfPresent("useSet", setName))
|
||||||
if (useSet)
|
|
||||||
{
|
{
|
||||||
word setName(args.option("useSet"));
|
Info<< "Subsetting cells to cut based on cellSet"
|
||||||
|
<< setName << nl << endl;
|
||||||
Info<< "Subsetting cells to cut based on cellSet" << setName << endl
|
|
||||||
<< endl;
|
|
||||||
|
|
||||||
cellSet cells(mesh, setName);
|
cellSet cells(mesh, setName);
|
||||||
|
|
||||||
Info<< "Read " << cells.size() << " cells from cellSet "
|
Info<< "Read " << cells.size() << " cells from cellSet "
|
||||||
<< cells.instance()/cells.local()/cells.name()
|
<< cells.instance()/cells.local()/cells.name()
|
||||||
<< endl << endl;
|
<< nl << endl;
|
||||||
|
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
@ -125,8 +122,8 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
cutCells.erase(iter.key());
|
cutCells.erase(iter.key());
|
||||||
}
|
}
|
||||||
Info<< "Removed from cells to cut all the ones not in set " << setName
|
Info<< "Removed from cells to cut all the ones not in set "
|
||||||
<< endl << endl;
|
<< setName << nl << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark all meshpoints on patch
|
// Mark all meshpoints on patch
|
||||||
@ -180,9 +177,9 @@ int main(int argc, char *argv[])
|
|||||||
allCutEdges.shrink();
|
allCutEdges.shrink();
|
||||||
allCutEdgeWeights.shrink();
|
allCutEdgeWeights.shrink();
|
||||||
|
|
||||||
Info<< "Cutting:" << endl
|
Info<< "Cutting:" << nl
|
||||||
<< " cells:" << cutCells.size() << endl
|
<< " cells:" << cutCells.size() << nl
|
||||||
<< " edges:" << allCutEdges.size() << endl
|
<< " edges:" << allCutEdges.size() << nl
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
// Transfer DynamicLists to straight ones.
|
// Transfer DynamicLists to straight ones.
|
||||||
|
|||||||
@ -552,7 +552,7 @@ int main(int argc, char *argv[])
|
|||||||
<< "edge snapping tol : " << edgeTol << nl;
|
<< "edge snapping tol : " << edgeTol << nl;
|
||||||
if (readSet)
|
if (readSet)
|
||||||
{
|
{
|
||||||
Info<< "candidate cells : cellSet " << args.option("set") << nl;
|
Info<< "candidate cells : cellSet " << args["set"] << nl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -580,7 +580,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.option("set"));
|
cellSet cells(mesh, args["set"]);
|
||||||
|
|
||||||
cellsToCut = cells;
|
cellsToCut = cells;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -68,15 +68,12 @@ int main(int argc, char *argv[])
|
|||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
|
|
||||||
fileName kivaFileName("otape17");
|
fileName kivaFileName("otape17");
|
||||||
if (args.optionFound("file"))
|
args.optionReadIfPresent("file", kivaFileName);
|
||||||
{
|
|
||||||
kivaFileName = args.option("file");
|
|
||||||
}
|
|
||||||
|
|
||||||
kivaVersions kivaVersion = kiva3v;
|
kivaVersions kivaVersion = kiva3v;
|
||||||
if (args.optionFound("version"))
|
if (args.optionFound("version"))
|
||||||
{
|
{
|
||||||
word kivaVersionName = args.option("version");
|
const word kivaVersionName = args["version"];
|
||||||
|
|
||||||
if (kivaVersionName == "kiva3")
|
if (kivaVersionName == "kiva3")
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -463,7 +463,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
if (doCellSet)
|
if (doCellSet)
|
||||||
{
|
{
|
||||||
word setName(args.option("cellSet"));
|
const word setName = args["cellSet"];
|
||||||
|
|
||||||
cellSet cells(mesh, setName);
|
cellSet cells(mesh, setName);
|
||||||
|
|
||||||
@ -475,7 +475,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
if (doFaceSet)
|
if (doFaceSet)
|
||||||
{
|
{
|
||||||
word setName(args.option("faceSet"));
|
const word setName = args["faceSet"];
|
||||||
|
|
||||||
faceSet faces(mesh, setName);
|
faceSet faces(mesh, setName);
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -110,7 +110,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (args.optionFound("dict"))
|
if (args.optionFound("dict"))
|
||||||
{
|
{
|
||||||
fileName dictPath(args.option("dict"));
|
const fileName dictPath = args["dict"];
|
||||||
|
|
||||||
meshDictIoPtr.set
|
meshDictIoPtr.set
|
||||||
(
|
(
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -835,15 +835,14 @@ int main(int argc, char *argv[])
|
|||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||||
|
|
||||||
bool writeVTK = !args.optionFound("noVTK");
|
const bool writeVTK = !args.optionFound("noVTK");
|
||||||
bool loop = args.optionFound("loop");
|
const bool loop = args.optionFound("loop");
|
||||||
bool batch = args.optionFound("batch");
|
const bool batch = args.optionFound("batch");
|
||||||
|
|
||||||
|
|
||||||
if (loop && !batch)
|
if (loop && !batch)
|
||||||
{
|
{
|
||||||
FatalErrorIn(args.executable())
|
FatalErrorIn(args.executable())
|
||||||
<< "Can only loop when in batch mode."
|
<< "Can only loop in batch mode."
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -885,7 +884,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (batch)
|
if (batch)
|
||||||
{
|
{
|
||||||
fileName batchFile(args.option("batch"));
|
const fileName batchFile = args["batch"];
|
||||||
|
|
||||||
Info<< "Reading commands from file " << batchFile << endl;
|
Info<< "Reading commands from file " << batchFile << endl;
|
||||||
|
|
||||||
|
|||||||
@ -1326,9 +1326,8 @@ int main(int argc, char *argv[])
|
|||||||
const word oldInstance = mesh.pointsInstance();
|
const word oldInstance = mesh.pointsInstance();
|
||||||
|
|
||||||
word blockedFacesName;
|
word blockedFacesName;
|
||||||
if (args.optionFound("blockedFaces"))
|
if (args.optionReadIfPresent("blockedFaces", blockedFacesName))
|
||||||
{
|
{
|
||||||
blockedFacesName = args.option("blockedFaces");
|
|
||||||
Info<< "Reading blocked internal faces from faceSet "
|
Info<< "Reading blocked internal faces from faceSet "
|
||||||
<< blockedFacesName << nl << endl;
|
<< blockedFacesName << nl << endl;
|
||||||
}
|
}
|
||||||
@ -1882,7 +1881,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (insidePoint)
|
if (insidePoint)
|
||||||
{
|
{
|
||||||
point insidePoint(args.optionLookup("insidePoint")());
|
const point insidePoint = args.optionRead<point>("insidePoint");
|
||||||
|
|
||||||
label regionI = -1;
|
label regionI = -1;
|
||||||
|
|
||||||
|
|||||||
@ -174,7 +174,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (args.optionFound("patch"))
|
if (args.optionFound("patch"))
|
||||||
{
|
{
|
||||||
word patchName(args.option("patch"));
|
const word patchName = args["patch"];
|
||||||
|
|
||||||
patchI = mesh.boundaryMesh().findPatchID(patchName);
|
patchI = mesh.boundaryMesh().findPatchID(patchName);
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -210,7 +210,9 @@ int main(int argc, char *argv[])
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const bool doRotateFields = args.optionFound("rotateFields");
|
||||||
|
|
||||||
|
// this is not actually stringent enough:
|
||||||
if (args.options().empty())
|
if (args.options().empty())
|
||||||
{
|
{
|
||||||
FatalErrorIn(args.executable())
|
FatalErrorIn(args.executable())
|
||||||
@ -219,18 +221,20 @@ int main(int argc, char *argv[])
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.optionFound("translate"))
|
vector v;
|
||||||
|
if (args.optionReadIfPresent("translate", v))
|
||||||
{
|
{
|
||||||
vector transVector(args.optionLookup("translate")());
|
Info<< "Translating points by " << v << endl;
|
||||||
|
|
||||||
Info<< "Translating points by " << transVector << endl;
|
points += v;
|
||||||
|
|
||||||
points += transVector;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.optionFound("rotate"))
|
if (args.optionFound("rotate"))
|
||||||
{
|
{
|
||||||
Pair<vector> n1n2(args.optionLookup("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]);
|
||||||
@ -239,20 +243,17 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
points = transform(T, points);
|
points = transform(T, points);
|
||||||
|
|
||||||
if (args.optionFound("rotateFields"))
|
if (doRotateFields)
|
||||||
{
|
{
|
||||||
rotateFields(args, runTime, T);
|
rotateFields(args, runTime, T);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (args.optionFound("rollPitchYaw"))
|
else if (args.optionReadIfPresent("rollPitchYaw", v))
|
||||||
{
|
{
|
||||||
vector v(args.optionLookup("rollPitchYaw")());
|
|
||||||
|
|
||||||
Info<< "Rotating points by" << nl
|
Info<< "Rotating points by" << nl
|
||||||
<< " roll " << v.x() << nl
|
<< " roll " << v.x() << nl
|
||||||
<< " pitch " << v.y() << nl
|
<< " pitch " << v.y() << nl
|
||||||
<< " yaw " << v.z() << endl;
|
<< " yaw " << v.z() << nl;
|
||||||
|
|
||||||
|
|
||||||
// Convert to radians
|
// Convert to radians
|
||||||
v *= pi/180.0;
|
v *= pi/180.0;
|
||||||
@ -262,20 +263,17 @@ 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.optionFound("rotateFields"))
|
if (doRotateFields)
|
||||||
{
|
{
|
||||||
rotateFields(args, runTime, R.R());
|
rotateFields(args, runTime, R.R());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (args.optionFound("yawPitchRoll"))
|
else if (args.optionReadIfPresent("yawPitchRoll", v))
|
||||||
{
|
{
|
||||||
vector v(args.optionLookup("yawPitchRoll")());
|
|
||||||
|
|
||||||
Info<< "Rotating points by" << nl
|
Info<< "Rotating points by" << nl
|
||||||
<< " yaw " << v.x() << nl
|
<< " yaw " << v.x() << nl
|
||||||
<< " pitch " << v.y() << nl
|
<< " pitch " << v.y() << nl
|
||||||
<< " roll " << v.z() << endl;
|
<< " roll " << v.z() << nl;
|
||||||
|
|
||||||
|
|
||||||
// Convert to radians
|
// Convert to radians
|
||||||
v *= pi/180.0;
|
v *= pi/180.0;
|
||||||
@ -291,21 +289,19 @@ 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.optionFound("rotateFields"))
|
if (doRotateFields)
|
||||||
{
|
{
|
||||||
rotateFields(args, runTime, R.R());
|
rotateFields(args, runTime, R.R());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.optionFound("scale"))
|
if (args.optionReadIfPresent("scale", v))
|
||||||
{
|
{
|
||||||
vector scaleVector(args.optionLookup("scale")());
|
Info<< "Scaling points by " << v << endl;
|
||||||
|
|
||||||
Info<< "Scaling points by " << scaleVector << endl;
|
points.replace(vector::X, v.x()*points.component(vector::X));
|
||||||
|
points.replace(vector::Y, v.y()*points.component(vector::Y));
|
||||||
points.replace(vector::X, scaleVector.x()*points.component(vector::X));
|
points.replace(vector::Z, v.z()*points.component(vector::Z));
|
||||||
points.replace(vector::Y, scaleVector.y()*points.component(vector::Y));
|
|
||||||
points.replace(vector::Z, scaleVector.z()*points.component(vector::Z));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the precision of the points data to 10
|
// Set the precision of the points data to 10
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -66,7 +66,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
fileName dictFileName
|
fileName dictFileName
|
||||||
(
|
(
|
||||||
args.rootPath()/args.caseName()/args.option("dictionary")
|
args.rootPath()/args.caseName()/args["dictionary"]
|
||||||
);
|
);
|
||||||
|
|
||||||
IFstream dictFile(dictFileName);
|
IFstream dictFile(dictFileName);
|
||||||
@ -103,7 +103,7 @@ int main(int argc, char *argv[])
|
|||||||
true // wildcards
|
true // wildcards
|
||||||
);
|
);
|
||||||
|
|
||||||
for (int i=1; i<entryNames.size(); i++)
|
for (int i=1; i<entryNames.size(); ++i)
|
||||||
{
|
{
|
||||||
if (entPtr->dict().found(entryNames[i]))
|
if (entPtr->dict().found(entryNames[i]))
|
||||||
{
|
{
|
||||||
@ -118,7 +118,7 @@ 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.option("entry")
|
<< " in entry " << args["entry"]
|
||||||
<< " in dictionary " << dictFileName;
|
<< " in dictionary " << dictFileName;
|
||||||
FatalError.exit(3);
|
FatalError.exit(3);
|
||||||
}
|
}
|
||||||
@ -131,7 +131,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
FatalErrorIn(args.executable())
|
FatalErrorIn(args.executable())
|
||||||
<< "Cannot find entry "
|
<< "Cannot find entry "
|
||||||
<< args.option("entry")
|
<< args["entry"]
|
||||||
<< " in dictionary " << dictFileName
|
<< " in dictionary " << dictFileName
|
||||||
<< " is not a sub-dictionary";
|
<< " is not a sub-dictionary";
|
||||||
FatalError.exit(4);
|
FatalError.exit(4);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -80,7 +80,10 @@ Foam::ensightMesh::ensightMesh
|
|||||||
|
|
||||||
if (args.optionFound("patches"))
|
if (args.optionFound("patches"))
|
||||||
{
|
{
|
||||||
wordList patchNameList(args.optionLookup("patches")());
|
wordList patchNameList
|
||||||
|
(
|
||||||
|
args.optionLookup("patches")()
|
||||||
|
);
|
||||||
|
|
||||||
if (patchNameList.empty())
|
if (patchNameList.empty())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -215,9 +215,8 @@ int main(int argc, char *argv[])
|
|||||||
word cellSetName;
|
word cellSetName;
|
||||||
string vtkName;
|
string vtkName;
|
||||||
|
|
||||||
if (args.optionFound("cellSet"))
|
if (args.optionReadIfPresent("cellSet", cellSetName))
|
||||||
{
|
{
|
||||||
cellSetName = args.option("cellSet");
|
|
||||||
vtkName = cellSetName;
|
vtkName = cellSetName;
|
||||||
}
|
}
|
||||||
else if (Pstream::parRun())
|
else if (Pstream::parRun())
|
||||||
@ -738,7 +737,7 @@ int main(int argc, char *argv[])
|
|||||||
if (args.optionFound("faceSet"))
|
if (args.optionFound("faceSet"))
|
||||||
{
|
{
|
||||||
// Load the faceSet
|
// Load the faceSet
|
||||||
word setName(args.option("faceSet"));
|
const word setName = args["faceSet"];
|
||||||
labelList faceLabels(faceSet(mesh, setName).toc());
|
labelList faceLabels(faceSet(mesh, setName).toc());
|
||||||
|
|
||||||
// Filename as if patch with same name.
|
// Filename as if patch with same name.
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -329,9 +329,8 @@ int main(int argc, char *argv[])
|
|||||||
word cellSetName;
|
word cellSetName;
|
||||||
string vtkName = runTime.caseName();
|
string vtkName = runTime.caseName();
|
||||||
|
|
||||||
if (args.optionFound("cellSet"))
|
if (args.optionReadIfPresent("cellSet", cellSetName))
|
||||||
{
|
{
|
||||||
cellSetName = args.option("cellSet");
|
|
||||||
vtkName = cellSetName;
|
vtkName = cellSetName;
|
||||||
}
|
}
|
||||||
else if (Pstream::parRun())
|
else if (Pstream::parRun())
|
||||||
@ -423,7 +422,7 @@ int main(int argc, char *argv[])
|
|||||||
if (args.optionFound("faceSet"))
|
if (args.optionFound("faceSet"))
|
||||||
{
|
{
|
||||||
// Load the faceSet
|
// Load the faceSet
|
||||||
faceSet set(mesh, args.option("faceSet"));
|
faceSet set(mesh, args["faceSet"]);
|
||||||
|
|
||||||
// Filename as if patch with same name.
|
// Filename as if patch with same name.
|
||||||
mkDir(fvPath/set.name());
|
mkDir(fvPath/set.name());
|
||||||
@ -446,7 +445,7 @@ int main(int argc, char *argv[])
|
|||||||
if (args.optionFound("pointSet"))
|
if (args.optionFound("pointSet"))
|
||||||
{
|
{
|
||||||
// Load the pointSet
|
// Load the pointSet
|
||||||
pointSet set(mesh, args.option("pointSet"));
|
pointSet set(mesh, args["pointSet"]);
|
||||||
|
|
||||||
// Filename as if patch with same name.
|
// Filename as if patch with same name.
|
||||||
mkDir(fvPath/set.name());
|
mkDir(fvPath/set.name());
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -59,7 +59,7 @@ namespace Foam
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
args.option("dict"),
|
args["dict"],
|
||||||
runTime.system(),
|
runTime.system(),
|
||||||
runTime,
|
runTime,
|
||||||
IOobject::MUST_READ
|
IOobject::MUST_READ
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
label sourceTimeIndex = runTimeSource.timeIndex();
|
label sourceTimeIndex = runTimeSource.timeIndex();
|
||||||
if (args.optionFound("sourceTime"))
|
if (args.optionFound("sourceTime"))
|
||||||
{
|
{
|
||||||
if (args.option("sourceTime") == "latestTime")
|
if (args["sourceTime"] == "latestTime")
|
||||||
{
|
{
|
||||||
sourceTimeIndex = sourceTimes.size() - 1;
|
sourceTimeIndex = sourceTimes.size() - 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,7 +71,7 @@ int main(int argc, char *argv[])
|
|||||||
<< nl << endl;
|
<< nl << endl;
|
||||||
|
|
||||||
Info<< "Surface : " << inFileName1<< nl
|
Info<< "Surface : " << inFileName1<< nl
|
||||||
<< "Points : " << args.option("points") << nl
|
<< "Points : " << args["points"] << nl
|
||||||
<< "Writing : " << outFileName << nl << endl;
|
<< "Writing : " << outFileName << nl << endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -113,7 +113,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (addPoint)
|
if (addPoint)
|
||||||
{
|
{
|
||||||
IFstream pointsFile(args.option("points"));
|
IFstream pointsFile(args["points"]);
|
||||||
pointField extraPoints(pointsFile);
|
pointField extraPoints(pointsFile);
|
||||||
|
|
||||||
Info<< "Additional Points:" << extraPoints.size() << endl;
|
Info<< "Additional Points:" << extraPoints.size() << endl;
|
||||||
|
|||||||
@ -136,7 +136,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (args.optionFound("set"))
|
if (args.optionFound("set"))
|
||||||
{
|
{
|
||||||
fileName setName(args.option("set"));
|
const fileName setName = args["set"];
|
||||||
|
|
||||||
Info<< "Reading existing feature set from file " << setName << endl;
|
Info<< "Reading existing feature set from file " << setName << endl;
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
set = surfaceFeatures(surf, includedAngle);
|
set = surfaceFeatures(surf, includedAngle);
|
||||||
|
|
||||||
Info<< endl << "Writing initial features" << endl;
|
Info<< nl << "Writing initial features" << endl;
|
||||||
set.write("initial.fSet");
|
set.write("initial.fSet");
|
||||||
set.writeObj("initial");
|
set.writeObj("initial");
|
||||||
}
|
}
|
||||||
@ -210,7 +210,10 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (args.optionFound("subsetBox"))
|
if (args.optionFound("subsetBox"))
|
||||||
{
|
{
|
||||||
treeBoundBox bb(args.optionLookup("subsetBox")());
|
treeBoundBox bb
|
||||||
|
(
|
||||||
|
args.optionLookup("subsetBox")()
|
||||||
|
);
|
||||||
|
|
||||||
Info<< "Removing all edges outside bb " << bb << endl;
|
Info<< "Removing all edges outside bb " << bb << endl;
|
||||||
dumpBox(bb, "subsetBox.obj");
|
dumpBox(bb, "subsetBox.obj");
|
||||||
@ -225,7 +228,10 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if (args.optionFound("deleteBox"))
|
else if (args.optionFound("deleteBox"))
|
||||||
{
|
{
|
||||||
treeBoundBox bb(args.optionLookup("deleteBox")());
|
treeBoundBox bb
|
||||||
|
(
|
||||||
|
args.optionLookup("deleteBox")()
|
||||||
|
);
|
||||||
|
|
||||||
Info<< "Removing all edges inside bb " << bb << endl;
|
Info<< "Removing all edges inside bb " << bb << endl;
|
||||||
dumpBox(bb, "deleteBox.obj");
|
dumpBox(bb, "deleteBox.obj");
|
||||||
|
|||||||
@ -153,7 +153,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (args.optionFound("dict"))
|
if (args.optionFound("dict"))
|
||||||
{
|
{
|
||||||
fileName dictPath(args.option("dict"));
|
const fileName dictPath = args["dict"];
|
||||||
|
|
||||||
csDictIoPtr.set
|
csDictIoPtr.set
|
||||||
(
|
(
|
||||||
@ -200,7 +200,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (args.optionFound("from"))
|
if (args.optionFound("from"))
|
||||||
{
|
{
|
||||||
const word csName(args.option("from"));
|
const word csName = args["from"];
|
||||||
|
|
||||||
label csId = csLst.find(csName);
|
label csId = csLst.find(csName);
|
||||||
if (csId < 0)
|
if (csId < 0)
|
||||||
@ -216,7 +216,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (args.optionFound("to"))
|
if (args.optionFound("to"))
|
||||||
{
|
{
|
||||||
const word csName(args.option("to"));
|
const word csName = args["to"];
|
||||||
|
|
||||||
label csId = csLst.find(csName);
|
label csId = csLst.find(csName);
|
||||||
if (csId < 0)
|
if (csId < 0)
|
||||||
|
|||||||
@ -108,7 +108,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (args.optionFound("dict"))
|
if (args.optionFound("dict"))
|
||||||
{
|
{
|
||||||
fileName dictPath(args.option("dict"));
|
const fileName dictPath = args["dict"];
|
||||||
|
|
||||||
ioPtr.set
|
ioPtr.set
|
||||||
(
|
(
|
||||||
@ -155,7 +155,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (args.optionFound("from"))
|
if (args.optionFound("from"))
|
||||||
{
|
{
|
||||||
const word csName(args.option("from"));
|
const word csName = args["from"];
|
||||||
|
|
||||||
label csId = csLst.find(csName);
|
label csId = csLst.find(csName);
|
||||||
if (csId < 0)
|
if (csId < 0)
|
||||||
@ -171,7 +171,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (args.optionFound("to"))
|
if (args.optionFound("to"))
|
||||||
{
|
{
|
||||||
const word csName(args.option("to"));
|
const word csName = args["to"];
|
||||||
|
|
||||||
label csId = csLst.find(csName);
|
label csId = csLst.find(csName);
|
||||||
if (csId < 0)
|
if (csId < 0)
|
||||||
|
|||||||
@ -121,7 +121,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (args.optionFound("dict"))
|
if (args.optionFound("dict"))
|
||||||
{
|
{
|
||||||
fileName dictPath(args.option("dict"));
|
const fileName dictPath = args["dict"];
|
||||||
|
|
||||||
ioPtr.set
|
ioPtr.set
|
||||||
(
|
(
|
||||||
@ -168,7 +168,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (args.optionFound("from"))
|
if (args.optionFound("from"))
|
||||||
{
|
{
|
||||||
const word csName(args.option("from"));
|
const word csName = args["from"];
|
||||||
|
|
||||||
label csId = csLst.find(csName);
|
label csId = csLst.find(csName);
|
||||||
if (csId < 0)
|
if (csId < 0)
|
||||||
@ -184,7 +184,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (args.optionFound("to"))
|
if (args.optionFound("to"))
|
||||||
{
|
{
|
||||||
const word csName(args.option("to"));
|
const word csName = args["to"];
|
||||||
|
|
||||||
label csId = csLst.find(csName);
|
label csId = csLst.find(csName);
|
||||||
if (csId < 0)
|
if (csId < 0)
|
||||||
|
|||||||
@ -85,12 +85,14 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (args.optionFound("patches"))
|
if (args.optionFound("patches"))
|
||||||
{
|
{
|
||||||
wordList patchNames(args.optionLookup("patches")());
|
const wordList patchNames
|
||||||
|
(
|
||||||
|
args.optionLookup("patches")()
|
||||||
|
);
|
||||||
|
|
||||||
forAll(patchNames, patchNameI)
|
forAll(patchNames, patchNameI)
|
||||||
{
|
{
|
||||||
const word& patchName = patchNames[patchNameI];
|
const word& patchName = patchNames[patchNameI];
|
||||||
|
|
||||||
label patchI = bMesh.findPatchID(patchName);
|
label patchI = bMesh.findPatchID(patchName);
|
||||||
|
|
||||||
if (patchI == -1)
|
if (patchI == -1)
|
||||||
|
|||||||
@ -116,18 +116,20 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
pointField points(surf1.points());
|
pointField points(surf1.points());
|
||||||
|
|
||||||
if (args.optionFound("translate"))
|
vector v;
|
||||||
|
if (args.optionReadIfPresent("translate", v))
|
||||||
{
|
{
|
||||||
vector transVector(args.optionLookup("translate")());
|
Info<< "Translating points by " << v << endl;
|
||||||
|
|
||||||
Info<< "Translating points by " << transVector << endl;
|
points += v;
|
||||||
|
|
||||||
points += transVector;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.optionFound("rotate"))
|
if (args.optionFound("rotate"))
|
||||||
{
|
{
|
||||||
Pair<vector> n1n2(args.optionLookup("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]);
|
||||||
|
|
||||||
@ -137,15 +139,12 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
points = transform(T, points);
|
points = transform(T, points);
|
||||||
}
|
}
|
||||||
else if (args.optionFound("rollPitchYaw"))
|
else if (args.optionReadIfPresent("rollPitchYaw", v))
|
||||||
{
|
{
|
||||||
vector v(args.optionLookup("rollPitchYaw")());
|
|
||||||
|
|
||||||
Info<< "Rotating points by" << nl
|
Info<< "Rotating points by" << nl
|
||||||
<< " roll " << v.x() << nl
|
<< " roll " << v.x() << nl
|
||||||
<< " pitch " << v.y() << nl
|
<< " pitch " << v.y() << nl
|
||||||
<< " yaw " << v.z() << endl;
|
<< " yaw " << v.z() << nl;
|
||||||
|
|
||||||
|
|
||||||
// Convert to radians
|
// Convert to radians
|
||||||
v *= pi/180.0;
|
v *= pi/180.0;
|
||||||
@ -155,14 +154,12 @@ 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.optionFound("yawPitchRoll"))
|
else if (args.optionReadIfPresent("yawPitchRoll", v))
|
||||||
{
|
{
|
||||||
vector v(args.optionLookup("yawPitchRoll")());
|
|
||||||
|
|
||||||
Info<< "Rotating points by" << nl
|
Info<< "Rotating points by" << nl
|
||||||
<< " yaw " << v.x() << nl
|
<< " yaw " << v.x() << nl
|
||||||
<< " pitch " << v.y() << nl
|
<< " pitch " << v.y() << nl
|
||||||
<< " roll " << v.z() << endl;
|
<< " roll " << v.z() << nl;
|
||||||
|
|
||||||
|
|
||||||
// Convert to radians
|
// Convert to radians
|
||||||
@ -180,15 +177,13 @@ int main(int argc, char *argv[])
|
|||||||
points = transform(R, points);
|
points = transform(R, points);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.optionFound("scale"))
|
if (args.optionReadIfPresent("scale", v))
|
||||||
{
|
{
|
||||||
vector scaleVector(args.optionLookup("scale")());
|
Info<< "Scaling points by " << v << endl;
|
||||||
|
|
||||||
Info<< "Scaling points by " << scaleVector << endl;
|
points.replace(vector::X, v.x()*points.component(vector::X));
|
||||||
|
points.replace(vector::Y, v.y()*points.component(vector::Y));
|
||||||
points.replace(vector::X, scaleVector.x()*points.component(vector::X));
|
points.replace(vector::Z, v.z()*points.component(vector::Z));
|
||||||
points.replace(vector::Y, scaleVector.y()*points.component(vector::Y));
|
|
||||||
points.replace(vector::Z, scaleVector.z()*points.component(vector::Z));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
surf1.movePoints(points);
|
surf1.movePoints(points);
|
||||||
|
|||||||
@ -251,7 +251,7 @@ bool Foam::argList::regroupArgv(int& argc, char**& argv)
|
|||||||
|
|
||||||
// note: we also re-write directly into args_
|
// note: we also re-write directly into args_
|
||||||
// and use a second pass to sort out args/options
|
// and use a second pass to sort out args/options
|
||||||
for (int argI = 0; argI < argc; argI++)
|
for (int argI = 0; argI < argc; ++argI)
|
||||||
{
|
{
|
||||||
if (strcmp(argv[argI], "(") == 0)
|
if (strcmp(argv[argI], "(") == 0)
|
||||||
{
|
{
|
||||||
@ -369,7 +369,7 @@ Foam::argList::argList
|
|||||||
{
|
{
|
||||||
// Check if this run is a parallel run by searching for any parallel option
|
// Check if this run is a parallel run by searching for any parallel option
|
||||||
// If found call runPar which might filter argv
|
// If found call runPar which might filter argv
|
||||||
for (int argI = 0; argI < argc; argI++)
|
for (int argI = 0; argI < argc; ++argI)
|
||||||
{
|
{
|
||||||
if (argv[argI][0] == '-')
|
if (argv[argI][0] == '-')
|
||||||
{
|
{
|
||||||
@ -395,7 +395,7 @@ Foam::argList::argList
|
|||||||
int nArgs = 1;
|
int nArgs = 1;
|
||||||
string argListString = args_[0];
|
string argListString = args_[0];
|
||||||
|
|
||||||
for (int argI = 1; argI < args_.size(); argI++)
|
for (int argI = 1; argI < args_.size(); ++argI)
|
||||||
{
|
{
|
||||||
argListString += ' ';
|
argListString += ' ';
|
||||||
argListString += args_[argI];
|
argListString += args_[argI];
|
||||||
|
|||||||
@ -193,7 +193,7 @@ public:
|
|||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Name of executable
|
//- Name of executable without the path
|
||||||
inline const word& executable() const;
|
inline const word& executable() const;
|
||||||
|
|
||||||
//- Return root path
|
//- Return root path
|
||||||
@ -211,14 +211,12 @@ public:
|
|||||||
//- Return arguments
|
//- Return arguments
|
||||||
inline const stringList& args() const;
|
inline const stringList& args() const;
|
||||||
|
|
||||||
|
//- Return the argument corresponding to index.
|
||||||
|
inline const string& arg(const label index) const;
|
||||||
|
|
||||||
//- Return the number of arguments
|
//- Return the number of arguments
|
||||||
inline label size() const;
|
inline label size() const;
|
||||||
|
|
||||||
//- Return the argument corresponding to index.
|
|
||||||
// Index 0 corresponds to the name of the executable.
|
|
||||||
// Index 1 corresponds to the first argument.
|
|
||||||
inline const string& operator[](const label index) const;
|
|
||||||
|
|
||||||
//- Read a value from the argument at index.
|
//- Read a value from the argument at index.
|
||||||
// Index 0 corresponds to the name of the executable.
|
// Index 0 corresponds to the name of the executable.
|
||||||
// Index 1 corresponds to the first argument.
|
// Index 1 corresponds to the first argument.
|
||||||
@ -282,6 +280,15 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Return the argument corresponding to index.
|
||||||
|
// Index 0 corresponds to the name of the executable.
|
||||||
|
// Index 1 corresponds to the first argument.
|
||||||
|
inline const string& operator[](const label index) const;
|
||||||
|
|
||||||
|
//- Return the argument string associated with the named option
|
||||||
|
// @sa option()
|
||||||
|
inline const string& operator[](const word& opt) const;
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
|
|
||||||
//- Add to a bool option to validOptions with usage information
|
//- Add to a bool option to validOptions with usage information
|
||||||
|
|||||||
@ -64,6 +64,12 @@ inline const Foam::stringList& Foam::argList::args() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::string& Foam::argList::arg(const label index) const
|
||||||
|
{
|
||||||
|
return args_[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::argList::size() const
|
inline Foam::label Foam::argList::size() const
|
||||||
{
|
{
|
||||||
return args_.size();
|
return args_.size();
|
||||||
@ -78,7 +84,7 @@ inline const Foam::HashTable<Foam::string>& Foam::argList::options() const
|
|||||||
|
|
||||||
inline const Foam::string& Foam::argList::option(const word& opt) const
|
inline const Foam::string& Foam::argList::option(const word& opt) const
|
||||||
{
|
{
|
||||||
return options_.operator[](opt);
|
return options_[opt];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -90,7 +96,7 @@ inline bool Foam::argList::optionFound(const word& opt) const
|
|||||||
|
|
||||||
inline Foam::IStringStream Foam::argList::optionLookup(const word& opt) const
|
inline Foam::IStringStream Foam::argList::optionLookup(const word& opt) const
|
||||||
{
|
{
|
||||||
return IStringStream(option(opt));
|
return IStringStream(options_[opt]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -127,7 +133,7 @@ namespace Foam
|
|||||||
inline Foam::string
|
inline Foam::string
|
||||||
Foam::argList::optionRead<Foam::string>(const word& opt) const
|
Foam::argList::optionRead<Foam::string>(const word& opt) const
|
||||||
{
|
{
|
||||||
return option(opt);
|
return options_[opt];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Template specialization for word
|
// Template specialization for word
|
||||||
@ -135,7 +141,7 @@ namespace Foam
|
|||||||
inline Foam::word
|
inline Foam::word
|
||||||
Foam::argList::optionRead<Foam::word>(const word& opt) const
|
Foam::argList::optionRead<Foam::word>(const word& opt) const
|
||||||
{
|
{
|
||||||
return option(opt);
|
return options_[opt];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Template specialization for fileName
|
// Template specialization for fileName
|
||||||
@ -143,7 +149,7 @@ namespace Foam
|
|||||||
inline Foam::fileName
|
inline Foam::fileName
|
||||||
Foam::argList::optionRead<Foam::fileName>(const word& opt) const
|
Foam::argList::optionRead<Foam::fileName>(const word& opt) const
|
||||||
{
|
{
|
||||||
return option(opt);
|
return options_[opt];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,4 +241,10 @@ inline const Foam::string& Foam::argList::operator[](const label index) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::string& Foam::argList::operator[](const word& opt) const
|
||||||
|
{
|
||||||
|
return options_[opt];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -232,14 +232,12 @@ void Foam::calcTypes::addSubtract::preCalc
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.optionFound("field"))
|
if (args.optionReadIfPresent("field", addSubtractFieldName_))
|
||||||
{
|
{
|
||||||
addSubtractFieldName_ = args.option("field");
|
|
||||||
calcType_ = FIELD;
|
calcType_ = FIELD;
|
||||||
}
|
}
|
||||||
else if (args.optionFound("value"))
|
else if (args.optionReadIfPresent("value", addSubtractValueStr_))
|
||||||
{
|
{
|
||||||
addSubtractValueStr_ = args.option("value");
|
|
||||||
calcType_ = VALUE;
|
calcType_ = VALUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -249,10 +247,7 @@ void Foam::calcTypes::addSubtract::preCalc
|
|||||||
<< nl << exit(FatalError);
|
<< nl << exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.optionFound("resultName"))
|
args.optionReadIfPresent("resultName", resultName_);
|
||||||
{
|
|
||||||
resultName_ = args.option("resultName");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user