https://mooseframework.inl.gov
Loading...
Searching...
No Matches
TerminateChainControl.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
11#include "FEProblemBase.h"
12
14
17{
19
21 "Terminates the simulation when a boolean chain control data has a certain value.");
22
23 params.addRequiredParam<std::string>(
24 "input", "Boolean control data indicating if the simulation should be terminated");
25 params.addParam<bool>("terminate_on_true",
26 true,
27 "If set to 'true', termination occurs if the input has a value of 'true'; "
28 "else termination occurs if the input has a value of 'false'");
29 params.addParam<bool>("throw_error",
30 false,
31 "Flag to throw an error on termination; else just signal the problem to "
32 "terminate the solve.");
33 params.addRequiredParam<std::string>("termination_message",
34 "Message to use if termination occurs");
35 return params;
36}
37
39 : ChainControl(parameters),
40
41 _terminate_on_true(getParam<bool>("terminate_on_true")),
42 _throw_error(getParam<bool>("throw_error")),
43 _termination_message(getParam<std::string>("termination_message")),
44 _input(getChainControlData<bool>("input"))
45{
46}
47
48void
57
58void
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
registerMooseObject("MooseApp", TerminateChainControl)
Control that additionally provides the capability to produce/consume data values, to allow control op...
static InputParameters validParams()
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this object.
Definition Control.h:76
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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.
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...
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.
virtual void terminateSolve()
Allow objects to request clean termination of the solve.
Definition Problem.h:37
Terminates the simulation when a boolean chain control data has a certain value.
TerminateChainControl(const InputParameters &parameters)
virtual void execute() override
Execute the control.
const bool _throw_error
Flag to throw an error if the terminate condition is met.
void terminate()
Performs termination.
const bool _terminate_on_true
Whether to terminate on true or false.
const std::string & _termination_message
Message to use if termination occurs.
static InputParameters validParams()
const bool & _input
The control data that indicates if the simulation should be terminated.