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