mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: writeRegisteredObject: remove unused switch
This commit is contained in:
@ -44,7 +44,6 @@ Foam::writeRegisteredObject::writeRegisteredObject
|
|||||||
:
|
:
|
||||||
name_(name),
|
name_(name),
|
||||||
obr_(obr),
|
obr_(obr),
|
||||||
active_(true),
|
|
||||||
objectNames_()
|
objectNames_()
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
@ -61,10 +60,7 @@ Foam::writeRegisteredObject::~writeRegisteredObject()
|
|||||||
|
|
||||||
void Foam::writeRegisteredObject::read(const dictionary& dict)
|
void Foam::writeRegisteredObject::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
if (active_)
|
dict.lookup("objectNames") >> objectNames_;
|
||||||
{
|
|
||||||
dict.lookup("objectNames") >> objectNames_;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -82,32 +78,29 @@ void Foam::writeRegisteredObject::end()
|
|||||||
|
|
||||||
void Foam::writeRegisteredObject::write()
|
void Foam::writeRegisteredObject::write()
|
||||||
{
|
{
|
||||||
if (active_)
|
forAll(objectNames_, i)
|
||||||
{
|
{
|
||||||
forAll(objectNames_, i)
|
if (obr_.foundObject<regIOobject>(objectNames_[i]))
|
||||||
{
|
{
|
||||||
if (obr_.foundObject<regIOobject>(objectNames_[i]))
|
regIOobject& obj =
|
||||||
{
|
const_cast<regIOobject&>
|
||||||
regIOobject& obj =
|
|
||||||
const_cast<regIOobject&>
|
|
||||||
(
|
|
||||||
obr_.lookupObject<regIOobject>(objectNames_[i])
|
|
||||||
);
|
|
||||||
// Switch off automatic writing to prevent double write
|
|
||||||
obj.writeOpt() = IOobject::NO_WRITE;
|
|
||||||
obj.write();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
WarningIn
|
|
||||||
(
|
(
|
||||||
"Foam::writeRegisteredObject::read(const dictionary&)"
|
obr_.lookupObject<regIOobject>(objectNames_[i])
|
||||||
) << "Object " << objectNames_[i] << " not found in "
|
);
|
||||||
<< "database. Available objects:" << nl << obr_.sortedToc()
|
// Switch off automatic writing to prevent double write
|
||||||
<< endl;
|
obj.writeOpt() = IOobject::NO_WRITE;
|
||||||
}
|
obj.write();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"Foam::writeRegisteredObject::read(const dictionary&)"
|
||||||
|
) << "Object " << objectNames_[i] << " not found in "
|
||||||
|
<< "database. Available objects:" << nl << obr_.sortedToc()
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -65,10 +65,6 @@ protected:
|
|||||||
|
|
||||||
const objectRegistry& obr_;
|
const objectRegistry& obr_;
|
||||||
|
|
||||||
//- On/off switch
|
|
||||||
bool active_;
|
|
||||||
|
|
||||||
|
|
||||||
// Read from dictionary
|
// Read from dictionary
|
||||||
|
|
||||||
//- Names of objects to control
|
//- Names of objects to control
|
||||||
|
|||||||
Reference in New Issue
Block a user