https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ControllableInputTimes.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
13
16{
18 params.addClassDescription("Times set directly from a user parameter in the input file");
19 params.addRequiredParam<Real>("next_time", "Time to store in the times vector");
20 params.declareControllable("next_time");
21
22 // Times are known for all processes already
23 params.set<bool>("auto_broadcast") = false;
24 params.makeParamNotRequired("times");
25 params.set<bool>("dynamic_time_sequence") = true;
26
27 return params;
28}
29
31 : InputTimes(parameters), _next_time(getParam<Real>("next_time"))
32{
33}
34
35void
37{
38 std::set<Real> times_set;
39 if (_input_times.size())
40 for (Real & t : _input_times)
41 times_set.insert(t);
42
43 times_set.insert(_next_time);
44
45 for (Real t : times_set)
46 _times.push_back(t);
47}
registerMooseObject("MooseApp", ControllableInputTimes)
Times from an input parameter and from a value that is modified by Controls.
virtual void initialize() override
In charge of computing / loading the times, unless all that could be done there is done in the constr...
ControllableInputTimes(const InputParameters &parameters)
static InputParameters validParams()
const Real & _next_time
The controllable time attribute.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})
Declare the given parameters as controllable.
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.
void makeParamNotRequired(const std::string &name)
Changes the parameter to not be required.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
Simple times from an input parameter.
Definition InputTimes.h:19
std::vector< Real > _input_times
The input times.
Definition InputTimes.h:29
static InputParameters validParams()
Definition InputTimes.C:15
std::vector< Real > & _times
The vector holding the times.
Definition Times.h:74