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,14 +91,30 @@ 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())
{
allNames.append(names);
}
else
{
WarningIn("Foam::writeRegisteredObject::write()")
<< "Object " << objectNames_[i] << " not found in "
<< "database. Available objects:" << nl << obr_.sortedToc()
<< endl;
}
}
forAll(allNames, i)
{ {
regIOobject& obj = regIOobject& obj =
const_cast<regIOobject&> const_cast<regIOobject&>
( (
obr_.lookupObject<regIOobject>(objectNames_[i]) obr_.lookupObject<regIOobject>(allNames[i])
); );
if (exclusiveWriting_) if (exclusiveWriting_)
@ -111,14 +127,6 @@ void Foam::writeRegisteredObject::write()
obj.write(); obj.write();
} }
else
{
WarningIn("Foam::writeRegisteredObject::write()")
<< "Object " << objectNames_[i] << " not found in "
<< "database. Available objects:" << nl << obr_.sortedToc()
<< endl;
}
}
} }

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