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

View File

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

View File

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

View File

@ -29,6 +29,8 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "OSspecific.H" #include "OSspecific.H"
#include "argList.H"
#include "wordReList.H"
#include "IOstreams.H" #include "IOstreams.H"
#include "IStringStream.H" #include "IStringStream.H"
@ -38,11 +40,21 @@ Description
using namespace Foam; using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program: // Main program:
int main(int argc, char *argv[]) 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))")()); List<vector> list1(IStringStream("1 ((0 1 2))")());
Info<< "list1: " << list1 << endl; Info<< "list1: " << list1 << endl;
@ -69,6 +81,43 @@ int main(int argc, char *argv[])
Info<< "Elements " << map << " out of " << list3 Info<< "Elements " << map << " out of " << list3
<< " => " << subList3 << endl; << " => " << 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; 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 minLen(readScalar(IStringStream(args.additionalArgs()[0])()));
scalar angle(readScalar(IStringStream(args.additionalArgs()[1])())); scalar angle(readScalar(IStringStream(args.additionalArgs()[1])()));
bool overwrite = args.options().found("overwrite"); bool overwrite = args.optionFound("overwrite");
scalar maxCos = Foam::cos(angle*180/mathematicalConstant::pi); scalar maxCos = Foam::cos(angle*180/mathematicalConstant::pi);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -59,11 +59,10 @@ int main(int argc, char *argv[])
pointField zeroPoints(mesh.points()); pointField zeroPoints(mesh.points());
runTime.setTime(Times[0], 0); // skip "constant" time
for (label timeI = 1; timeI < Times.size(); ++timeI)
for (int i = 1; i<Times.size(); i++)
{ {
runTime.setTime(Times[i], i); runTime.setTime(Times[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl; Info<< "Time = " << runTime.timeName() << endl;

View File

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

View File

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

View File

@ -386,8 +386,7 @@ int main(int argc, char *argv[])
# include "createMesh.H" # include "createMesh.H"
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();
const bool blockOrder = args.options().found("blockOrder"); const bool blockOrder = args.optionFound("blockOrder");
if (blockOrder) if (blockOrder)
{ {
Info<< "Ordering cells into regions (using decomposition);" Info<< "Ordering cells into regions (using decomposition);"
@ -395,15 +394,14 @@ int main(int argc, char *argv[])
<< endl; << endl;
} }
const bool orderPoints = args.options().found("orderPoints"); const bool orderPoints = args.optionFound("orderPoints");
if (orderPoints) if (orderPoints)
{ {
Info<< "Ordering points into internal and boundary points." << nl Info<< "Ordering points into internal and boundary points." << nl
<< endl; << endl;
} }
const bool writeMaps = args.options().found("writeMaps"); const bool writeMaps = args.optionFound("writeMaps");
if (writeMaps) if (writeMaps)
{ {
@ -411,7 +409,7 @@ int main(int argc, char *argv[])
<< endl; << endl;
} }
bool overwrite = args.options().found("overwrite"); bool overwrite = args.optionFound("overwrite");
label band = getBand(mesh.faceOwner(), mesh.faceNeighbour()); label band = getBand(mesh.faceOwner(), mesh.faceNeighbour());

View File

@ -591,24 +591,10 @@ commandStatus parseType
} }
else if (setType == "time") else if (setType == "time")
{ {
scalar time = readScalar(is); scalar requestedTime = readScalar(is);
instantList Times = runTime.times(); instantList Times = runTime.times();
int nearestIndex = -1; label nearestIndex = Time::findClosestTimeIndex(Times, requestedTime);
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;
}
}
Pout<< "Changing time from " << runTime.timeName() Pout<< "Changing time from " << runTime.timeName()
<< " to " << Times[nearestIndex].name() << " to " << Times[nearestIndex].name()
@ -646,7 +632,8 @@ commandStatus parseType
} }
default: default:
{ {
FatalErrorIn("parseType") << "Illegal mesh update state " FatalErrorIn("parseType")
<< "Illegal mesh update state "
<< stat << abort(FatalError); << stat << abort(FatalError);
break; break;
} }
@ -723,7 +710,7 @@ int main(int argc, char *argv[])
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
bool writeVTK = !args.options().found("noVTK"); bool writeVTK = !args.optionFound("noVTK");
// Get times list // Get times list
instantList Times = runTime.times(); instantList Times = runTime.times();
@ -740,13 +727,13 @@ int main(int argc, char *argv[])
std::ifstream* fileStreamPtr(NULL); std::ifstream* fileStreamPtr(NULL);
if (args.options().found("batch")) if (args.optionFound("batch"))
{ {
fileName batchFile(args.options()["batch"]); fileName batchFile(args.option("batch"));
Pout<< "Reading commands from file " << batchFile << endl; Pout<< "Reading commands from file " << batchFile << endl;
// we also cannot handle .gz files // we cannot handle .gz files
if (!isFile(batchFile, false)) if (!isFile(batchFile, false))
{ {
FatalErrorIn(args.executable()) FatalErrorIn(args.executable())
@ -864,7 +851,7 @@ int main(int argc, char *argv[])
delete fileStreamPtr; delete fileStreamPtr;
} }
Pout << nl << "End" << endl; Pout<< "\nEnd" << endl;
return 0; return 0;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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") if (fieldName.size() > 2 && fieldName(fieldName.size() - 2, 2) == "_0")
{ {
variableGood = false; variableGood = false;
break;
} }
else
IOobject fieldObjectHeader {
variableGood = IOobject
( (
fieldName, fieldName,
Times[n1].name(), Times[n1].name(),
mesh, mesh,
IOobject::NO_READ IOobject::NO_READ
); ).headerOk();
}
variableGood = variableGood && fieldObjectHeader.headerOk();
} }

View File

@ -1,18 +1,18 @@
bool meshMoving = true; // check for "points" in all of the result directories
bool meshMoving = true;
if (Times.size() > 2) if (Times.size() > 2)
{ {
for(label n2=2; n2<Times.size(); n2++) for (label n1=2; n1<Times.size() && meshMoving; ++n1)
{ {
IOobject tmpPoints meshMoving = IOobject
( (
"points", "points",
Times[n2].name(), Times[n1].name(),
polyMesh::meshSubDir, polyMesh::meshSubDir,
mesh, mesh,
IOobject::NO_READ IOobject::NO_READ
); ).headerOk();
meshMoving = meshMoving && tmpPoints.headerOk();
} }
} }
else 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 bool writePatchField
( (
const Foam::Field<Type>& pf, const Foam::Field<Type>& pf,
const Foam::label patchi, const Foam::label patchI,
const Foam::label ensightPatchi, const Foam::label ensightPatchI,
const Foam::faceSets& boundaryFaceSet, const Foam::faceSets& boundaryFaceSet,
const Foam::ensightMesh::nFacePrimitives& nfp, const Foam::ensightMesh::nFacePrimitives& nfp,
const Foam::labelList& patchProcessors, const Foam::labelList& patchProcessors,
@ -289,7 +289,7 @@ bool writePatchField
{ {
ensightFile ensightFile
<< "part" << nl << "part" << nl
<< setw(10) << ensightPatchi << nl; << setw(10) << ensightPatchI << nl;
} }
writeAllFaceData writeAllFaceData
@ -335,8 +335,8 @@ template<class Type>
bool writePatchFieldBinary bool writePatchFieldBinary
( (
const Foam::Field<Type>& pf, const Foam::Field<Type>& pf,
const Foam::label patchi, const Foam::label patchI,
const Foam::label ensightPatchi, const Foam::label ensightPatchI,
const Foam::faceSets& boundaryFaceSet, const Foam::faceSets& boundaryFaceSet,
const Foam::ensightMesh::nFacePrimitives& nfp, const Foam::ensightMesh::nFacePrimitives& nfp,
const Foam::labelList& patchProcessors, const Foam::labelList& patchProcessors,
@ -348,7 +348,7 @@ bool writePatchFieldBinary
if (Pstream::master()) if (Pstream::master())
{ {
writeEnsDataBinary("part",ensightFile); writeEnsDataBinary("part",ensightFile);
writeEnsDataBinary(ensightPatchi,ensightFile); writeEnsDataBinary(ensightPatchI,ensightFile);
} }
writeAllFaceDataBinary writeAllFaceDataBinary
@ -411,14 +411,14 @@ void writePatchField
const HashTable<ensightMesh::nFacePrimitives>& const HashTable<ensightMesh::nFacePrimitives>&
nPatchPrims = eMesh.nPatchPrims(); nPatchPrims = eMesh.nPatchPrims();
label patchi = -1; label patchI = -1;
if (patchIndices.found(patchName)) if (patchIndices.found(patchName))
{ {
patchi = patchIndices.find(patchName)(); patchI = patchIndices.find(patchName)();
} }
label ensightPatchi = 2; label ensightPatchI = eMesh.patchPartOffset();
for for
( (
@ -429,7 +429,7 @@ void writePatchField
) )
{ {
if (iter.key() == patchName) break; if (iter.key() == patchName) break;
ensightPatchi++; ensightPatchI++;
} }
@ -472,14 +472,14 @@ void writePatchField
ensightFile << pTraits<Type>::typeName << nl; ensightFile << pTraits<Type>::typeName << nl;
} }
if (patchi >= 0) if (patchI >= 0)
{ {
writePatchField writePatchField
( (
pf, pf,
patchi, patchI,
ensightPatchi, ensightPatchI,
boundaryFaceSets[patchi], boundaryFaceSets[patchI],
nPatchPrims.find(patchName)(), nPatchPrims.find(patchName)(),
patchProcessors, patchProcessors,
ensightFile ensightFile
@ -493,7 +493,7 @@ void writePatchField
( (
Field<Type>(), Field<Type>(),
-1, -1,
ensightPatchi, ensightPatchI,
nullFaceSets, nullFaceSets,
nPatchPrims.find(patchName)(), nPatchPrims.find(patchName)(),
patchProcessors, patchProcessors,
@ -621,7 +621,7 @@ void ensightFieldAscii
writeAllData("nfaced", vf, polys, meshCellSets.nPolys, ensightFile); writeAllData("nfaced", vf, polys, meshCellSets.nPolys, ensightFile);
} }
label ensightPatchi = 2; label ensightPatchI = eMesh.patchPartOffset();
for for
( (
@ -637,23 +637,23 @@ void ensightFieldAscii
{ {
if (patchIndices.found(patchName)) if (patchIndices.found(patchName))
{ {
label patchi = patchIndices.find(patchName)(); label patchI = patchIndices.find(patchName)();
if if
( (
writePatchField writePatchField
( (
vf.boundaryField()[patchi], vf.boundaryField()[patchI],
patchi, patchI,
ensightPatchi, ensightPatchI,
boundaryFaceSets[patchi], boundaryFaceSets[patchI],
nPatchPrims.find(patchName)(), nPatchPrims.find(patchName)(),
patchProcessors, patchProcessors,
ensightFile ensightFile
) )
) )
{ {
ensightPatchi++; ensightPatchI++;
} }
} }
@ -667,7 +667,7 @@ void ensightFieldAscii
( (
Field<Type>(), Field<Type>(),
-1, -1,
ensightPatchi, ensightPatchI,
nullFaceSet, nullFaceSet,
nPatchPrims.find(patchName)(), nPatchPrims.find(patchName)(),
patchProcessors, patchProcessors,
@ -675,7 +675,7 @@ void ensightFieldAscii
) )
) )
{ {
ensightPatchi++; ensightPatchI++;
} }
} }
} }
@ -793,7 +793,7 @@ void ensightFieldBinary
writeAllDataBinary("nfaced", vf, polys, meshCellSets.nPolys, ensightFile); writeAllDataBinary("nfaced", vf, polys, meshCellSets.nPolys, ensightFile);
} }
label ensightPatchi = 2; label ensightPatchI = eMesh.patchPartOffset();
for for
( (
@ -809,23 +809,23 @@ void ensightFieldBinary
{ {
if (patchIndices.found(patchName)) if (patchIndices.found(patchName))
{ {
label patchi = patchIndices.find(patchName)(); label patchI = patchIndices.find(patchName)();
if if
( (
writePatchFieldBinary writePatchFieldBinary
( (
vf.boundaryField()[patchi], vf.boundaryField()[patchI],
patchi, patchI,
ensightPatchi, ensightPatchI,
boundaryFaceSets[patchi], boundaryFaceSets[patchI],
nPatchPrims.find(patchName)(), nPatchPrims.find(patchName)(),
patchProcessors, patchProcessors,
ensightFile ensightFile
) )
) )
{ {
ensightPatchi++; ensightPatchI++;
} }
} }
@ -839,7 +839,7 @@ void ensightFieldBinary
( (
Field<Type>(), Field<Type>(),
-1, -1,
ensightPatchi, ensightPatchI,
nullFaceSet, nullFaceSet,
nPatchPrims.find(patchName)(), nPatchPrims.find(patchName)(),
patchProcessors, patchProcessors,
@ -847,7 +847,7 @@ void ensightFieldBinary
) )
) )
{ {
ensightPatchi++; ensightPatchI++;
} }
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -1,40 +1,40 @@
// check the final time directory for // check the final time directory for the following:
// 1. volume fields // 1. volume fields
HashTable<word> volumeFields; HashTable<word> volumeFields;
// 2. the fields for each cloud: // 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()); IOobjectList objs(mesh, timeDirs[timeDirs.size()-1].name());
forAllConstIter(IOobjectList, objs, fieldIter) forAllConstIter(IOobjectList, objs, fieldIter)
{ {
const IOobject& obj = *fieldIter(); const IOobject& obj = *fieldIter();
const word& fieldName = obj.name();
const word& fieldType = obj.headerClassName();
if if (fieldName.size() > 2 && fieldName(fieldName.size()-2, 2) == "_0")
(
obj.headerClassName() == volScalarField::typeName
|| obj.headerClassName() == volVectorField::typeName
)
{ {
// Add field and field type // ignore _0 fields
volumeFields.insert }
( else if (volFieldTypes.found(fieldType))
obj.name(), {
obj.headerClassName() // 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 fileNameList cloudDirs = readDir
( (
runTime.path() runTime.path()
/ timeDirs[timeDirs.size() - 1].name() / timeDirs[timeDirs.size()-1].name()
/ regionPrefix / regionPrefix
/ cloud::prefix, / cloud::prefix,
fileName::DIRECTORY fileName::DIRECTORY
@ -47,42 +47,59 @@ if (timeDirs.size() > 1)
// Create a new hash table for each cloud // Create a new hash table for each cloud
cloudFields.insert(cloudName, HashTable<word>()); 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 = HashTable<HashTable<word> >::iterator cloudIter =
cloudFields.find(cloudName); cloudFields.find(cloudName);
IOobjectList cloudObjs IOobjectList objs
( (
mesh, mesh,
timeDirs[timeDirs.size() - 1].name(), timeDirs[timeDirs.size()-1].name(),
cloud::prefix/cloudName cloud::prefix/cloudName
); );
bool hasPositions = false; bool hasPositions = false;
forAllConstIter(IOobjectList, cloudObjs, fieldIter) forAllConstIter(IOobjectList, objs, fieldIter)
{ {
const IOobject obj = *fieldIter(); const IOobject obj = *fieldIter();
const word& fieldName = obj.name();
const word& fieldType = obj.headerClassName();
if (obj.name() == "positions") if (fieldName == "positions")
{ {
hasPositions = true; hasPositions = true;
} }
else else if (cloudFieldTypes.found(fieldType))
{ {
// Add field and field type // simply ignore types that we don't handle
cloudIter().insert cloudIter().insert(fieldName, fieldType);
(
obj.name(),
obj.headerClassName()
);
} }
} }
// drop this cloud if it has no positions // drop this cloud if it has no positions or is otherwise empty
if (!hasPositions) if (!hasPositions || cloudIter().empty())
{ {
Info<< "removing cloud " << cloudName << endl;
cloudFields.erase(cloudIter); 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("index", "start");
argList::validOptions.insert("noMesh", ""); argList::validOptions.insert("noMesh", "");
const word volFieldTypes[] = // the volume field types that we handle
{ wordHashSet volFieldTypes;
volScalarField::typeName, volFieldTypes.insert(volScalarField::typeName);
volVectorField::typeName, volFieldTypes.insert(volVectorField::typeName);
volSphericalTensorField::typeName, volFieldTypes.insert(volSphericalTensorField::typeName);
volSymmTensorField::typeName, volFieldTypes.insert(volSymmTensorField::typeName);
volTensorField::typeName, volFieldTypes.insert(volTensorField::typeName);
word::null
};
const word sprayFieldTypes[] = // the lagrangian field types that we handle
{ wordHashSet cloudFieldTypes;
scalarIOField::typeName, cloudFieldTypes.insert(scalarIOField::typeName);
vectorIOField::typeName, cloudFieldTypes.insert(vectorIOField::typeName);
tensorIOField::typeName, cloudFieldTypes.insert(tensorIOField::typeName);
word::null
};
const char* geometryName = "geometry"; const char* geometryName = "geometry";
@ -111,7 +107,7 @@ int main(int argc, char *argv[])
// default to binary output, unless otherwise specified // default to binary output, unless otherwise specified
IOstream::streamFormat format = IOstream::BINARY; IOstream::streamFormat format = IOstream::BINARY;
if (args.options().found("ascii")) if (args.optionFound("ascii"))
{ {
format = IOstream::ASCII; format = IOstream::ASCII;
} }
@ -119,14 +115,14 @@ int main(int argc, char *argv[])
// control for renumbering iterations // control for renumbering iterations
bool optIndex = false; bool optIndex = false;
label indexingNumber = 0; label indexingNumber = 0;
if (args.options().found("index")) if (args.optionFound("index"))
{ {
optIndex = true; optIndex = true;
indexingNumber = readLabel(IStringStream(args.options()["index"])()); indexingNumber = args.optionRead<label>("index");
} }
// always write the geometry, unless the -noMesh option is specified // always write the geometry, unless the -noMesh option is specified
bool optNoMesh = args.options().found("noMesh"); bool optNoMesh = args.optionFound("noMesh");
fileName ensightDir = args.rootPath()/args.globalCaseName()/"Ensight"; fileName ensightDir = args.rootPath()/args.globalCaseName()/"Ensight";
fileName dataDir = ensightDir/"data"; fileName dataDir = ensightDir/"data";
@ -168,7 +164,6 @@ int main(int argc, char *argv[])
# include "checkHasMovingMesh.H" # include "checkHasMovingMesh.H"
# include "findFields.H" # include "findFields.H"
# include "validateFields.H"
if (hasMovingMesh && optNoMesh) if (hasMovingMesh && optNoMesh)
{ {

View File

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

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

View File

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

View File

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

View File

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

View File

@ -8,7 +8,7 @@ int USERD_get_maxsize_info
return Z_ERR; return Z_ERR;
#ifdef ENSIGHTDEBUG #ifdef ENSIGHTDEBUG
Info << "Entering: USERD_get_maxsize_info" << endl << flush; Info << "Entering: USERD_get_maxsize_info" << endl;
#endif #endif
label maxNPoints = 0; label maxNPoints = 0;
@ -19,9 +19,9 @@ int USERD_get_maxsize_info
label nPyr05Max = 0; label nPyr05Max = 0;
label nTet04Max = 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; label nPen06 = 0;
@ -29,21 +29,21 @@ int USERD_get_maxsize_info
label nPyr05 = 0; label nPyr05 = 0;
label nTet04 = 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(); const cellShapeList& cells = meshPtr->cellShapes();
label nPoints = meshPtr->nPoints(); const label nPoints = meshPtr->nPoints();
label nCells = cells.size(); const label nCells = cells.size();
maxNPoints = max(maxNPoints, nPoints); maxNPoints = max(maxNPoints, nPoints);
for (label n=0; n<nCells;n++) for (label n=0; n<nCells;n++)
{ {
label nFaces = cells[n].nFaces(); label nFaces = cells[n].nFaces();
labelList points = cells[n]; const labelList& points = cells[n];
if ((nFaces == 6) && (points.size() == 8)) if ((nFaces == 6) && (points.size() == 8))
{ {
@ -70,7 +70,6 @@ int USERD_get_maxsize_info
if (Numparts_available > 1) if (Numparts_available > 1)
{ {
// Get the maximum number of spray parcels // Get the maximum number of spray parcels
// and store it // and store it
Cloud<passiveParticle> lagrangian(*meshPtr); Cloud<passiveParticle> lagrangian(*meshPtr);
@ -79,9 +78,7 @@ int USERD_get_maxsize_info
{ {
nMaxParcels = lagrangian.size(); nMaxParcels = lagrangian.size();
} }
} }
} }
max_number_of_nodes[0] = maxNPoints; max_number_of_nodes[0] = maxNPoints;
@ -97,7 +94,7 @@ int USERD_get_maxsize_info
} }
#ifdef ENSIGHTDEBUG #ifdef ENSIGHTDEBUG
Info << "Leaving: USERD_get_maxsize_info" << endl << flush; Info<< "Leaving: USERD_get_maxsize_info" << endl;
#endif #endif
return Z_OK; return Z_OK;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
Info<< nl << "Create databases as time" << endl; Info << "\nCreate databases as time" << endl;
Time runTimeSource 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 void mapConsistentMesh
( (
const fvMesh& meshSource, const fvMesh& meshSource,
@ -254,9 +229,7 @@ wordList addProcessorPatches
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
# include "setRoots.H" # include "setRoots.H"
# include "createTimes.H" # include "createTimes.H"
# include "setTimeIndex.H" # include "setTimeIndex.H"
runTimeSource.setTime(sourceTimes[sourceTimeIndex], sourceTimeIndex); 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 IOdictionary decompositionDict
( (
@ -426,7 +399,7 @@ int main(int argc, char *argv[])
} }
} }
} }
else if(parallelSource && parallelTarget) else if (parallelSource && parallelTarget)
{ {
IOdictionary decompositionDictSource IOdictionary decompositionDictSource
( (

View File

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

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