diff --git a/src/functionObjects/utilities/writeObjects/writeObjects.C b/src/functionObjects/utilities/writeObjects/writeObjects.C index 0fdc9214c7a212e12a586f670b29af87652dd9ce..283862a122a64dec4aede601088fdce0987348be 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::writeOption, 3> - 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<regIOobject>(allNames[i]) ); - switch(writeOption_) + switch (writeOption_) { case AUTO_WRITE: - if (obj.writeOpt() != IOobject::AUTO_WRITE) + { + if(obj.writeOpt() != IOobject::AUTO_WRITE) { continue; } - else - { - break; - } + break; + } case NO_WRITE: - if (obj.writeOpt() != IOobject::NO_WRITE) + { + if(obj.writeOpt() != IOobject::NO_WRITE) { continue; } - else - { - break; - } + 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 40cb22f95abb82dbe1ab7976ad3ddc2d87df1911..a39190077abbe7b39221bdddaa20cc2e5f5a6a0d 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<writeOption, 3> writeOptionNames; + static const NamedEnum<writeOption, 3> 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