From 2e90deddcc38d385c6c44ec3a7f8a6487b7767aa Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 25 Jul 2011 15:26:43 +0100 Subject: [PATCH] changeDictionary: added -dict option --- .../changeDictionary/changeDictionary.C | 41 ++++++++++++++++--- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C index 9dd677a61a..6ca7be44ef 100644 --- a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C +++ b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C @@ -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 "