https://mooseframework.inl.gov
RealToBoolChainControl.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 "RealToBoolChainControl.h"
11 #include "MooseUtils.h"
12 
14 
17 {
19 
20  params.addClassDescription("Converts a Real-valued chain control data to boolean.");
21 
22  params.addRequiredParam<std::string>("input",
23  "The Real-valued chain control data to convert to boolean.");
24 
25  return params;
26 }
27 
29  : ChainControl(parameters),
30  _input(getChainControlData<Real>("input")),
31  _output(declareChainControlData<bool>("value"))
32 {
33 }
34 
35 void
37 {
39  _output = true;
41  _output = false;
42  else
43  mooseError("The current input value (", _input, ") is not equal to 1 or 0.");
44 }
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Function to check whether two variables are equal within an absolute tolerance.
Definition: MooseUtils.h:380
virtual void execute() override
Execute the control.
Converts a Real-valued chain control data to boolean.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
const Real & _input
The value before conversion.
static InputParameters validParams()
Definition: ChainControl.C:14
static InputParameters validParams()
RealToBoolChainControl(const InputParameters &parameters)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
bool & _output
The converted value.
registerMooseObject("MooseApp", RealToBoolChainControl)
Control that additionally provides the capability to produce/consume data values, to allow control op...
Definition: ChainControl.h:21