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

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -24,6 +24,8 @@ License
\*---------------------------------------------------------------------------*/
#include "functionEntry.H"
#include "IOstreams.H"
#include "ISstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -45,6 +47,34 @@ namespace Foam
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::token Foam::functionEntry::readLine(const word& key, Istream& is)
{
string s;
dynamic_cast<ISstream&>(is).getLine(s);
return token(string(key+s), is.lineNumber());
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionEntry::functionEntry
(
const word& key,
const dictionary& dict,
Istream& is
)
:
primitiveEntry
(
word(key+dict.name()+Foam::name(is.lineNumber())),
readLine(key, is)
)
{}
// * * * * * * * * * * * * Member Function Selectors * * * * * * * * * * * * //
bool Foam::functionEntry::execute
@ -132,4 +162,17 @@ bool Foam::functionEntry::execute
}
void Foam::functionEntry::write(Ostream& os) const
{
// Contents should be single string token
const token& t = operator[](0);
const string& s = t.stringToken();
for (size_t i = 0; i < s.size(); i++)
{
os.write(s[i]);
}
}
// ************************************************************************* //