mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: changeDictionary: allow removal of patches (!). Fixes #1179.
This commit is contained in:
@ -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
|
||||
|
||||
const entry* ePtr = fieldDict.findEntry
|
||||
(
|
||||
i,
|
||||
fieldDict.lookupEntry
|
||||
(
|
||||
doneKeys[i],
|
||||
keyType::REGEX
|
||||
).clone()
|
||||
doneKeys[i],
|
||||
keyType::REGEX
|
||||
);
|
||||
fieldDict.remove(doneKeys[i]);
|
||||
// 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
|
||||
|
||||
Reference in New Issue
Block a user