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 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -282,7 +282,10 @@ void removeZone
// Remove last element // Remove last element
zones.setSize(zones.size()-1); zones.setSize(zones.size()-1);
zones.clearAddressing(); 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.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 // Remove last element
zones.setSize(zones.size()-1); zones.setSize(zones.size()-1);
zones.clearAddressing(); 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()); source().applyToSet(action, currentSet());
// Synchronize for coupled patches. // Synchronize for coupled patches.
if (!noSync) currentSet().sync(mesh); if (!noSync) currentSet().sync(mesh);
currentSet().write(); if (!currentSet().write())
{
WarningInFunction
<< "Failed writing set "
<< currentSet().objectPath() << endl;
}
} }
break; break;
@ -333,20 +341,35 @@ int main(int argc, char *argv[])
currentSet().subset(oldSet()); currentSet().subset(oldSet());
// Synchronize for coupled patches. // Synchronize for coupled patches.
if (!noSync) currentSet().sync(mesh); if (!noSync) currentSet().sync(mesh);
currentSet().write(); if (!currentSet().write())
{
WarningInFunction
<< "Failed writing set "
<< currentSet().objectPath() << endl;
}
} }
break; break;
case topoSetSource::CLEAR: case topoSetSource::CLEAR:
Info<< " Clearing " << currentSet().type() << endl; Info<< " Clearing " << currentSet().type() << endl;
currentSet().clear(); currentSet().clear();
currentSet().write(); if (!currentSet().write())
{
WarningInFunction
<< "Failed writing set "
<< currentSet().objectPath() << endl;
}
break; break;
case topoSetSource::INVERT: case topoSetSource::INVERT:
Info<< " Inverting " << currentSet().type() << endl; Info<< " Inverting " << currentSet().type() << endl;
currentSet().invert(currentSet().maxSize(mesh)); currentSet().invert(currentSet().maxSize(mesh));
currentSet().write(); if (!currentSet().write())
{
WarningInFunction
<< "Failed writing set "
<< currentSet().objectPath() << endl;
}
break; break;
case topoSetSource::REMOVE: case topoSetSource::REMOVE: