ENH: topoSet: check write status. Fixes #952

This commit is contained in:
mattijs
2018-07-25 13:27:37 +01:00
parent a6b84927e4
commit 1abacf0d0d
2 changed files with 39 additions and 8 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -282,7 +282,10 @@ void removeZone
// Remove last element
zones.setSize(zones.size()-1);
zones.clearAddressing();
zones.write();
if (!zones.write())
{
WarningInFunction << "Failed writing zone " << setName << endl;
}
}
}
@ -535,7 +538,12 @@ bool doCommand
{
currentSet.instance() = mesh.time().timeName();
}
currentSet.write();
if (!currentSet.write())
{
WarningInFunction
<< "Failed writing set "
<< currentSet.objectPath() << endl;
}
}
}
}

View File

@ -87,7 +87,10 @@ void removeZone
// Remove last element
zones.setSize(zones.size()-1);
zones.clearAddressing();
zones.write();
if (!zones.write())
{
WarningInFunction << "Failed writing zone " << setName << endl;
}
}
}
@ -298,7 +301,12 @@ int main(int argc, char *argv[])
source().applyToSet(action, currentSet());
// Synchronize for coupled patches.
if (!noSync) currentSet().sync(mesh);
currentSet().write();
if (!currentSet().write())
{
WarningInFunction
<< "Failed writing set "
<< currentSet().objectPath() << endl;
}
}
break;
@ -333,20 +341,35 @@ int main(int argc, char *argv[])
currentSet().subset(oldSet());
// Synchronize for coupled patches.
if (!noSync) currentSet().sync(mesh);
currentSet().write();
if (!currentSet().write())
{
WarningInFunction
<< "Failed writing set "
<< currentSet().objectPath() << endl;
}
}
break;
case topoSetSource::CLEAR:
Info<< " Clearing " << currentSet().type() << endl;
currentSet().clear();
currentSet().write();
if (!currentSet().write())
{
WarningInFunction
<< "Failed writing set "
<< currentSet().objectPath() << endl;
}
break;
case topoSetSource::INVERT:
Info<< " Inverting " << currentSet().type() << endl;
currentSet().invert(currentSet().maxSize(mesh));
currentSet().write();
if (!currentSet().write())
{
WarningInFunction
<< "Failed writing set "
<< currentSet().objectPath() << endl;
}
break;
case topoSetSource::REMOVE: