Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2009-05-21 10:13:42 +01:00
193 changed files with 1494 additions and 1642 deletions

9
README
View File

@ -14,11 +14,10 @@
General Public License terms under which you can copy the files.
* System requirements
OpenFOAM is developed and tested on Linux, but should work with other Unix
style systems. To check your system setup, execute the foamSystemCheck script
in the bin/ directory of the OpenFOAM installation. If no problems are
reported, proceed to "3. Installation"; otherwise contact your system
administrator.
OpenFOAM is developed and tested on Linux, but should work with other POSIX
systems. To check your system setup, execute the foamSystemCheck script in
the bin/ directory of the OpenFOAM installation. If no problems are reported,
proceed to "3. Installation"; otherwise contact your system administrator.
If the user wishes to run OpenFOAM in 32/64-bit mode they should consult the
section "Running OpenFOAM in 32-bit mode".

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

@ -29,6 +29,8 @@ Description
\*---------------------------------------------------------------------------*/
#include "OSspecific.H"
#include "argList.H"
#include "wordReList.H"
#include "IOstreams.H"
#include "IStringStream.H"
@ -38,11 +40,21 @@ Description
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
argList::noParallel();
argList::validOptions.insert("reList", "reList");
argList::validOptions.insert("wordList", "wordList");
argList::validOptions.insert("stringList", "stringList");
argList::validOptions.insert("float", "xx");
argList::validOptions.insert("flag", "");
# include "setRootCase.H"
List<vector> list1(IStringStream("1 ((0 1 2))")());
Info<< "list1: " << list1 << endl;
@ -69,6 +81,43 @@ int main(int argc, char *argv[])
Info<< "Elements " << map << " out of " << list3
<< " => " << subList3 << endl;
wordReList reLst;
wordList wLst;
stringList sLst;
scalar xxx(-1);
if (args.optionFound("flag"))
{
Info<<"-flag:" << args.option("flag") << endl;
}
if (args.optionReadIfPresent<scalar>("float", xxx))
{
Info<<"read float " << xxx << endl;
}
if (args.optionFound("reList"))
{
reLst = args.optionReadList<wordRe>("reList");
}
if (args.optionFound("wordList"))
{
wLst = args.optionReadList<word>("wordList");
}
if (args.optionFound("stringList"))
{
sLst = args.optionReadList<string>("stringList");
}
Info<< nl
<< "-reList: " << reLst << nl
<< "-wordList: " << wLst << nl
<< "-stringList: " << sLst << endl;
return 0;
}

View File

@ -0,0 +1,2 @@
POSIXTest.C
EXE = $(FOAM_USER_APPBIN)/POSIXTest

View File

@ -1,2 +0,0 @@
UnixTest.C
EXE = $(FOAM_USER_APPBIN)/UnixTest

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

