changeDictionary: added -dict option

This commit is contained in:
Henry
2011-07-25 15:26:43 +01:00
parent 6980e724d9
commit 2e90deddcc

View File

@ -246,6 +246,12 @@ bool merge
int main(int argc, char *argv[])
{
argList::addOption
(
"dict",
"file",
"specify an alternative to system/changeDictionaryDict"
);
argList::addOption
(
"instance",
@ -268,6 +274,18 @@ int main(int argc, char *argv[])
#include "createTime.H"
#include "createNamedMesh.H"
const word dictName("changeDictionaryDict");
fileName dictPath = dictName;
if (args.optionFound("dict"))
{
dictPath = args["dict"];
if (isDir(dictPath))
{
dictPath = dictPath / dictName;
}
}
const bool literalRE = args.optionFound("literalRE");
if (literalRE)
@ -313,15 +331,26 @@ int main(int argc, char *argv[])
// Get the replacement rules from a dictionary
IOdictionary dict
(
IOobject
(
"changeDictionaryDict",
args.optionFound("dict")
? IOobject
(
dictPath,
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
: IOobject
(
dictName,
runTime.system(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
)
);
const dictionary& replaceDicts = dict.subDict("dictionaryReplacement");
Info<< "Read dictionary " << dict.name()
<< " with replacements for dictionaries "