Skip to content

Commit

Permalink
ZoneList: Empty ZoneLists are no longer written
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry Weller committed Apr 8, 2024
1 parent 47828af commit f9046e6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
20 changes: 20 additions & 0 deletions src/OpenFOAM/meshes/zones/ZoneList/ZoneList.C
Expand Up @@ -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>
Expand Down
12 changes: 11 additions & 1 deletion src/OpenFOAM/meshes/zones/ZoneList/ZoneList.H
Expand Up @@ -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
Expand Down

0 comments on commit f9046e6

Please sign in to comment.