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[])
|
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")
|
||||||
runTime.system(),
|
? IOobject
|
||||||
mesh,
|
(
|
||||||
IOobject::MUST_READ_IF_MODIFIED,
|
dictPath,
|
||||||
IOobject::NO_WRITE
|
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");
|
const dictionary& replaceDicts = dict.subDict("dictionaryReplacement");
|
||||||
Info<< "Read dictionary " << dict.name()
|
Info<< "Read dictionary " << dict.name()
|
||||||
<< " with replacements for dictionaries "
|
<< " with replacements for dictionaries "
|
||||||
|
|||||||
Reference in New Issue
Block a user