ENH: function objects - enabled 'fields' entry to use patterns for some objects

This commit is contained in:
Andrew Heather
2017-11-07 17:33:09 +00:00
parent c1b7854cf7
commit ec9a7cc016
24 changed files with 1043 additions and 69 deletions

View File

@ -150,7 +150,8 @@ Foam::functionObjects::writeFile::writeFile
fileName_("undefined"),
filePtr_(),
writePrecision_(IOstream::defaultPrecision()),
writeToFile_(true)
writeToFile_(true),
writtenHeader_(false)
{}
@ -167,7 +168,8 @@ Foam::functionObjects::writeFile::writeFile
fileName_(fileName),
filePtr_(),
writePrecision_(IOstream::defaultPrecision()),
writeToFile_(true)
writeToFile_(true),
writtenHeader_(false)
{
read(dict);
@ -234,8 +236,13 @@ void Foam::functionObjects::writeFile::writeCommented
const string& str
) const
{
os << setw(1) << "#" << setw(1) << ' '
<< setf(ios_base::left) << setw(charWidth() - 2) << str.c_str();
os << setw(1) << "#";
if (str.size())
{
os << setw(1) << ' '
<< setf(ios_base::left) << setw(charWidth() - 2) << str.c_str();
}
}
@ -255,8 +262,8 @@ void Foam::functionObjects::writeFile::writeHeader
const string& str
) const
{
os << setw(1) << "#" << setw(1) << ' '
<< setf(ios_base::left) << setw(charWidth() - 2) << str.c_str() << nl;
writeCommented(os, str);
os << nl;
}
@ -267,4 +274,10 @@ void Foam::functionObjects::writeFile::writeTime(Ostream& os) const
}
void Foam::functionObjects::writeFile::writeBreak(Ostream& os) const
{
writeHeader(os, "===");
}
// ************************************************************************* //

View File

@ -79,6 +79,9 @@ protected:
//- Flag to enable/disable writing to file
bool writeToFile_;
//- Flag to identify whether the header has been written
bool writtenHeader_;
// Protected Member Functions
@ -171,6 +174,9 @@ public:
//- Write the current time to stream
virtual void writeTime(Ostream& os) const;
//- Write a break marker to the stream
virtual void writeBreak(Ostream& os) const;
//- Write a (commented) header property and value pair
template<class Type>
void writeHeaderValue