diff --git a/src/catalyst/catalystFunctionObject.C b/src/catalyst/catalystFunctionObject.C index 1c697e217a1e180cb06ac9f847b7cc6436d1322a..0472baebed83cbb9e7da98ecf571512d02cc0b7b 100644 --- a/src/catalyst/catalystFunctionObject.C +++ b/src/catalyst/catalystFunctionObject.C @@ -28,6 +28,7 @@ License #include "stringOps.H" #include "OSHA1stream.H" #include "OSspecific.H" +#include "sigFpe.H" #include "addToRunTimeSelectionTable.H" #include <vtkCPDataDescription.h> @@ -79,6 +80,23 @@ Foam::label Foam::functionObjects::catalystFunctionObject::expand } } + const label nbad = (scripts.size() - nscript); + + if (nbad) + { + Warning + << nl + << "Could not resolve " << nbad << " of " << scripts.size() + << " catalyst scripts - check your input" << nl << nl; + } + + if (!nscript) + { + Warning + << nl + << "No catalyst scripts resolved - check your input" << nl << nl; + } + scripts.resize(nscript); return nscript; @@ -252,6 +270,12 @@ bool Foam::functionObjects::catalystFunctionObject::execute() return false; } + // Disable any floating point trapping so that errors in + // Catalyst pipelines do not kill the simulation + // TODO: report that errors occurred? + + sigFpe::ignore sigFpeHandling; //<- disable in local scope + if (!adaptor_.valid()) { adaptor_.reset(new catalyst::coprocess()); @@ -295,6 +319,11 @@ bool Foam::functionObjects::catalystFunctionObject::execute() adaptor_().process(dataq, outputs); } + + // Avoid compiler complaint about unused variable. + // - manually restore old SIGFPE state + sigFpeHandling.restore(); + return true; }