ZoneList: Empty ZoneLists are no longer written

This commit is contained in:
Henry Weller
2024-04-08 12:50:26 +01:00
parent 47828af6a8
commit f9046e6ec4
2 changed files with 31 additions and 1 deletions

View File

@ -492,6 +492,26 @@ bool Foam::ZoneList<ZoneType, ZonesType, MeshType>::writeData(Ostream& os) const
}
template<class ZoneType, class ZonesType, class MeshType>
bool Foam::ZoneList<ZoneType, ZonesType, MeshType>::writeObject
(
IOstream::streamFormat fmt,
IOstream::versionNumber ver,
IOstream::compressionType cmp,
const bool write
) const
{
if (this->size())
{
return regIOobject::writeObject(fmt, ver, cmp, write);
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class ZoneType, class ZonesType, class MeshType>

View File

@ -165,7 +165,17 @@ public:
bool readIfPresent();
//- writeData member function required by regIOobject
bool writeData(Ostream&) const;
virtual bool writeData(Ostream&) const;
//- Write using given format, version and compression
// Only write the zones file if there are zones in the list
virtual bool writeObject
(
IOstream::streamFormat,
IOstream::versionNumber,
IOstream::compressionType,
const bool write
) const;
// Member Operators