Line data Source code
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 "ControllableInputTimes.h" 11 : 12 : registerMooseObject("MooseApp", ControllableInputTimes); 13 : 14 : InputParameters 15 14317 : ControllableInputTimes::validParams() 16 : { 17 14317 : InputParameters params = InputTimes::validParams(); 18 28634 : params.addClassDescription("Times set directly from a user parameter in the input file"); 19 42951 : params.addRequiredParam<Real>("next_time", "Time to store in the times vector"); 20 42951 : params.declareControllable("next_time"); 21 : 22 : // Times are known for all processes already 23 28634 : params.set<bool>("auto_broadcast") = false; 24 28634 : params.makeParamNotRequired("times"); 25 14317 : params.set<bool>("dynamic_time_sequence") = true; 26 : 27 14317 : return params; 28 0 : } 29 : 30 26 : ControllableInputTimes::ControllableInputTimes(const InputParameters & parameters) 31 52 : : InputTimes(parameters), _next_time(getParam<Real>("next_time")) 32 : { 33 26 : } 34 : 35 : void 36 288 : ControllableInputTimes::initialize() 37 : { 38 288 : std::set<Real> times_set; 39 288 : if (_input_times.size()) 40 432 : for (Real & t : _input_times) 41 288 : times_set.insert(t); 42 : 43 288 : times_set.insert(_next_time); 44 : 45 864 : for (Real t : times_set) 46 576 : _times.push_back(t); 47 288 : }