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 2892 : NaNInterface::validParams() 16 : { 17 : #ifdef NDEBUG 18 : // in opt mode, getNaN() emits neither a warning nor an error by default 19 5784 : 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 2892 : InputParameters params = emptyInputParameters(); 26 : 27 5784 : 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 2892 : return params; 33 2892 : } 34 : 35 1595 : NaNInterface::NaNInterface(const MooseObject * moose_object) 36 1595 : : _moose_object(moose_object), 37 1595 : _emit_on_nan( 38 1595 : _moose_object->getParam<MooseEnum>("emit_on_nan").getEnum<NaNInterface::NaNMessage>()) 39 : { 40 1595 : }