109 const entry& mergeEntry,
113 bool changed =
false;
123 const_cast<dictionary&>(thisEntry.
dict()),
135 thisDict.
add(mergeEntry.
clone(thisDict).ptr(),
true);
155 static bool wildCardInMergeDict =
false;
157 bool changed =
false;
165 thisKeysSet.
insert(keys[i]);
173 const keyType& key = mergeIter().keyword();
208 thisDict.
add(mergeIter().clone(thisDict).ptr());
217 if (!literalRE && thisKeysSet.
size() > 0)
223 const keyType& key = mergeIter().keyword();
229 if (!wildCardInMergeDict)
231 wildCardInMergeDict =
true;
233 <<
"Detected wildcard " << key
234 <<
" in changeDictionaryDict" <<
endl
235 <<
"The behaviour of wildcards has changed -"
236 <<
" they are now interpreted by changeDictionary."
237 <<
endl <<
"Please take care or use the -literalRE"
238 <<
" command line option to revert to"
239 <<
" previous behaviour." <<
endl;
246 label matchI = matches[i];
250 thisDict.
lookupEntry(thisKeys[matchI],
false,
false)
277 int main(
int argc,
char *argv[])
291 Info<<
"Not interpreting any regular expressions (RE)"
292 <<
" in the changeDictionaryDict." <<
endl
293 <<
"Instead they are handled as any other entry, i.e. added if"
294 <<
" not present." <<
endl;
304 word instance = runTime.timeName();
315 "changeDictionaryDict",
323 Info<<
"Read dictionary " << dict.name()
324 <<
" with replacements for dictionaries "
332 const word& fieldName = fieldIter().keyword();
333 Info<<
"Replacing entries in dictionary " << fieldName <<
endl;
338 if (fieldName ==
"boundary")
340 Info<<
"Special handling of " << fieldName
341 <<
" as polyMesh/boundary file." <<
endl;
365 const_cast<word&
>(dictList.type()) = dictList.headerClassName();
371 fieldDict.
add(dictList[i].keyword(), dictList[i].dict());
374 Info<<
"Loaded dictionary " << fieldName
375 <<
" with entries " << fieldDict.
toc() <<
endl;
378 const dictionary& replaceDict = fieldIter().dict();
379 Info<<
"Merging entries from " << replaceDict.
toc() <<
endl;
382 merge(fieldDict, replaceDict, literalRE);
384 Info<<
"fieldDict:" << fieldDict <<
endl;
389 label nEntries = fieldDict.
size();
392 doneKeys[i] = dictList[i].keyword();
403 fieldDict.
remove(doneKeys[i]);
406 label sz = dictList.size();
407 dictList.setSize(nEntries);
410 dictList.set(sz, iter().clone());
413 Info<<
"Writing modified fieldDict " << fieldName <<
endl;
420 Info<<
"Loading dictionary " << fieldName <<
endl;
421 const word oldTypeName = IOdictionary::typeName;
436 const_cast<word&
>(IOdictionary::typeName) = oldTypeName;
438 const_cast<word&
>(fieldDict.type()) = fieldDict.headerClassName();
440 Info<<
"Loaded dictionary " << fieldName
441 <<
" with entries " << fieldDict.
toc() <<
endl;
444 const dictionary& replaceDict = fieldIter().dict();
445 Info<<
"Merging entries from " << replaceDict.
toc() <<
endl;
448 merge(fieldDict, replaceDict, literalRE);
450 Info<<
"Writing modified fieldDict " << fieldName <<
endl;
451 fieldDict.regIOobject::write();