Skip to content
Snippets Groups Projects
Commit 2f033c58 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

ENH: disable SIGFPE handling in catalyst loop

- if sigFpe is enabled within OpenFOAM, any errors in the Catalyst
  pipeline will potentially kill the entire simulation.

- use the new sigFpe::ignore helper class to manage a local disabling
  of SIGFPE handling.
parent 9e58351c
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment