ENH: addDictOption: consistent dict option handling

This commit is contained in:
mattijs
2012-12-05 15:10:08 +00:00
parent b2edaba7a1
commit 00f23290c2
4 changed files with 109 additions and 0 deletions

View File

@ -0,0 +1,10 @@
//
// addDictOption.H
// ~~~~~~~~~~~~~~~~~
Foam::argList::addOption
(
"dict",
"file",
"read control dictionary from specified location"
);

View File

@ -0,0 +1,33 @@
//
// setConstantMeshDictionaryIO.H
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fileName dictPath = "";
if (args.optionFound("dict"))
{
dictPath = args["dict"];
if (isDir(dictPath))
{
dictPath = dictPath / dictName;
}
}
IOobject dictIO
(
dictName,
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
);
if (dictPath.size())
{
dictIO = IOobject
(
dictPath,
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
);
}

View File

@ -0,0 +1,33 @@
//
// setSystemMeshDictionaryIO.H
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fileName dictPath = "";
if (args.optionFound("dict"))
{
dictPath = args["dict"];
if (isDir(dictPath))
{
dictPath = dictPath / dictName;
}
}
IOobject dictIO
(
dictName,
runTime.system(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
);
if (dictPath.size())
{
dictIO = IOobject
(
dictPath,
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
);
}

View File

@ -0,0 +1,33 @@
//
// setSystemRunTimeDictionaryIO.H
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fileName dictPath = "";
if (args.optionFound("dict"))
{
dictPath = args["dict"];
if (isDir(dictPath))
{
dictPath = dictPath / dictName;
}
}
IOobject dictIO
(
dictName,
runTime.system(),
runTime,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
);
if (dictPath.size())
{
dictIO = IOobject
(
dictPath,
runTime,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
);
}