@ -45,6 +45,7 @@ Description
#include "argList.H"
#include "Time.H"
#include "timeSelector.H"
#include "fvMesh.H"
#include "mathematicalConstants.H"
#include "polyTopoChange.H"
@ -340,7 +341,8 @@ void dumpFeatures
int main(int argc, char *argv[])
{
argList::noParallel();
# include "addTimeOptions.H"
timeSelector::addOptions(true, false);
argList::validArgs.append("feature angle[0-180]");
argList::validOptions.insert("splitAllFaces", "");
argList::validOptions.insert("doNotPreserveFaceZones", "");
@ -349,13 +351,10 @@ int main(int argc, char *argv[])
# include "setRootCase.H"
# include "createTime.H"
// Get times list
instantList Times = runTime.times();
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
instantList timeDirs = timeSelector::select0(runTime, args);
# include "createMesh.H"
const word oldInstance = mesh.pointsInstance();
// Mark boundary edges and points.
@ -381,9 +380,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
(
@ -110,7 +110,7 @@ int main(int argc, char *argv[])
(
(
isDir(dictPath)
? dictPath/dictName
? dictPath/dictName
: dictPath
),
runTime,
@ -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

@ -59,11 +59,10 @@ int main(int argc, char *argv[])
pointField zeroPoints(mesh.points());
runTime.setTime(Times[0], 0);
for (int i = 1; i<Times.size(); i++)
// skip "constant" time
for (label timeI = 1; timeI < Times.size(); ++timeI)
{
runTime.setTime(Times[i], i);
runTime.setTime(Times[timeI], timeI);
Info<< "Time = " << runTime.timeName() << 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,8 +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)
{
Info<< "Ordering cells into regions (using decomposition);"
@ -395,15 +394,14 @@ int main(int argc, char *argv[])
<< endl;
}
const bool orderPoints = args.options().found("orderPoints");
const bool orderPoints = args.optionFound("orderPoints");
if (orderPoints)
{
Info<< "Ordering points into internal and boundary points." << nl
<< endl;
}
const bool writeMaps = args.options().found("writeMaps");
const bool writeMaps = args.optionFound("writeMaps");
if (writeMaps)
{
@ -411,7 +409,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

@ -591,24 +591,10 @@ commandStatus parseType
}
else if (setType == "time")
{
scalar time = readScalar(is);
scalar requestedTime = readScalar(is);
instantList Times = runTime.times();
int nearestIndex = -1;
scalar nearestDiff = Foam::GREAT;
forAll(Times, timeIndex)
{
if (Times[timeIndex].name() == "constant") continue;
scalar diff = fabs(Times[timeIndex].value() - time);
if (diff < nearestDiff)
{
nearestDiff = diff;
nearestIndex = timeIndex;
}
}
label nearestIndex = Time::findClosestTimeIndex(Times, requestedTime);
Pout<< "Changing time from " << runTime.timeName()
<< " to " << Times[nearestIndex].name()
@ -646,7 +632,8 @@ commandStatus parseType
}
default:
{
FatalErrorIn("parseType") << "Illegal mesh update state "
FatalErrorIn("parseType")
<< "Illegal mesh update state "
<< stat << abort(FatalError);
break;
}
@ -723,7 +710,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,13 +727,13 @@ 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;
// we also cannot handle .gz files
// we cannot handle .gz files
if (!isFile(batchFile, false))
{
FatalErrorIn(args.executable())
@ -864,7 +851,7 @@ int main(int argc, char *argv[])
delete fileStreamPtr;
}
Pout << nl << "End" << endl;
Pout<< "\nEnd" << endl;
return 0;
}

View File

@ -64,8 +64,7 @@ int main(int argc, char *argv[])
# include "setRootCase.H"
# include "createTime.H"
bool noFlipMap = args.options().found("noFlipMap");
bool noFlipMap = args.optionFound("noFlipMap");
// Get times list
instantList Times = runTime.times();
@ -73,9 +72,8 @@ int main(int argc, char *argv[])
label startTime = Times.size()-1;
label endTime = Times.size();
// check -time and -latestTime options
# include "checkTimeOption.H"
# include "checkLatestTimeOption.H"
runTime.setTime(Times[startTime], startTime);

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

@ -144,7 +144,7 @@ int main(int argc, char *argv[])
argList::validOptions.insert("yawPitchRoll", "(yaw pitch roll)");
argList::validOptions.insert("rotateFields", "");
argList::validOptions.insert("scale", "vector");
# include "setRootCase.H"
# include "createTime.H"
@ -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,9 +49,9 @@ int main(int argc, char *argv[])
Info<< endl;
if (args.options().found("times"))
if (args.optionFound("times"))
{
instantList times
instantList times
(
Foam::Time::findTimes(args.rootPath()/args.caseName())
);
@ -62,11 +62,11 @@ int main(int argc, char *argv[])
}
}
if (args.options().found("dictionary"))
if (args.optionFound("dictionary"))
{
fileName dictFileName
(
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

@ -1,18 +1,21 @@
for (int n1=startTime; n1<endTime; n1++)
// ignore special fields or fields that we don't handle
//
bool variableGood = true;
for (label n1=startTime; n1<endTime && variableGood; ++n1)
{
// ignore _0 fields
if (fieldName.size() > 2 && fieldName(fieldName.size() - 2, 2) == "_0")
{
variableGood = false;
break;
}
IOobject fieldObjectHeader
(
fieldName,
Times[n1].name(),
mesh,
IOobject::NO_READ
);
variableGood = variableGood && fieldObjectHeader.headerOk();
else
{
variableGood = IOobject
(
fieldName,
Times[n1].name(),
mesh,
IOobject::NO_READ
).headerOk();
}
}

View File

@ -1,19 +1,19 @@
bool meshMoving = true;
// check for "points" in all of the result directories
bool meshMoving = true;
if (Times.size() > 2)
{
for(label n2=2; n2<Times.size(); n2++)
{
IOobject tmpPoints
(
"points",
Times[n2].name(),
polyMesh::meshSubDir,
mesh,
IOobject::NO_READ
);
meshMoving = meshMoving && tmpPoints.headerOk();
}
for (label n1=2; n1<Times.size() && meshMoving; ++n1)
{
meshMoving = IOobject
(
"points",
Times[n1].name(),
polyMesh::meshSubDir,
mesh,
IOobject::NO_READ
).headerOk();
}
}
else
{

View File

@ -1,5 +0,0 @@
if (Pstream::master())
{
ensightCaseFile << "FORMAT" << nl;
ensightCaseFile << "type: ensight gold" << nl << nl;
}

View File

@ -275,8 +275,8 @@ template<class Type>
bool writePatchField
(
const Foam::Field<Type>& pf,
const Foam::label patchi,
const Foam::label ensightPatchi,
const Foam::label patchI,
const Foam::label ensightPatchI,
const Foam::faceSets& boundaryFaceSet,
const Foam::ensightMesh::nFacePrimitives& nfp,
const Foam::labelList& patchProcessors,
@ -289,7 +289,7 @@ bool writePatchField
{
ensightFile
<< "part" << nl
<< setw(10) << ensightPatchi << nl;
<< setw(10) << ensightPatchI << nl;
}
writeAllFaceData
@ -335,8 +335,8 @@ template<class Type>
bool writePatchFieldBinary
(
const Foam::Field<Type>& pf,
const Foam::label patchi,
const Foam::label ensightPatchi,
const Foam::label patchI,
const Foam::label ensightPatchI,
const Foam::faceSets& boundaryFaceSet,
const Foam::ensightMesh::nFacePrimitives& nfp,
const Foam::labelList& patchProcessors,
@ -348,7 +348,7 @@ bool writePatchFieldBinary
if (Pstream::master())
{
writeEnsDataBinary("part",ensightFile);
writeEnsDataBinary(ensightPatchi,ensightFile);
writeEnsDataBinary(ensightPatchI,ensightFile);
}
writeAllFaceDataBinary
@ -411,14 +411,14 @@ void writePatchField
const HashTable<ensightMesh::nFacePrimitives>&
nPatchPrims = eMesh.nPatchPrims();
label patchi = -1;
label patchI = -1;
if (patchIndices.found(patchName))
{
patchi = patchIndices.find(patchName)();
patchI = patchIndices.find(patchName)();
}
label ensightPatchi = 2;
label ensightPatchI = eMesh.patchPartOffset();
for
(
@ -429,7 +429,7 @@ void writePatchField
)
{
if (iter.key() == patchName) break;
ensightPatchi++;
ensightPatchI++;
}
@ -472,14 +472,14 @@ void writePatchField
ensightFile << pTraits<Type>::typeName << nl;
}
if (patchi >= 0)
if (patchI >= 0)
{
writePatchField
(
pf,
patchi,
ensightPatchi,
boundaryFaceSets[patchi],
patchI,
ensightPatchI,
boundaryFaceSets[patchI],
nPatchPrims.find(patchName)(),
patchProcessors,
ensightFile
@ -493,7 +493,7 @@ void writePatchField
(
Field<Type>(),
-1,
ensightPatchi,
ensightPatchI,
nullFaceSets,
nPatchPrims.find(patchName)(),
patchProcessors,
@ -621,7 +621,7 @@ void ensightFieldAscii
writeAllData("nfaced", vf, polys, meshCellSets.nPolys, ensightFile);
}
label ensightPatchi = 2;
label ensightPatchI = eMesh.patchPartOffset();
for
(
@ -637,23 +637,23 @@ void ensightFieldAscii
{
if (patchIndices.found(patchName))
{
label patchi = patchIndices.find(patchName)();
label patchI = patchIndices.find(patchName)();
if
(
writePatchField
(
vf.boundaryField()[patchi],
patchi,
ensightPatchi,
boundaryFaceSets[patchi],
vf.boundaryField()[patchI],
patchI,
ensightPatchI,
boundaryFaceSets[patchI],
nPatchPrims.find(patchName)(),
patchProcessors,
ensightFile
)
)
{
ensightPatchi++;
ensightPatchI++;
}
}
@ -667,7 +667,7 @@ void ensightFieldAscii
(
Field<Type>(),
-1,
ensightPatchi,
ensightPatchI,
nullFaceSet,
nPatchPrims.find(patchName)(),
patchProcessors,
@ -675,7 +675,7 @@ void ensightFieldAscii
)
)
{
ensightPatchi++;
ensightPatchI++;
}
}
}
@ -793,7 +793,7 @@ void ensightFieldBinary
writeAllDataBinary("nfaced", vf, polys, meshCellSets.nPolys, ensightFile);
}
label ensightPatchi = 2;
label ensightPatchI = eMesh.patchPartOffset();
for
(
@ -809,23 +809,23 @@ void ensightFieldBinary
{
if (patchIndices.found(patchName))
{
label patchi = patchIndices.find(patchName)();
label patchI = patchIndices.find(patchName)();
if
(
writePatchFieldBinary
(
vf.boundaryField()[patchi],
patchi,
ensightPatchi,
boundaryFaceSets[patchi],
vf.boundaryField()[patchI],
patchI,
ensightPatchI,
boundaryFaceSets[patchI],
nPatchPrims.find(patchName)(),
patchProcessors,
ensightFile
)
)
{
ensightPatchi++;
ensightPatchI++;
}
}
@ -839,7 +839,7 @@ void ensightFieldBinary
(
Field<Type>(),
-1,
ensightPatchi,
ensightPatchI,
nullFaceSet,
nPatchPrims.find(patchName)(),
patchProcessors,
@ -847,7 +847,7 @@ void ensightFieldBinary
)
)
{
ensightPatchi++;
ensightPatchI++;
}
}
}

View File

@ -89,8 +89,9 @@ Foam::ensightMesh::ensightMesh
const bool binary
)
:
binary_(binary),
mesh_(mesh),
binary_(binary),
patchPartOffset_(2),
meshCellSets_(mesh_.nCells()),
boundaryFaceSets_(mesh_.boundary().size()),
allPatchNames_(0),
@ -98,48 +99,6 @@ Foam::ensightMesh::ensightMesh
patchNames_(0),
nPatchPrims_(0)
{
forAll (mesh_.boundaryMesh(), patchi)
{
if
(
typeid(mesh_.boundaryMesh()[patchi])
!= typeid(processorPolyPatch)
)
{
if (!allPatchNames_.found(mesh_.boundaryMesh()[patchi].name()))
{
allPatchNames_.insert
(
mesh_.boundaryMesh()[patchi].name(),
labelList(1, Pstream::myProcNo())
);
patchIndices_.insert
(
mesh_.boundaryMesh()[patchi].name(),
patchi
);
}
}
}
combineReduce(allPatchNames_, concatPatchNames());
if (args.options().found("patches"))
{
wordList patchNameList(IStringStream(args.options()["patches"])());
if (patchNameList.empty())
{
patchNameList = allPatchNames_.toc();
}
forAll (patchNameList, i)
{
patchNames_.insert(patchNameList[i]);
}
}
const cellShapeList& cellShapes = mesh.cellShapes();
const cellModel& tet = *(cellModeller::lookup("tet"));
@ -148,51 +107,101 @@ Foam::ensightMesh::ensightMesh
const cellModel& wedge = *(cellModeller::lookup("wedge"));
const cellModel& hex = *(cellModeller::lookup("hex"));
labelList& tets = meshCellSets_.tets;
labelList& pyrs = meshCellSets_.pyrs;
labelList& prisms = meshCellSets_.prisms;
labelList& wedges = meshCellSets_.wedges;
labelList& hexes = meshCellSets_.hexes;
labelList& polys = meshCellSets_.polys;
// Count the shapes
label nTets = 0;
label nPyrs = 0;
label nPrisms = 0;
label nWedges = 0;
label nHexes = 0;
label nPolys = 0;
if (patchNames_.empty())
if (!args.optionFound("noPatches"))
{
forAll(cellShapes, celli)
forAll (mesh_.boundaryMesh(), patchI)
{
const cellShape& cellShape = cellShapes[celli];
if
(
typeid(mesh_.boundaryMesh()[patchI])
!= typeid(processorPolyPatch)
)
{
if (!allPatchNames_.found(mesh_.boundaryMesh()[patchI].name()))
{
allPatchNames_.insert
(
mesh_.boundaryMesh()[patchI].name(),
labelList(1, Pstream::myProcNo())
);
patchIndices_.insert
(
mesh_.boundaryMesh()[patchI].name(),
patchI
);
}
}
}
combineReduce(allPatchNames_, concatPatchNames());
if (args.optionFound("patches"))
{
wordList patchNameList(args.optionLookup("patches")());
if (patchNameList.empty())
{
patchNameList = allPatchNames_.toc();
}
forAll (patchNameList, i)
{
patchNames_.insert(patchNameList[i]);
}
}
}
if (patchNames_.size())
{
// no internalMesh
patchPartOffset_ = 1;
}
else
{
// Count the shapes
labelList& tets = meshCellSets_.tets;
labelList& pyrs = meshCellSets_.pyrs;
labelList& prisms = meshCellSets_.prisms;
labelList& wedges = meshCellSets_.wedges;
labelList& hexes = meshCellSets_.hexes;
labelList& polys = meshCellSets_.polys;
label nTets = 0;
label nPyrs = 0;
label nPrisms = 0;
label nWedges = 0;
label nHexes = 0;
label nPolys = 0;
forAll(cellShapes, cellI)
{
const cellShape& cellShape = cellShapes[cellI];
const cellModel& cellModel = cellShape.model();
if (cellModel == tet)
{
tets[nTets++] = celli;
tets[nTets++] = cellI;
}
else if (cellModel == pyr)
{
pyrs[nPyrs++] = celli;
pyrs[nPyrs++] = cellI;
}
else if (cellModel == prism)
{
prisms[nPrisms++] = celli;
prisms[nPrisms++] = cellI;
}
else if (cellModel == wedge)
{
wedges[nWedges++] = celli;
wedges[nWedges++] = cellI;
}
else if (cellModel == hex)
{
hexes[nHexes++] = celli;
hexes[nHexes++] = cellI;
}
else
{
polys[nPolys++] = celli;
polys[nPolys++] = cellI;
}
}
@ -219,49 +228,52 @@ Foam::ensightMesh::ensightMesh
reduce(meshCellSets_.nPolys, sumOp<label>());
}
forAll (mesh.boundary(), patchi)
if (!args.optionFound("noPatches"))
{
if (mesh.boundary()[patchi].size())
forAll (mesh.boundary(), patchI)
{
const polyPatch& p = mesh.boundaryMesh()[patchi];
labelList& tris = boundaryFaceSets_[patchi].tris;
labelList& quads = boundaryFaceSets_[patchi].quads;
labelList& polys = boundaryFaceSets_[patchi].polys;
tris.setSize(p.size());
quads.setSize(p.size());
polys.setSize(p.size());
label nTris = 0;
label nQuads = 0;
label nPolys = 0;
forAll(p, facei)
if (mesh.boundary()[patchI].size())
{
const face& f = p[facei];
const polyPatch& p = mesh.boundaryMesh()[patchI];
if (f.size() == 3)
labelList& tris = boundaryFaceSets_[patchI].tris;
labelList& quads = boundaryFaceSets_[patchI].quads;
labelList& polys = boundaryFaceSets_[patchI].polys;
tris.setSize(p.size());
quads.setSize(p.size());
polys.setSize(p.size());
label nTris = 0;
label nQuads = 0;
label nPolys = 0;
forAll(p, faceI)
{
tris[nTris++] = facei;
}
else if (f.size() == 4)
{
quads[nQuads++] = facei;
}
else
{
polys[nPolys++] = facei;
const face& f = p[faceI];
if (f.size() == 3)
{
tris[nTris++] = faceI;
}
else if (f.size() == 4)
{
quads[nQuads++] = faceI;
}
else
{
polys[nPolys++] = faceI;
}
}
tris.setSize(nTris);
quads.setSize(nQuads);
polys.setSize(nPolys);
}
tris.setSize(nTris);
quads.setSize(nQuads);
polys.setSize(nPolys);
}
}
forAllConstIter(HashTable<labelList>, allPatchNames_, iter)
{
const word& patchName = iter.key();
@ -271,12 +283,12 @@ Foam::ensightMesh::ensightMesh
{
if (patchIndices_.found(patchName))
{
label patchi = patchIndices_.find(patchName)();
label patchI = patchIndices_.find(patchName)();
nfp.nPoints = mesh.boundaryMesh()[patchi].localPoints().size();
nfp.nTris = boundaryFaceSets_[patchi].tris.size();
nfp.nQuads = boundaryFaceSets_[patchi].quads.size();
nfp.nPolys = boundaryFaceSets_[patchi].polys.size();
nfp.nPoints = mesh.boundaryMesh()[patchI].localPoints().size();
nfp.nTris = boundaryFaceSets_[patchI].tris.size();
nfp.nQuads = boundaryFaceSets_[patchI].quads.size();
nfp.nPolys = boundaryFaceSets_[patchI].polys.size();
}
}
@ -304,9 +316,9 @@ void Foam::ensightMesh::writePoints
OFstream& ensightGeometryFile
) const
{
forAll(pointsComponent, pointi)
forAll(pointsComponent, pointI)
{
ensightGeometryFile<< setw(12) << float(pointsComponent[pointi]) << nl;
ensightGeometryFile<< setw(12) << float(pointsComponent[pointI]) << nl;
}
}
@ -380,9 +392,9 @@ void Foam::ensightMesh::writePrims
{
const cellShape& cellPoints = cellShapes[i];
forAll(cellPoints, pointi)
forAll(cellPoints, pointI)
{
ensightGeometryFile<< setw(10) << cellPoints[pointi] + po;
ensightGeometryFile<< setw(10) << cellPoints[pointI] + po;
}
ensightGeometryFile << nl;
}
@ -415,9 +427,9 @@ void Foam::ensightMesh::writePrimsBinary
{
const cellShape& cellPoints = cellShapes[i];
forAll(cellPoints, pointi)
forAll(cellPoints, pointI)
{
temp[n] = cellPoints[pointi] + po;
temp[n] = cellPoints[pointI] + po;
n++;
}
}
@ -457,10 +469,10 @@ void Foam::ensightMesh::writePolys
{
const labelList& cf = cellFaces[polys[i]];
forAll(cf, facei)
forAll(cf, faceI)
{
ensightGeometryFile
<< setw(10) << faces[cf[facei]].size() << nl;
<< setw(10) << faces[cf[faceI]].size() << nl;
}
}
@ -468,13 +480,13 @@ void Foam::ensightMesh::writePolys
{
const labelList& cf = cellFaces[polys[i]];
forAll(cf, facei)
forAll(cf, faceI)
{
const face& f = faces[cf[facei]];
const face& f = faces[cf[faceI]];
forAll(f, pointi)
forAll(f, pointI)
{
ensightGeometryFile << setw(10) << f[pointi] + po;
ensightGeometryFile << setw(10) << f[pointI] + po;
}
ensightGeometryFile << nl;
}
@ -513,11 +525,11 @@ void Foam::ensightMesh::writePolysBinary
{
const labelList& cf = cellFaces[polys[i]];
forAll(cf, facei)
forAll(cf, faceI)
{
writeEnsDataBinary
(
faces[cf[facei]].size(),
faces[cf[faceI]].size(),
ensightGeometryFile
);
}
@ -527,13 +539,13 @@ void Foam::ensightMesh::writePolysBinary
{
const labelList& cf = cellFaces[polys[i]];
forAll(cf, facei)
forAll(cf, faceI)
{
const face& f = faces[cf[facei]];
const face& f = faces[cf[faceI]];
forAll(f, pointi)
forAll(f, pointI)
{
writeEnsDataBinary(f[pointi] + po,ensightGeometryFile);
writeEnsDataBinary(f[pointI] + po,ensightGeometryFile);
}
}
}
@ -648,9 +660,9 @@ void Foam::ensightMesh::writeFacePrims
{
const face& patchFace = patchFaces[i];
forAll(patchFace, pointi)
forAll(patchFace, pointI)
{
ensightGeometryFile << setw(10) << patchFace[pointi] + po;
ensightGeometryFile << setw(10) << patchFace[pointI] + po;
}
ensightGeometryFile << nl;
}
@ -690,11 +702,11 @@ void Foam::ensightMesh::writeFacePrimsBinary
{
const face& patchFace = patchFaces[i];
forAll(patchFace, pointi)
forAll(patchFace, pointI)
{
writeEnsDataBinary
(
patchFace[pointi] + po,
patchFace[pointI] + po,
ensightGeometryFile
);
}
@ -892,7 +904,7 @@ void Foam::ensightMesh::writeAscii
postProcPath/ensightGeometryFileName,
runTime.writeFormat(),
runTime.writeVersion(),
runTime.writeCompression()
IOstream::UNCOMPRESSED
);
}
@ -909,8 +921,8 @@ void Foam::ensightMesh::writeAscii
ensightGeometryFile.precision(5);
ensightGeometryFile
<< "OpenFOAM Geometry File " << nl
<< "OpenFOAM version " << Foam::FOAMversion << nl
<< "EnSight Geometry File" << nl
<< "written from OpenFOAM-" << Foam::FOAMversion << nl
<< "node id assign" << nl
<< "element id assign" << nl;
}
@ -927,7 +939,7 @@ void Foam::ensightMesh::writeAscii
ensightGeometryFile
<< "part" << nl
<< setw(10) << 1 << nl
<< "FOAM cells" << nl
<< "internalMesh" << nl
<< "coordinates" << nl
<< setw(10) << nPoints
<< endl;
@ -1038,7 +1050,7 @@ void Foam::ensightMesh::writeAscii
}
label ensightPatchi = 2;
label ensightPatchI = patchPartOffset_;
forAllConstIter(HashTable<labelList>, allPatchNames_, iter)
{
@ -1049,7 +1061,7 @@ void Foam::ensightMesh::writeAscii
const word& patchName = iter.key();
const nFacePrimitives& nfp = nPatchPrims_.find(patchName)();
const labelList *trisPtr = NULL;
const labelList *trisPtr = NULL;
const labelList *quadsPtr = NULL;
const labelList *polysPtr = NULL;
@ -1058,15 +1070,15 @@ void Foam::ensightMesh::writeAscii
if (patchIndices_.found(iter.key()))
{
label patchi = patchIndices_.find(iter.key())();
const polyPatch& p = mesh_.boundaryMesh()[patchi];
label patchI = patchIndices_.find(iter.key())();
const polyPatch& p = mesh_.boundaryMesh()[patchI];
trisPtr = &boundaryFaceSets_[patchi].tris;
quadsPtr = &boundaryFaceSets_[patchi].quads;
polysPtr = &boundaryFaceSets_[patchi].polys;
trisPtr = &boundaryFaceSets_[patchI].tris;
quadsPtr = &boundaryFaceSets_[patchI].quads;
polysPtr = &boundaryFaceSets_[patchI].polys;
patchPointsPtr = &(p.localPoints());
patchFacesPtr = &(p.localFaces());
patchFacesPtr = &(p.localFaces());
}
const labelList& tris = *trisPtr;
@ -1083,7 +1095,7 @@ void Foam::ensightMesh::writeAscii
{
ensightGeometryFile
<< "part" << nl
<< setw(10) << ensightPatchi++ << nl
<< setw(10) << ensightPatchI++ << nl
<< patchName << nl
<< "coordinates" << nl
<< setw(10) << nfp.nPoints
@ -1235,11 +1247,11 @@ void Foam::ensightMesh::writeBinary
if (Pstream::master())
{
writeEnsDataBinary("C binary",ensightGeometryFile);
writeEnsDataBinary("OpenFOAM Geometry File",ensightGeometryFile);
writeEnsDataBinary("Binary format",ensightGeometryFile);
writeEnsDataBinary("node id assign",ensightGeometryFile);
writeEnsDataBinary("element id assign",ensightGeometryFile);
writeEnsDataBinary("C binary", ensightGeometryFile);
writeEnsDataBinary("EnSight Geometry File", ensightGeometryFile);
writeEnsDataBinary("written from OpenFOAM", ensightGeometryFile);
writeEnsDataBinary("node id assign", ensightGeometryFile);
writeEnsDataBinary("element id assign", ensightGeometryFile);
}
labelList pointOffsets(Pstream::nProcs(), 0);
@ -1364,8 +1376,7 @@ void Foam::ensightMesh::writeBinary
}
label ensightPatchi = 2;
label ensightPatchI = patchPartOffset_;
label iCount = 0;
forAllConstIter(HashTable<labelList>, allPatchNames_, iter)
@ -1387,12 +1398,12 @@ void Foam::ensightMesh::writeBinary
if (patchIndices_.found(iter.key()))
{
label patchi = patchIndices_.find(iter.key())();
const polyPatch& p = mesh_.boundaryMesh()[patchi];
label patchI = patchIndices_.find(iter.key())();
const polyPatch& p = mesh_.boundaryMesh()[patchI];
trisPtr = &boundaryFaceSets_[patchi].tris;
quadsPtr = &boundaryFaceSets_[patchi].quads;
polysPtr = &boundaryFaceSets_[patchi].polys;
trisPtr = &boundaryFaceSets_[patchI].tris;
quadsPtr = &boundaryFaceSets_[patchI].quads;
polysPtr = &boundaryFaceSets_[patchI].polys;
patchPointsPtr = &(p.localPoints());
patchFacesPtr = &(p.localFaces());
@ -1411,7 +1422,7 @@ void Foam::ensightMesh::writeBinary
if (Pstream::master())
{
writeEnsDataBinary("part",ensightGeometryFile);
writeEnsDataBinary(ensightPatchi++,ensightGeometryFile);
writeEnsDataBinary(ensightPatchI++,ensightGeometryFile);
//writeEnsDataBinary(patchName.c_str(),ensightGeometryFile);
writeEnsDataBinary(iter.key().c_str(),ensightGeometryFile);
writeEnsDataBinary("coordinates",ensightGeometryFile);

View File

@ -78,11 +78,14 @@ class ensightMesh
// Private data
//- Reference to the OpenFOAM mesh
const fvMesh& mesh_;
//- Set binary file output
bool binary_;
//- Reference to the OpenFOAM mesh
const fvMesh& mesh_;
//- The ensight part id for the first patch
label patchPartOffset_;
cellSets meshCellSets_;
@ -286,6 +289,12 @@ public:
return nPatchPrims_;
}
//- The ensight part id for the first patch
label patchPartOffset() const
{
return patchPartOffset_;
}
// I-O

View File

@ -23,7 +23,9 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Translates FOAM data to EnSight format
Translates FOAM data to EnSight format.
An Ensight part is created for the internalMesh and for each patch.
Usage
- foamToEnsight [OPTION] \n
@ -32,12 +34,21 @@ Usage
@param -ascii \n
Write Ensight data in ASCII format instead of "C Binary"
@param -patches patchList \n
Specify particular patches to write.
Specifying an empty list suppresses writing the internalMesh.
@param -noPatches \n
Suppress writing any patches.
Note
Parallel support for cloud data is not supported
- writes to @a EnSight directory to avoid collisions with foamToEnsightParts
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "IOobjectList.H"
#include "IOmanip.H"
#include "OFstream.H"
@ -82,18 +93,15 @@ bool inFileNameList
int main(int argc, char *argv[])
{
argList::validOptions.insert("patches", "patch list");
argList::validOptions.insert("ascii", "" );
# include "addTimeOptions.H"
argList::validOptions.insert("patches", "patchList");
argList::validOptions.insert("noPatches", "");
# include "addTimeOptions.H"
# include "setRootCase.H"
// Check options
bool binary = true;
if (args.options().found("ascii"))
{
binary = false;
}
bool binary = !args.optionFound("ascii");
# include "createTime.H"
@ -114,29 +122,28 @@ int main(int argc, char *argv[])
regionPrefix = regionName;
}
const label nTypes = 2;
const word fieldTypes[] =
const label nVolFieldTypes = 5;
const word volFieldTypes[] =
{
volScalarField::typeName,
volVectorField::typeName
volVectorField::typeName,
volSphericalTensorField::typeName,
volSymmTensorField::typeName,
volTensorField::typeName
};
// Create the output folder
const word postProcDir = "EnSight";
// Path to EnSight folder at case level only
// - For parallel cases, data only written from master
// fileName postProcPath = runTime.path()/postProcDir;
fileName postProcPath = args.rootPath()/args.globalCaseName()/postProcDir;
fileName ensightDir = args.rootPath()/args.globalCaseName()/"EnSight";
if (Pstream::master())
{
if (isDir(postProcPath))
if (isDir(ensightDir))
{
rmDir(postProcPath);
rmDir(ensightDir);
}
mkDir(postProcPath);
mkDir(ensightDir);
}
// Start of case file header output
@ -147,36 +154,23 @@ int main(int argc, char *argv[])
OFstream *ensightCaseFilePtr = NULL;
if (Pstream::master())
{
fileName ensightCaseFileName = prepend + "case";
fileName caseFileName = prepend + "case";
Info<< nl << "write case: " << caseFileName.c_str() << endl;
if (!binary)
{
ensightCaseFilePtr = new OFstream
(
postProcPath/ensightCaseFileName,
runTime.writeFormat(),
runTime.writeVersion(),
runTime.writeCompression()
);
}
else
{
ensightCaseFilePtr = new OFstream
(
postProcPath/ensightCaseFileName,
runTime.writeFormat(),
runTime.writeVersion(),
IOstream::UNCOMPRESSED
);
}
// the case file is always ASCII
ensightCaseFilePtr = new OFstream
(
ensightDir/caseFileName,
IOstream::ASCII
);
Info<< nl << "Case file is " << ensightCaseFileName << endl;
*ensightCaseFilePtr
<< "FORMAT" << nl
<< "type: ensight gold" << nl << nl;
}
OFstream& ensightCaseFile = *ensightCaseFilePtr;
# include "ensightCaseHeader.H"
// Construct the EnSight mesh
ensightMesh eMesh(mesh, args, binary);
@ -188,19 +182,20 @@ int main(int argc, char *argv[])
# include "checkMeshMoving.H"
wordHashSet allCloudNames;
word geomCaseFileName = prepend + "000";
if (Pstream::master())
{
word geomFileName = prepend + "000";
// test pre check variable if there is a moving mesh
if (meshMoving == true)
if (meshMoving)
{
geomCaseFileName = prepend + "***";
geomFileName = prepend + "***";
}
ensightCaseFile
<< "GEOMETRY" << nl
<< "model: 1 "
<< (geomCaseFileName + ".mesh").c_str() << nl;
<< (geomFileName + ".mesh").c_str() << nl;
}
// Identify if lagrangian data exists at each time, and add clouds
@ -304,7 +299,7 @@ int main(int argc, char *argv[])
{
eMesh.write
(
postProcPath,
ensightDir,
prepend,
timeIndex,
ensightCaseFile
@ -324,94 +319,94 @@ int main(int argc, char *argv[])
// Cell field data output
// ~~~~~~~~~~~~~~~~~~~~~~
for (label i=0; i<nTypes; i++)
for (label i=0; i<nVolFieldTypes; i++)
{
wordList fieldNames = objects.names(fieldTypes[i]);
wordList fieldNames = objects.names(volFieldTypes[i]);
for (label j=0; j<fieldNames.size(); j++)
{
word fieldName = fieldNames[j];
bool variableGood = true;
# include "checkData.H"
if (variableGood)
if (!variableGood)
{
IOobject fieldObject
(
fieldName,
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
);
continue;
}
if (fieldTypes[i] == volScalarField::typeName)
{
ensightField<scalar>
(
fieldObject,
eMesh,
postProcPath,
prepend,
timeIndex,
binary,
ensightCaseFile
);
}
else if (fieldTypes[i] == volVectorField::typeName)
{
ensightField<vector>
(
fieldObject,
eMesh,
postProcPath,
prepend,
timeIndex,
binary,
ensightCaseFile
);
}
else if (fieldTypes[i] == volSphericalTensorField::typeName)
{
ensightField<sphericalTensor>
(
fieldObject,
eMesh,
postProcPath,
prepend,
timeIndex,
binary,
ensightCaseFile
);
}
else if (fieldTypes[i] == volSymmTensorField::typeName)
{
ensightField<symmTensor>
(
fieldObject,
eMesh,
postProcPath,
prepend,
timeIndex,
binary,
ensightCaseFile
);
}
else if (fieldTypes[i] == volTensorField::typeName)
{
ensightField<tensor>
(
fieldObject,
eMesh,
postProcPath,
prepend,
timeIndex,
binary,
ensightCaseFile
);
}
IOobject fieldObject
(
fieldName,
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (volFieldTypes[i] == volScalarField::typeName)
{
ensightField<scalar>
(
fieldObject,
eMesh,
ensightDir,
prepend,
timeIndex,
binary,
ensightCaseFile
);
}
else if (volFieldTypes[i] == volVectorField::typeName)
{
ensightField<vector>
(
fieldObject,
eMesh,
ensightDir,
prepend,
timeIndex,
binary,
ensightCaseFile
);
}
else if (volFieldTypes[i] == volSphericalTensorField::typeName)
{
ensightField<sphericalTensor>
(
fieldObject,
eMesh,
ensightDir,
prepend,
timeIndex,
binary,
ensightCaseFile
);
}
else if (volFieldTypes[i] == volSymmTensorField::typeName)
{
ensightField<symmTensor>
(
fieldObject,
eMesh,
ensightDir,
prepend,
timeIndex,
binary,
ensightCaseFile
);
}
else if (volFieldTypes[i] == volTensorField::typeName)
{
ensightField<tensor>
(
fieldObject,
eMesh,
ensightDir,
prepend,
timeIndex,
binary,
ensightCaseFile
);
}
}
}
@ -434,7 +429,7 @@ int main(int argc, char *argv[])
ensightParticlePositions
(
mesh,
postProcPath,
ensightDir,
timeFile,
cloudName,
cloudExists
@ -460,7 +455,7 @@ int main(int argc, char *argv[])
ensightCloudField<scalar>
(
fieldObject,
postProcPath,
ensightDir,
prepend,
timeIndex,
cloudName,
@ -473,7 +468,7 @@ int main(int argc, char *argv[])
ensightCloudField<vector>
(
fieldObject,
postProcPath,
ensightDir,
prepend,
timeIndex,
cloudName,

View File

@ -6,15 +6,13 @@ if (timeDirs.size() > 1)
hasMovingMesh = true;
for (label i=0; i < timeDirs.size() && hasMovingMesh; ++i)
{
IOobject io
hasMovingMesh = IOobject
(
"points",
timeDirs[i].name(),
polyMesh::meshSubDir,
mesh,
IOobject::NO_READ
);
hasMovingMesh = io.headerOk();
).headerOk();
}
}

View File

@ -1,40 +1,40 @@
// check the final time directory for
// check the final time directory for the following:
// 1. volume fields
HashTable<word> volumeFields;
// 2. the fields for each cloud:
HashTable<HashTable<word> > cloudFields;
HashTable< HashTable<word> > cloudFields;
if (timeDirs.size() > 1)
if (timeDirs.size())
{
IOobjectList objs(mesh, timeDirs[timeDirs.size()-1].name());
forAllConstIter(IOobjectList, objs, fieldIter)
{
const IOobject& obj = *fieldIter();
const word& fieldName = obj.name();
const word& fieldType = obj.headerClassName();
if
(
obj.headerClassName() == volScalarField::typeName
|| obj.headerClassName() == volVectorField::typeName
)
if (fieldName.size() > 2 && fieldName(fieldName.size()-2, 2) == "_0")
{
// Add field and field type
volumeFields.insert
(
obj.name(),
obj.headerClassName()
);
// ignore _0 fields
}
else if (volFieldTypes.found(fieldType))
{
// simply ignore types that we don't handle
volumeFields.insert(fieldName, fieldType);
}
}
// now check for lagrangian/<cloudName>
//
// now check for lagrangian/<cloudName>
//
fileNameList cloudDirs = readDir
(
runTime.path()
/ timeDirs[timeDirs.size() - 1].name()
/ timeDirs[timeDirs.size()-1].name()
/ regionPrefix
/ cloud::prefix,
fileName::DIRECTORY
@ -47,42 +47,59 @@ if (timeDirs.size() > 1)
// Create a new hash table for each cloud
cloudFields.insert(cloudName, HashTable<word>());
// Identify the new cloud in the hash table
// Identify the new cloud within the hash table
HashTable<HashTable<word> >::iterator cloudIter =
cloudFields.find(cloudName);
IOobjectList cloudObjs
IOobjectList objs
(
mesh,
timeDirs[timeDirs.size() - 1].name(),
timeDirs[timeDirs.size()-1].name(),
cloud::prefix/cloudName
);
bool hasPositions = false;
forAllConstIter(IOobjectList, cloudObjs, fieldIter)
forAllConstIter(IOobjectList, objs, fieldIter)
{
const IOobject obj = *fieldIter();
const word& fieldName = obj.name();
const word& fieldType = obj.headerClassName();
if (obj.name() == "positions")
if (fieldName == "positions")
{
hasPositions = true;
}
else
else if (cloudFieldTypes.found(fieldType))
{
// Add field and field type
cloudIter().insert
(
obj.name(),
obj.headerClassName()
);
// simply ignore types that we don't handle
cloudIter().insert(fieldName, fieldType);
}
}
// drop this cloud if it has no positions
if (!hasPositions)
// drop this cloud if it has no positions or is otherwise empty
if (!hasPositions || cloudIter().empty())
{
Info<< "removing cloud " << cloudName << endl;
cloudFields.erase(cloudIter);
}
}
//
// verify that the variable is present for all times
//
for (label i=0; volumeFields.size() && i < timeDirs.size(); ++i)
{
IOobjectList objs(mesh, timeDirs[i].name());
forAllIter(HashTable<word>, volumeFields, fieldIter)
{
const word& fieldName = fieldIter.key();
if (!objs.found(fieldName))
{
volumeFields.erase(fieldIter);
}
}
}
}

View File

@ -83,23 +83,19 @@ int main(int argc, char *argv[])
argList::validOptions.insert("index", "start");
argList::validOptions.insert("noMesh", "");
const word volFieldTypes[] =
{
volScalarField::typeName,
volVectorField::typeName,
volSphericalTensorField::typeName,
volSymmTensorField::typeName,
volTensorField::typeName,
word::null
};
// the volume field types that we handle
wordHashSet volFieldTypes;
volFieldTypes.insert(volScalarField::typeName);
volFieldTypes.insert(volVectorField::typeName);
volFieldTypes.insert(volSphericalTensorField::typeName);
volFieldTypes.insert(volSymmTensorField::typeName);
volFieldTypes.insert(volTensorField::typeName);
const word sprayFieldTypes[] =
{
scalarIOField::typeName,
vectorIOField::typeName,
tensorIOField::typeName,
word::null
};
// the lagrangian field types that we handle
wordHashSet cloudFieldTypes;
cloudFieldTypes.insert(scalarIOField::typeName);
cloudFieldTypes.insert(vectorIOField::typeName);
cloudFieldTypes.insert(tensorIOField::typeName);
const char* geometryName = "geometry";
@ -111,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;
}
@ -119,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";
@ -168,7 +164,6 @@ int main(int argc, char *argv[])
# include "checkHasMovingMesh.H"
# include "findFields.H"
# include "validateFields.H"
if (hasMovingMesh && optNoMesh)
{

View File

@ -11,8 +11,6 @@
{
// Read new points
io.readOpt() = IOobject::MUST_READ;
pointIOField newPoints(io);
mesh.movePoints(newPoints);
mesh.movePoints(pointIOField(io));
}
}

View File

@ -1,105 +0,0 @@
// ignore special fields or fields that we don't handle
//
forAllIter(HashTable<word>, volumeFields, fieldIter)
{
const word& fieldName = fieldIter.key();
const word& fieldType = fieldIter();
// ignore _0 fields
if (fieldName.size() > 2 && fieldName(fieldName.size() - 2, 2) == "_0")
{
volumeFields.erase(fieldIter);
}
else
{
// remove types that we don't handle:
bool invalid = true;
for (label typeI=0; invalid && volFieldTypes[typeI].size(); ++typeI)
{
if (fieldType == volFieldTypes[typeI])
{
invalid = false;
}
}
if (invalid)
{
Info<< "ignoring " << fieldType << ": " << fieldName << endl;
volumeFields.erase(fieldIter);
}
}
}
// verify that the variable is present for all times
//
for (label i=0; volumeFields.size() && i < timeDirs.size(); ++i)
{
IOobjectList objs(mesh, timeDirs[i].name());
forAllIter(HashTable<word>, volumeFields, fieldIter)
{
const word& fieldName = fieldIter.key();
if (!objs.found(fieldName))
{
volumeFields.erase(fieldIter);
}
}
}
// ignore fields that we don't handle
//
forAllIter(HashTable<HashTable<word> >, cloudFields, cloudIter)
{
const word& cloudName = cloudIter.key();
forAllIter(HashTable<word>, cloudIter(), fieldIter)
{
const word& fieldName = fieldIter.key();
const word& fieldType = fieldIter();
// remove types that we don't handle:
bool invalid = true;
for (label typeI=0; invalid && sprayFieldTypes[typeI].size(); ++typeI)
{
if (fieldType == sprayFieldTypes[typeI])
{
invalid = false;
}
}
if (invalid)
{
Info<< "ignoring " << fieldType << ": " << fieldName << endl;
cloudIter().erase(fieldIter);
}
}
if (cloudIter().empty())
{
Info<< "removing cloud " << cloudName << endl;
cloudFields.erase(cloudIter);
}
}
// DEBUGGING
// Info<<"final fields (";
// forAllConstIter(HashTable<word>, volumeFields, fieldIter)
// {
// Info<< " " << fieldIter.key();
// }
//
// Info<< " )\n";
//
// forAllConstIter(HashTable<HashTable<word> >, cloudFields, cloudIter)
// {
// Info<<"final fields for lagrangian/" << cloudIter.key() << " (";
// forAllConstIter(HashTable<word>, cloudIter(), fieldIter)
// {
// Info<< " " << fieldIter.key();
// }
// Info<< " )\n";
// }

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

@ -23,7 +23,8 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Write out the FOAM mesh in Version 3.0 Fieldview-UNS format (binary).
Write out the OpenFOAM mesh in Version 3.0 Fieldview-UNS format (binary).
See Fieldview Release 9 Reference Manual - Appendix D
(Unstructured Data Format)
Borrows various from uns/write_binary_uns.c from FieldView dist.
@ -31,6 +32,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "pointFields.H"
@ -176,20 +178,15 @@ int main(int argc, char *argv[])
{
argList::noParallel();
argList::validOptions.insert("noWall", "");
timeSelector::addOptions(true, false);
# include "addTimeOptions.H"
# include "setRootCase.H"
# include "createTime.H"
instantList Times = runTime.times();
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
instantList timeDirs = timeSelector::select0(runTime, args);
# include "createMesh.H"
// Initialize name mapping table
FieldviewNames.insert("alpha", "aalpha");
FieldviewNames.insert("Alpha", "AAlpha");
@ -285,17 +282,16 @@ int main(int argc, char *argv[])
label fieldViewTime = 0;
for (label i=startTime; i<endTime; i++)
forAll(timeDirs, timeI)
{
runTime.setTime(Times[i], i);
Info<< "Time " << Times[i].name() << endl;
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time: " << runTime.timeName() << endl;
fvMesh::readUpdateState state = mesh.readUpdate();
if
(
i == startTime
timeI == 0
|| state == fvMesh::TOPO_CHANGE
|| state == fvMesh::TOPO_PATCH_CHANGE
)
@ -307,7 +303,7 @@ int main(int argc, char *argv[])
new fieldviewTopology
(
mesh,
!args.options().found("noWall")
!args.optionFound("noWall")
)
);
@ -334,7 +330,7 @@ int main(int argc, char *argv[])
fileName fvFileName
(
fvPath/runTime.caseName() + "_" + Foam::name(i) + ".uns"
fvPath/runTime.caseName() + "_" + Foam::name(timeI) + ".uns"
);
Info<< " file:" << fvFileName.c_str() << endl;
@ -364,7 +360,7 @@ int main(int argc, char *argv[])
// Output constants for time, fsmach, alpha and re.
float fBuf[4];
fBuf[0] = Times[i].value();
fBuf[0] = runTime.value();
fBuf[1] = 0.0;
fBuf[2] = 0.0;
fBuf[3] = 1.0;
@ -892,7 +888,7 @@ int main(int argc, char *argv[])
writeInt(fvParticleFile, fieldViewTime + 1);
// Time value
writeFloat(fvParticleFile, Times[i].value());
writeFloat(fvParticleFile, runTime.value());
// Read particles
Cloud<passiveParticle> parcels(mesh);

View File

@ -5,9 +5,9 @@ HashSet<word> surfVectorHash;
HashSet<word> sprayScalarHash;
HashSet<word> sprayVectorHash;
forAll(Times, timeI)
forAll(timeDirs, timeI)
{
runTime.setTime(Times[timeI], timeI);
runTime.setTime(timeDirs[timeI], timeI);
// Add all fields to hashtable
IOobjectList objects(mesh, runTime.timeName());

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

@ -113,11 +113,9 @@ int Foam::vtkPV3Foam::setTime(int nRequest, const double requestTimes[])
instantList Times = runTime.times();
int nearestIndex = timeIndex_;
for (int requestI = 0; requestI < nRequest; ++requestI)
{
int index = Time::findClosestTimeIndex(Times, requestTimes[requestI]);
if (index >= 0 && index != timeIndex_)
{
nearestIndex = index;
@ -125,7 +123,6 @@ int Foam::vtkPV3Foam::setTime(int nRequest, const double requestTimes[])
}
}
if (nearestIndex < 0)
{
nearestIndex = 0;

View File

@ -8,7 +8,7 @@ int USERD_get_maxsize_info
return Z_ERR;
#ifdef ENSIGHTDEBUG
Info << "Entering: USERD_get_maxsize_info" << endl << flush;
Info << "Entering: USERD_get_maxsize_info" << endl;
#endif
label maxNPoints = 0;
@ -19,9 +19,9 @@ int USERD_get_maxsize_info
label nPyr05Max = 0;
label nTet04Max = 0;
Info << "Checking all time steps for EnSight memory allocation purpose. This can take some time." << endl;
Info<< "Checking all time steps for EnSight memory allocation purpose. This can take some time." << endl;
for (label t=1; t < TimeList.size(); t++)
for (label timeI=1; timeI < timeDirs.size(); ++timeI)
{
label nPen06 = 0;
@ -29,21 +29,21 @@ int USERD_get_maxsize_info
label nPyr05 = 0;
label nTet04 = 0;
runTimePtr->setTime(TimeList[t], t);
runTimePtr->setTime(timeDirs[timeI], timeI);
Info << "Checking time = " << TimeList[t].value() << endl << flush;
Info<< "Checking time = " << runTimePtr->timeName() << endl;
const cellShapeList& cells = meshPtr->cellShapes();
label nPoints = meshPtr->nPoints();
label nCells = cells.size();
const label nPoints = meshPtr->nPoints();
const label nCells = cells.size();
maxNPoints = max(maxNPoints, nPoints);
for (label n=0; n<nCells;n++)
{
label nFaces = cells[n].nFaces();
labelList points = cells[n];
const labelList& points = cells[n];
if ((nFaces == 6) && (points.size() == 8))
{
@ -70,7 +70,6 @@ int USERD_get_maxsize_info
if (Numparts_available > 1)
{
// Get the maximum number of spray parcels
// and store it
Cloud<passiveParticle> lagrangian(*meshPtr);
@ -79,9 +78,7 @@ int USERD_get_maxsize_info
{
nMaxParcels = lagrangian.size();
}
}
}
max_number_of_nodes[0] = maxNPoints;
@ -97,7 +94,7 @@ int USERD_get_maxsize_info
}
#ifdef ENSIGHTDEBUG
Info << "Leaving: USERD_get_maxsize_info" << endl << flush;
Info<< "Leaving: USERD_get_maxsize_info" << endl;
#endif
return Z_OK;

View File

@ -10,18 +10,18 @@ int USERD_get_sol_times
)
{
#ifdef ENSIGHTDEBUG
Info << "Entering: USERD_get_sol_times" << endl << flush;
Info << TimeList << endl;
Info<< "Entering: USERD_get_sol_times\n" << timeDirs << endl;
#endif
for (label n=0; n<Num_time_steps;n++)
{
solution_times[n] = TimeList[n+1].value();
solution_times[n] = timeDirs[n+1].value();
}
if (TimeList[1].value() < 0)
if (timeDirs[1].value() < 0)
{
scalar addCAD = 360.0;
while (TimeList[1].value() + addCAD < 0.0)
while (timeDirs[1].value() + addCAD < 0.0)
{
addCAD += 360.0;
}
@ -29,14 +29,14 @@ int USERD_get_sol_times
{
solution_times[n] += addCAD;
Info << "Time[" << n << "] = " << TimeList[n+1].value()
Info << "Time[" << n << "] = " << timeDirs[n+1].value()
<< " was corrected to " << solution_times[n] << endl;
}
}
#ifdef ENSIGHTDEBUG
Info << "Leaving: USERD_get_sol_times" << endl << flush;
Info<< "Leaving: USERD_get_sol_times" << endl;
#endif
return Z_OK;

View File

@ -4,13 +4,12 @@ int USERD_get_timeset_description
char timeset_description[Z_BUFL]
)
{
#ifdef ENSIGHTDEBUG
Info << "Entering: USERD_get_timeset_description" << endl
<< flush;
Info<< "Entering: USERD_get_timeset_description" << endl;
#endif
if (TimeList[1].value() < 0)
if (timeDirs[1].value() < 0)
{
strncpy(timeset_description, "CAD", Z_BUFL);
}
@ -20,8 +19,7 @@ int USERD_get_timeset_description
}
#ifdef ENSIGHTDEBUG
Info << "Leaving: USERD_get_timeset_description" << endl
<< flush;
Info<< "Leaving: USERD_get_timeset_description" << endl;
#endif
return Z_OK;

View File

@ -79,18 +79,18 @@ int USERD_set_filenames
);
// set the available number of time-steps
TimeList = (const instantList&)Foam::Time::findTimes(rootDir/caseDir);
timeDirs = Foam::Time::findTimes(rootDir/caseDir);
Num_time_steps = TimeList.size() - 1;
Num_time_steps = timeDirs.size() - 1;
nPatches = meshPtr->boundaryMesh().size();
// set the number of fields and store their names
// a valid field must exist for all time-steps
runTime.setTime(TimeList[TimeList.size()-1], TimeList.size()-1);
runTime.setTime(timeDirs[timeDirs.size()-1], timeDirs.size()-1);
IOobjectList objects(*meshPtr, runTime.timeName());
fieldNames = (const wordList&)objects.names();
fieldNames = objects.names();
// because of the spray being a 'field' ...
// get the availabe number of variables and
@ -149,7 +149,7 @@ int USERD_set_filenames
label n = 0;
while (!lagrangianNamesFound && n < Num_time_steps)
{
runTime.setTime(TimeList[n+1], n+1);
runTime.setTime(timeDirs[n+1], n+1);
Cloud<passiveParticle> lagrangian(*meshPtr);
@ -195,7 +195,7 @@ int USERD_set_filenames
}
Current_time_step = Num_time_steps;
runTime.setTime(TimeList[Current_time_step], Current_time_step);
runTime.setTime(timeDirs[Current_time_step], Current_time_step);
Num_variables = nVar + nSprayVariables;
Numparts_available = Num_unstructured_parts + Num_structured_parts + nPatches;

View File

@ -20,18 +20,30 @@ void USERD_set_time_set_and_step
if (time_step == 0)
{
runTime.setTime(TimeList[Current_time_step], Current_time_step);
runTime.setTime
(
timeDirs[Current_time_step],
Current_time_step
);
}
else
{
runTime.setTime(TimeList[Current_time_step + 1], Current_time_step + 1);
runTime.setTime
(
timeDirs[Current_time_step + 1],
Current_time_step + 1
);
}
meshPtr->readUpdate();
if (time_step == 0)
{
runTime.setTime(TimeList[Current_time_step + 1], Current_time_step + 1);
runTime.setTime
(
timeDirs[Current_time_step + 1],
Current_time_step + 1
);
}
if (Numparts_available > nPatches+1)

View File

@ -5,7 +5,6 @@ nVar -= Num_variables - nSprayVariables + lagrangianScalarNames.size();
if (nVar >= 0)
{
word name = lagrangianVectorNames[nVar];
IOField<vector> v
@ -42,7 +41,7 @@ if (nVar >= 0)
}
else
{
//Info << "getLagrangianVector: nVar = " << nVar << endl;
// Info<< "getLagrangianVector: nVar = " << nVar << endl;
return Z_UNDEF;
}

View File

@ -41,7 +41,7 @@ static word pointPrepend = "point_";
static fileName rootDir;
static fileName caseDir;
static instantList TimeList;
static instantList timeDirs;
static List<word> fieldNames;
static List<word> lagrangianScalarNames;

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

@ -12,7 +12,7 @@
IOobject
(
"txx",
Times[i].name(),
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
@ -28,7 +28,7 @@
IOobject
(
"tyy",
Times[i].name(),
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
@ -44,7 +44,7 @@
IOobject
(
"tzz",
Times[i].name(),
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
@ -60,7 +60,7 @@
IOobject
(
"txy",
Times[i].name(),
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE

View File

@ -48,18 +48,13 @@ Description
int main(int argc, char *argv[])
{
argList::noParallel();
# include "addTimeOptions.H"
# include "setRootCase.H"
timeSelector::addOptions();
# include "setRootCase.H"
# include "createTime.H"
// Get times list
instantList Times = runTime.times();
// set startTime and endTime depending on -time and -latestTime options
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
instantList timeDirs = timeSelector::select0(runTime, args);
# include "createMesh.H"
# include "readTransportProperties.H"
@ -83,10 +78,9 @@ int main(int argc, char *argv[])
// For each time step read all fields
for (label i=startTime; i<endTime; i++)
forAll(timeDirs, timeI)
{
runTime.setTime(Times[i], i);
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Collapsing fields for time " << runTime.timeName() << endl;
# include "readFields.H"
@ -96,7 +90,7 @@ int main(int argc, char *argv[])
# include "collapse.H"
}
Info<< "end" << endl;
Info<< "\nEnd" << endl;
return 0;
}

View File

@ -1,7 +1,7 @@
IOobject UMeanHeader
(
"UMean",
runTime.times()[i].name(),
runTime.timeName(),
mesh,
IOobject::MUST_READ
);
@ -23,7 +23,7 @@
IOobject
(
"UPrime2Mean",
runTime.times()[i].name(),
runTime.timeName(),
mesh,
IOobject::MUST_READ
),
@ -39,7 +39,7 @@
IOobject
(
"pPrime2Mean",
runTime.times()[i].name(),
runTime.timeName(),
mesh,
IOobject::MUST_READ
),
@ -52,7 +52,7 @@
IOobject
(
"epsilonMean",
runTime.times()[i].name(),
runTime.timeName(),
mesh,
IOobject::MUST_READ
),
@ -64,7 +64,7 @@
IOobject
(
"nuMean",
runTime.times()[i].name(),
runTime.timeName(),
mesh,
IOobject::MUST_READ
),
@ -76,7 +76,7 @@
IOobject
(
"gammaDotMean",
runTime.times()[i].name(),
runTime.timeName(),
mesh,
IOobject::MUST_READ
),
@ -88,7 +88,7 @@
IOobject
(
"nuPrime",
runTime.times()[i].name(),
runTime.timeName(),
mesh,
IOobject::MUST_READ
),
@ -102,7 +102,7 @@
IOobject
(
"gammaDotPrime",
runTime.times()[i].name(),
runTime.timeName(),
mesh,
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

@ -1,4 +1,4 @@
Info<< nl << "Create databases as time" << endl;
Info << "\nCreate databases as time" << endl;
Time runTimeSource
(

View File

@ -43,31 +43,6 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int getTimeIndex
(
const instantList& times,
const scalar t
)
{
int nearestIndex = -1;
scalar nearestDiff = Foam::GREAT;
forAll(times, timeIndex)
{
if (times[timeIndex].name() == "constant") continue;
scalar diff = fabs(times[timeIndex].value() - t);
if (diff < nearestDiff)
{
nearestDiff = diff;
nearestIndex = timeIndex;
}
}
return nearestIndex;
}
void mapConsistentMesh
(
const fvMesh& meshSource,
@ -254,9 +229,7 @@ wordList addProcessorPatches
int main(int argc, char *argv[])
{
# include "setRoots.H"
# include "createTimes.H"
# include "setTimeIndex.H"
runTimeSource.setTime(sourceTimes[sourceTimeIndex], sourceTimeIndex);
@ -357,7 +330,7 @@ int main(int argc, char *argv[])
}
}
}
else if(!parallelSource && parallelTarget)
else if (!parallelSource && parallelTarget)
{
IOdictionary decompositionDict
(
@ -426,7 +399,7 @@ int main(int argc, char *argv[])
}
}
}
else if(parallelSource && parallelTarget)
else if (parallelSource && parallelTarget)
{
IOdictionary decompositionDictSource
(

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;
}

Some files were not shown because too many files have changed in this diff Show More