Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #include "NaNInterface.h" 11 : #include "Conversion.h" 12 : #include "MooseEnum.h" 13 : 14 : InputParameters 15 1693 : NaNInterface::validParams() 16 : { 17 : #ifdef NDEBUG 18 : // in opt mode, getNaN() emits neither a warning nor an error by default 19 3386 : MooseEnum emit_on_nan("none warning exception error", "none"); 20 : #else 21 : // in dbg mode, getNaN() raises an error by default 22 : MooseEnum emit_on_nan("none warning exception error", "error"); 23 : #endif 24 : 25 1693 : InputParameters params = emptyInputParameters(); 26 : 27 3386 : params.addParam<MooseEnum>("emit_on_nan", 28 : emit_on_nan, 29 : "Whether to raise a warning, an exception (usually triggering a retry " 30 : "with a smaller time step) or an error (ending the simulation)"); 31 : 32 1693 : return params; 33 1693 : } 34 : 35 900 : NaNInterface::NaNInterface(const MooseObject * moose_object) 36 900 : : _moose_object(moose_object), 37 900 : _emit_on_nan( 38 900 : _moose_object->getParam<MooseEnum>("emit_on_nan").getEnum<NaNInterface::NaNMessage>()) 39 : { 40 900 : }