https://mooseframework.inl.gov
Loading...
Searching...
No Matches
NaNInterface.C
Go to the documentation of this file.
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
16{
17#ifdef NDEBUG
18 // in opt mode, getNaN() emits neither a warning nor an error by default
19 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
26
27 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 return params;
33}
34
36 : _moose_object(moose_object),
37 _emit_on_nan(
38 _moose_object->getParam<MooseEnum>("emit_on_nan").getEnum<NaNInterface::NaNMessage>())
39{
40}
InputParameters emptyInputParameters()
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
Interface class for producing errors, warnings, or just quiet NaNs.
static InputParameters validParams()
NaNInterface(const MooseObject *moose_object)