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 "ControllableParameter.h" 11 : #include "MooseUtils.h" 12 : 13 : void 14 14169 : ControllableParameter::add(ControllableItem * item) 15 : { 16 14169 : _items.push_back(item); 17 14169 : } 18 : 19 : std::string 20 24 : ControllableParameter::dump() const 21 : { 22 24 : std::ostringstream oss; 23 128 : for (auto item_ptr : _items) 24 104 : oss << item_ptr->dump(); 25 48 : return oss.str(); 26 24 : } 27 : 28 : void 29 10572 : ControllableParameter::checkExecuteOnType(const ExecFlagType & current) const 30 : { 31 24569 : for (const ControllableItem * const item : _items) 32 : { 33 14000 : const std::set<ExecFlagType> & flags = item->getExecuteOnFlags(); 34 14000 : if (!flags.empty() && flags.find(current) == flags.end()) 35 3 : mooseError("The controllable parameter (", 36 3 : item->name(), 37 : ") is not allowed to execute on '", 38 : current, 39 : "', it is only allowed to execute on '", 40 3 : MooseUtils::join(flags, " "), 41 : "'."); 42 : } 43 10569 : } 44 : 45 : std::ostream & 46 0 : operator<<(std::ostream & stream, const ControllableParameter & obj) 47 : { 48 0 : return stream << obj.dump(); 49 : }