Commit d848d774 authored by mattijs's avatar mattijs
Browse files

ENH: changeDictionary: allow removal of patches (!). Fixes #1179.

parent c88c39c0
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -628,29 +628,31 @@ int main(int argc, char *argv[])
wordList doneKeys(dictList.size());
label nEntries = fieldDict.size();
nEntries = 0;
forAll(dictList, i)
{
doneKeys[i] = dictList[i].keyword();
dictList.set
(
i,
fieldDict.lookupEntry
const entry* ePtr = fieldDict.findEntry
(
doneKeys[i],
keyType::REGEX
).clone()
);
// Check that it hasn't been removed from fieldDict
if (ePtr)
{
dictList.set(nEntries++, ePtr->clone());
fieldDict.remove(doneKeys[i]);
}
}
// Add remaining entries
label sz = dictList.size();
dictList.setSize(nEntries);
for (const entry& e : fieldDict)
{
dictList.set(sz++, e.clone());
dictList.set(nEntries++, e.clone());
}
dictList.setSize(nEntries);
Info<< "Writing modified " << fieldName << endl;
dictList.writeObject
......
Markdown is supported
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