Skip to content
Snippets Groups Projects
Commit dedc7ebf authored by mattijs's avatar mattijs
Browse files

ENH: changeDictionary: use -dict handling

parent 2e046d32
No related merge requests found
......@@ -51,12 +51,7 @@ int main(int argc, char *argv[])
"keywords",
"report keywords for the specified dictionary"
);
argList::addOption
(
"dict",
"file",
"specify a dictionary to interrogate"
);
#include "addDictOption.H"
argList::addOption
(
"entry",
......@@ -81,9 +76,12 @@ int main(int argc, char *argv[])
if (args.optionFound("dict"))
{
fileName dictPath = args["dict"];
const fileName dictFileName
(
args.rootPath()/args.caseName()/args["dict"]
dictPath.isAbsolute()
? dictPath
: args.rootPath()/args.caseName()/args["dict"]
);
IFstream dictFile(dictFileName);
......
......@@ -385,12 +385,7 @@ bool merge
int main(int argc, char *argv[])
{
argList::addOption
(
"dict",
"file",
"specify an alternative to system/changeDictionaryDict"
);
#include "addDictOption.H"
argList::addOption
(
"instance",
......@@ -432,21 +427,8 @@ int main(int argc, char *argv[])
runTime.setTime(times[0], 0);
word instance = args.optionLookupOrDefault("instance", runTime.timeName());
#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)
{
......@@ -493,27 +475,10 @@ int main(int argc, char *argv[])
// Get the replacement rules from a dictionary
IOdictionary dict
(
(
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 word dictName("changeDictionaryDict");
#include "setSystemMeshDictionaryIO.H"
IOdictionary dict(dictIO);
const dictionary& replaceDicts = dict.subDict("dictionaryReplacement");
Info<< "Read dictionary " << dict.name()
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment