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 "ChainControlDataSystem.h" 11 : 12 70166 : ChainControlDataSystem::ChainControlDataSystem(MooseApp & app) : _app(app) {} 13 : 14 : bool 15 2878 : ChainControlDataSystem::hasChainControlData(const std::string & data_name) const 16 : { 17 2878 : return _chain_control_data_map.find(data_name) != _chain_control_data_map.end(); 18 : } 19 : 20 : void 21 313072 : ChainControlDataSystem::copyValuesBack() 22 : { 23 319843 : for (const auto & item : _chain_control_data_map) 24 6771 : item.second->copyValuesBack(); 25 313072 : } 26 : 27 : const std::map<std::string, std::unique_ptr<ChainControlDataBase>> & 28 62756 : ChainControlDataSystem::getChainControlDataMap() const 29 : { 30 62756 : return _chain_control_data_map; 31 : } 32 : 33 : std::string 34 49 : ChainControlDataSystem::outputChainControlMap() const 35 : { 36 49 : std::string map_str = "Chain control data:\n"; 37 147 : for (const auto & item : _chain_control_data_map) 38 : { 39 196 : map_str += item.first + " (" + item.second->type() + ") declared? " + 40 196 : (item.second->getDeclared() ? "true" : "false"); 41 98 : if (const auto ctl_real = dynamic_cast<ChainControlData<Real> *>(item.second.get())) 42 49 : map_str += ". Current value: " + std::to_string(ctl_real->get()); 43 49 : else if (const auto ctl_bool = dynamic_cast<ChainControlData<bool> *>(item.second.get())) 44 49 : map_str += ". Current value: " + std::to_string(ctl_bool->get()); 45 : else 46 0 : mooseWarning("Chain control data output has not been enabled for this this data type: ", 47 0 : item.second->type()); 48 98 : map_str += "\n"; 49 : } 50 : 51 49 : return map_str; 52 0 : }