104 const word& patchName = iter().keyword();
116 if (fndGroup == groupToPatch.
end())
122 fndGroup().append(patchName);
131 int main(
int argc,
char *argv[])
138 "specify the subDict name of the replacements dictionary"
144 "override instance setting (default is the time name)"
153 "treat regular expressions literally (i.e., as a keyword)"
157 "enableFunctionEntries",
158 "enable expansion of dictionary directives - #include, #codeStream etc"
162 "disablePatchGroups",
163 "disable matching keys to patch groups"
173 <<
"changeDictionary has been superseded by foamDictionary"
174 " and is now deprecated."
181 if (times.
size() < 1)
191 if (times.
size() > 1)
194 <<
"Multiple times selected with 'instance' option"
202 runTime.setTime(times[timei], timei);
203 instance = runTime.name();
211 Info<<
"Not interpreting any regular expressions (RE)"
212 <<
" in the changeDictionaryDict." <<
endl
213 <<
"Instead they are handled as any other entry, i.e. added if"
214 <<
" not present." <<
endl;
220 Info<<
"Allowing dictionary preprocessing "
221 "('#include', '#codeStream')."
233 const bool disablePatchGroups =
args.
optionFound(
"disablePatchGroups");
234 if (disablePatchGroups)
236 Info<<
"Not interpreting any keys in the changeDictionary"
265 const dictionary& replaceDicts = *replaceDictsPtr;
268 <<
" with replacements for dictionaries "
276 Info<<
"Reading polyMesh/boundary file to extract patch names"
303 const_cast<word&
>(dictList.type()) = dictList.headerClassName();
309 fieldDict.
add(dictList[i].keyword(), dictList[i].
dict());
314 Info<<
"Loaded dictionary " << dictList.name()
315 <<
" with entries " << fieldDict.
toc() <<
endl;
321 if (!disablePatchGroups)
323 patchGroups = extractPatchGroups(fieldDict);
324 if (patchGroups.
size())
326 Info<<
"Extracted patch groups:" <<
endl;
330 Info<<
" group " << groups[i] <<
" with patches "
331 << patchGroups[groups[i]] <<
endl;
341 const word& fieldName = fieldIter().keyword();
342 Info<<
"Replacing entries in dictionary " << fieldName <<
endl;
347 if (fieldName ==
"boundary")
349 Info<<
"Special handling of " << fieldName
350 <<
" as polyMesh/boundary file." <<
endl;
353 const dictionary& replaceDict = fieldIter().dict();
354 Info<<
"Merging entries from " << replaceDict.
toc() <<
endl;
365 Info<<
"fieldDict:" << fieldDict <<
endl;
370 label nEntries = fieldDict.size();
374 doneKeys[i] = dictList[i].keyword();
385 fieldDict.
remove(doneKeys[i]);
389 label sz = dictList.size();
390 dictList.setSize(nEntries);
393 dictList.set(sz++, iter().
clone());
396 Info<<
"Writing modified " << fieldName <<
endl;
399 runTime.writeFormat(),
400 runTime.writeFormat(),
409 Info<<
"Loading dictionary " << fieldName <<
endl;
410 const word oldTypeName = localIOdictionary::typeName;
426 const_cast<word&
>(localIOdictionary::typeName) = oldTypeName;
429 const_cast<word&
>(fieldDict.type()) =
430 fieldDict.headerClassName();
432 Info<<
"Loaded dictionary " << fieldName
433 <<
" with entries " << fieldDict.
toc() <<
endl;
436 const dictionary& replaceDict = fieldIter().dict();
437 Info<<
"Merging entries from " << replaceDict.
toc() <<
endl;
448 Info<<
"Writing modified fieldDict " << fieldName <<
endl;
449 fieldDict.regIOobject::write();
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
An STL-conforming iterator.
An STL-conforming hash table.
List< Key > sortedToc() const
Return the table of contents as a sorted list.
label size() const
Return number of elements in table.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
A PtrList of objects of type <Type> with automated input and output.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
static fileCheckTypes fileModificationChecking
Type of file modification checking.
void size(const label)
Override size to be inconsistent with allocated storage.
static void addOption(const word &opt, const string ¶m="", const string &usage="")
Add to an option to validOptions with usage information.
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
bool optionFound(const word &opt) const
Return true if the named option is found.
IStringStream optionLookup(const word &opt) const
Return an IStringStream from the named option.
const fileName & name() const
Return the dictionary name.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
const entry & lookupEntry(const word &, bool recursive, bool patternMatch) const
Find and return an entry data stream if present otherwise error.
bool remove(const word &)
Remove an entry specified by keyword.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
wordList toc() const
Return the table of contents.
virtual autoPtr< entry > clone(const dictionary &parentDict) const =0
Construct on freestore as copy with reference to the.
static int disableFunctionEntries
A class for handling file names.
localIOdictionary derived from IOdictionary with global set false to disable parallel master reading.
static word defaultRegion
Return the default region name.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
static void addOptions(const bool constant=true, const bool withZero=false)
Add the options handled by timeSelector to argList::validOptions.
static instantList selectIfPresent(Time &runTime, const argList &args)
If any time option provided return the set of times (as select0)
A class for handling words, derived from string.
static const word null
An empty word.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
int main(int argc, char *argv[])
Function with which to merge one dictionary into another. Intended for user-facing dictionary merging...
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< word > wordList
A List of words.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const word & regionName(const solver ®ion)
defineTemplateTypeNameAndDebug(prghPressure, 0)
IOdictionary systemDict(const word &dictName, const argList &args, const objectRegistry &ob, const word ®ionName=polyMesh::defaultRegion, const fileName &path=fileName::null)
bool mergeDictionaries(dictionary &tgtDict, const dictionary &srcDict, const bool wildcards=true, const HashTable< wordList, word > &shortcuts=HashTable< wordList, word >(0))
Foam::argList args(argc, argv)
Operations on lists of strings.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable