mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
changeDictionary: added -dict option
This commit is contained in:
@ -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",
|
||||
runTime.system(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
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 "
|
||||
|
||||
Reference in New Issue
Block a user