changeDictionary: Simplified by removing the need for the superfluous dictionaryReplacement sub-dictionary

Added the option '-subDict' to specify a sub-dictionary if multiple
replacement sets are present in the same file.  This also provides
backward compatibility by setting '-subDict dictionaryReplacement'
This commit is contained in:
Henry Weller
2016-06-15 09:03:05 +01:00
parent 344f435f54
commit 3d98d6e5c6
25 changed files with 1653 additions and 1711 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -33,8 +33,6 @@ Description
\em Walls a zeroGradient boundary condition, the
\c system/changeDictionaryDict would contain the following:
\verbatim
dictionaryReplacement
{
p // field to change
{
boundaryField
@ -50,23 +48,25 @@ Description
}
}
}
}
\endverbatim
Replacement entries starting with '~' will remove the entry.
Usage
- changeDictionary [OPTION]
changeDictionary [OPTION]
\param -subDict \n
Specify the subDict name of the replacements dictionary.
\param -literalRE \n
Do not interpret regular expressions or patchGroups;
treat them as any other keyword.
Do not interpret regular expressions or patchGroups; treat them as any
other keyword.
\param -enableFunctionEntries \n
By default all dictionary preprocessing of fields is disabled
Enable function entries (default: disabled)
\param -disablePatchGroups \n
By default all keys are also checked for being patchGroups
Disable the default checking for keys being patchGroups
\*---------------------------------------------------------------------------*/
@ -89,7 +89,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Extract groupPatch (= shortcut) info from boundary file info
// Extract groupPatch info from boundary file info
HashTable<wordList, word> extractPatchGroups(const dictionary& boundaryDict)
{
HashTable<wordList, word> groupToPatch;
@ -268,7 +268,6 @@ bool merge
if (entryPtr)
{
// Mark thisDict entry as having been match for wildcard
// handling later on.
thisKeysSet.erase(entryPtr->keyword());
@ -386,6 +385,12 @@ int main(int argc, char *argv[])
{
#include "addDictOption.H"
argList::addOption
(
"subDict",
"name",
"specify the subDict name of the replacements dictionary"
);
argList::addOption
(
"instance",
"name",
@ -479,7 +484,16 @@ int main(int argc, char *argv[])
#include "setSystemMeshDictionaryIO.H"
IOdictionary dict(dictIO);
const dictionary& replaceDicts = dict.subDict("dictionaryReplacement");
const dictionary* replaceDictsPtr = &dict;
if (args.optionFound("subDict"))
{
word subDictName(args.optionLookup("subDict")());
replaceDictsPtr = &dict.subDict(subDictName);
}
const dictionary& replaceDicts = *replaceDictsPtr;
Info<< "Read dictionary " << dict.name()
<< " with replacements for dictionaries "
<< replaceDicts.toc() << endl;
@ -514,6 +528,7 @@ int main(int argc, char *argv[])
)
);
const_cast<word&>(IOPtrList<entry>::typeName) = oldTypeName;
// Fake type back to what was in field
const_cast<word&>(dictList.type()) = dictList.headerClassName();
@ -632,6 +647,7 @@ int main(int argc, char *argv[])
);
const_cast<word&>(IOdictionary::typeName) = oldTypeName;
// Fake type back to what was in field
const_cast<word&>(fieldDict.type()) = fieldDict.headerClassName();
@ -652,9 +668,7 @@ int main(int argc, char *argv[])
entry::disableFunctionEntries = oldFlag;
Info<< endl;
Info<< "End\n" << endl;
Info<< "\nEnd\n" << endl;
return 0;
}

View File

@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
boundary
{
".*"
@ -84,6 +82,5 @@ dictionaryReplacement
}
}
}
// ************************************************************************* //

View File

@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
p
{
boundaryField
@ -460,6 +458,5 @@ dictionaryReplacement
}
}
}
}
// ************************************************************************* //

View File

@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
boundary
{
region0_to_filmRegion_coupledWall
@ -23,7 +21,5 @@ dictionaryReplacement
samplePatch region0_to_pyrolysisRegion_coupledWall;
}
}
}
// ************************************************************************* //

View File

@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
U
{
internalField uniform (0.001 0 0);
@ -167,6 +165,5 @@ dictionaryReplacement
}
}
}
}
// ************************************************************************* //

View File

@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
boundary
{
minY
@ -68,6 +66,5 @@ dictionaryReplacement
}
}
}
}
// ************************************************************************* //

View File

@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
boundary
{
minZ
@ -58,6 +56,5 @@ dictionaryReplacement
}
}
}
}
// ************************************************************************* //

View File

@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
boundary
{
minZ
@ -48,6 +46,5 @@ dictionaryReplacement
}
}
}
}
// ************************************************************************* //

View File

@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
U
{
internalField uniform (0.1 0 0);
@ -165,6 +163,5 @@ dictionaryReplacement
}
}
}
}
// ************************************************************************* //

View File

@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
boundary
{
minX
@ -120,6 +118,5 @@ dictionaryReplacement
}
}
}
}
// ************************************************************************* //

View File

@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
boundary
{
minY
@ -57,6 +55,5 @@ dictionaryReplacement
}
}
}
}
// ************************************************************************* //

View File

@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
boundary
{
minZ
@ -48,6 +46,5 @@ dictionaryReplacement
}
}
}
}
// ************************************************************************* //

View File

@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
boundary
{
minZ
@ -48,6 +46,5 @@ dictionaryReplacement
}
}
}
}
// ************************************************************************* //

View File

@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
U
{
internalField uniform (0.1 0 0);
@ -165,6 +163,5 @@ dictionaryReplacement
}
}
}
}
// ************************************************************************* //

View File

@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
boundary
{
minX
@ -183,7 +181,4 @@ dictionaryReplacement
}
}
}
// ************************************************************************* //

View File

@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
boundary
{
minY
@ -78,6 +76,5 @@ dictionaryReplacement
}
}
}
}
// ************************************************************************* //

View File

@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
boundary
{
minZ
@ -69,6 +67,5 @@ dictionaryReplacement
}
}
}
}
// ************************************************************************* //

View File

@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
boundary
{
minZ
@ -69,6 +67,5 @@ dictionaryReplacement
}
}
}
}
// ************************************************************************* //

View File

@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
U
{
internalField uniform (0.1 0 0);
@ -229,6 +227,5 @@ dictionaryReplacement
}
}
}
}
// ************************************************************************* //

View File

@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
mirrorMeshDict
{
pointAndNormalDict
@ -24,5 +22,5 @@ dictionaryReplacement
normalVector (0 -1 0);
}
}
}
// ************************************************************************* //

View File

@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
mirrorMeshDict
{
pointAndNormalDict
@ -24,5 +22,5 @@ dictionaryReplacement
normalVector (-1 0 0);
}
}
}
// ************************************************************************* //

View File

@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
mirrorMeshDict
{
pointAndNormalDict
@ -24,5 +22,5 @@ dictionaryReplacement
normalVector (0 -1 0);
}
}
}
// ************************************************************************* //

View File

@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
T
{
boundaryField
@ -67,6 +65,5 @@ dictionaryReplacement
}
}
}
}
// ************************************************************************* //

View File

@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
alphat
{
boundaryField
@ -192,6 +190,5 @@ dictionaryReplacement
}
}
}
}
// ************************************************************************* //

View File

@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
p_rgh
{
boundaryField
@ -42,6 +40,5 @@ dictionaryReplacement
}
}
}
}
// ************************************************************************* //