https://mooseframework.inl.gov
UnitTripChainControl.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 "UnitTripChainControl.h"
11 
13 
16 {
18 
19  params.addClassDescription("Trips a boolean value if an input boolean value is a certain value.");
20 
21  params.addRequiredParam<std::string>("input",
22  "The boolean chain control data to determine if tripped");
23  params.addParam<bool>("trip_on_true",
24  true,
25  "If set to 'true', the trip occurs if the input has a value of 'true'; "
26  "else the trip occurs if the input has a value of 'false'.");
27 
28  return params;
29 }
30 
32  : ChainControl(parameters),
33  _trip_on_true(getParam<bool>("trip_on_true")),
34  _input(getChainControlData<bool>("input")),
35  _tripped(declareChainControlData<bool>("tripped"))
36 {
37  _tripped = false;
38 }
39 
40 void
42 {
43  if (_trip_on_true && _input)
44  _tripped = true;
45 
46  if (!_trip_on_true && !_input)
47  _tripped = true;
48 }
registerMooseObject("MooseApp", UnitTripChainControl)
const bool _trip_on_true
Whether to trip on true or false value.
virtual void execute() override
Execute the control.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const bool & _input
Value to check for trip.
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...
static InputParameters validParams()
Definition: ChainControl.C:14
Trips a boolean value if an input boolean value is a certain value.
UnitTripChainControl(const InputParameters &parameters)
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...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...
bool & _tripped
Tripped status.
static InputParameters validParams()
Control that additionally provides the capability to produce/consume data values, to allow control op...
Definition: ChainControl.h:21