diff --git a/src/functionObjects/utilities/writeObjects/writeObjects.C b/src/functionObjects/utilities/writeObjects/writeObjects.C index 0fdc9214c7..283862a122 100644 --- a/src/functionObjects/utilities/writeObjects/writeObjects.C +++ b/src/functionObjects/utilities/writeObjects/writeObjects.C @@ -58,7 +58,7 @@ namespace functionObjects } const Foam::NamedEnum - Foam::functionObjects::writeObjects::writeOptionNames; + Foam::functionObjects::writeObjects::writeOptionNames_; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -111,7 +111,7 @@ bool Foam::functionObjects::writeObjects::read(const dictionary& dict) if (dict.found("writeOption")) { - writeOption_ = writeOptionNames.read(dict.lookup("writeOption")); + writeOption_ = writeOptionNames_.read(dict.lookup("writeOption")); } else { @@ -162,33 +162,38 @@ bool Foam::functionObjects::writeObjects::write() obr_.lookupObject(allNames[i]) ); - switch(writeOption_) + switch (writeOption_) { case AUTO_WRITE: - if (obj.writeOpt() != IOobject::AUTO_WRITE) + { + if(obj.writeOpt() != IOobject::AUTO_WRITE) { continue; } - else - { - break; - } - case NO_WRITE: - if (obj.writeOpt() != IOobject::NO_WRITE) - { - continue; - } - else - { - break; - } - - case ANY_WRITE: break; + } + case NO_WRITE: + { + if(obj.writeOpt() != IOobject::NO_WRITE) + { + continue; + } + break; + } + case ANY_WRITE: + { + break; + } default: - continue; + { + FatalErrorInFunction + << "Unknown writeOption " + << writeOptionNames_[writeOption_] + << ". Valid writeOption types are" << writeOptionNames_ + << exit(FatalError); + } } if diff --git a/src/functionObjects/utilities/writeObjects/writeObjects.H b/src/functionObjects/utilities/writeObjects/writeObjects.H index 40cb22f95a..a39190077a 100644 --- a/src/functionObjects/utilities/writeObjects/writeObjects.H +++ b/src/functionObjects/utilities/writeObjects/writeObjects.H @@ -42,9 +42,11 @@ Description It also has the ability to write the selected objects that were defined with the respective write mode for the requested \c writeOption, namely: - - \c autoWrite - objects set to write at output time - - \c noWrite - objects set to not write by default - - \c anyWrite - any option of the previous two + \vartable + autoWrite | objects set to write at output time + noWrite | objects set to not write by default + anyWrite | any option of the previous two + \endvartable Example of function object specification: \verbatim @@ -60,10 +62,10 @@ Description Usage \table - Property | Description | Required | Default value - type | type name: writeObjects | yes | - objects | objects to write | yes | - writeOption | only those with this write option | no | any + Property | Description | Required | Default value + type | type name: writeObjects | yes | + objects | objects to write | yes | + writeOption | only those with this write option | no | anyWrite \endtable Note: Regular expressions can also be used in \c objects. @@ -116,7 +118,7 @@ public: ANY_WRITE }; - static const NamedEnum writeOptionNames; + static const NamedEnum writeOptionNames_; private: @@ -125,7 +127,7 @@ private: //- Reference to Db const objectRegistry& obr_; - //- Takes over the writing from Db + //- To only write objects of defined writeOption writeOption writeOption_; //- Names of objects to control