ENH: writeRegisteredFunctionObject - updated to use wordReList for object names

This commit is contained in:
andy
2013-10-11 14:47:51 +01:00
parent 67a49d125d
commit 81c36f6142
2 changed files with 26 additions and 18 deletions

View File

@ -91,25 +91,14 @@ void Foam::writeRegisteredObject::write()
{ {
Info<< type() << " " << name_ << " output:" << nl; Info<< type() << " " << name_ << " output:" << nl;
DynamicList<word> allNames(obr_.toc().size());
forAll(objectNames_, i) forAll(objectNames_, i)
{ {
if (obr_.foundObject<regIOobject>(objectNames_[i])) wordList names(obr_.names<regIOobject>(objectNames_[i]));
if (names.size())
{ {
regIOobject& obj = allNames.append(names);
const_cast<regIOobject&>
(
obr_.lookupObject<regIOobject>(objectNames_[i])
);
if (exclusiveWriting_)
{
// Switch off automatic writing to prevent double write
obj.writeOpt() = IOobject::NO_WRITE;
}
Info<< " writing object " << obj.name() << nl << endl;
obj.write();
} }
else else
{ {
@ -119,6 +108,25 @@ void Foam::writeRegisteredObject::write()
<< endl; << endl;
} }
} }
forAll(allNames, i)
{
regIOobject& obj =
const_cast<regIOobject&>
(
obr_.lookupObject<regIOobject>(allNames[i])
);
if (exclusiveWriting_)
{
// Switch off automatic writing to prevent double write
obj.writeOpt() = IOobject::NO_WRITE;
}
Info<< " writing object " << obj.name() << nl << endl;
obj.write();
}
} }

View File

@ -74,7 +74,7 @@ SourceFiles
#ifndef writeRegisteredObject_H #ifndef writeRegisteredObject_H
#define writeRegisteredObject_H #define writeRegisteredObject_H
#include "wordList.H" #include "wordReList.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -110,7 +110,7 @@ protected:
// Read from dictionary // Read from dictionary
//- Names of objects to control //- Names of objects to control
wordList objectNames_; wordReList objectNames_;
// Private Member Functions // Private Member Functions