foamDictionary: Added support for manipulating lists of dictionaries

- provides support for manipulating polyMesh/boundary

  - changed behaviour of disableFunctionEntries option to preserve
    #include

  - dictionary: added reading of lists of dictionaries.
    + each list element may be accessed using the 'entryDDD' keyword
      according to their list index.

Patch contributed by Mattijs Janssens
This commit is contained in:
Henry Weller
2016-11-25 20:33:03 +00:00
parent 81de1dc9ac
commit 1d1f71f7cd
9 changed files with 498 additions and 32 deletions

View File

@ -57,6 +57,9 @@ Usage
- \par -includes
List the \c #include and \c #includeIfPresent files to standard output
- \par -disableFunctionEntries
Do not expand macros or directives (#include etc)
Example usage:
- Change simulation to run for one timestep only:
\verbatim
@ -97,6 +100,15 @@ Usage
-entry boundaryField
\endverbatim
- Change patch type:
\verbatim
foamDictionary constant/polyMesh/boundary \
-entry entry0.fixedWalls.type -set patch
\endverbatim
This uses special parsing of Lists which stores these in the
dictionary with keyword 'entryDDD' where DDD is the position
in the dictionary (after ignoring the FoamFile entry).
\*---------------------------------------------------------------------------*/
#include "argList.H"
@ -271,6 +283,11 @@ int main(int argc, char *argv[])
"Read the specified dictionary file, expand the macros etc. and write "
"the resulting dictionary to standard output"
);
argList::addBoolOption
(
"disableFunctionEntries",
"Disable expansion of dictionary directives - #include, #codeStream etc"
);
argList args(argc, argv);
@ -281,6 +298,15 @@ int main(int argc, char *argv[])
Foam::functionEntries::includeEntry::log = true;
}
const bool disableEntries = args.optionFound("disableFunctionEntries");
if (disableEntries)
{
Info<< "Not expanding variables or dictionary directives"
<< endl;
entry::disableFunctionEntries = true;
}
fileName dictFileName(args[1]);
autoPtr<IFstream> dictFile(new IFstream(dictFileName));