https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ChainControlDataSystem.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
14bool
15ChainControlDataSystem::hasChainControlData(const std::string & data_name) const
16{
17 return _chain_control_data_map.find(data_name) != _chain_control_data_map.end();
18}
19
20void
22{
23 for (const auto & item : _chain_control_data_map)
24 item.second->copyValuesBack();
25}
26
27const std::map<std::string, std::unique_ptr<ChainControlDataBase>> &
32
33std::string
35{
36 std::string map_str = "Chain control data:\n";
37 for (const auto & item : _chain_control_data_map)
38 {
39 map_str += item.first + " (" + item.second->type() + ") declared? " +
40 (item.second->getDeclared() ? "true" : "false");
41 if (const auto ctl_real = dynamic_cast<ChainControlData<Real> *>(item.second.get()))
42 map_str += ". Current value: " + std::to_string(ctl_real->get());
43 else if (const auto ctl_bool = dynamic_cast<ChainControlData<bool> *>(item.second.get()))
44 map_str += ". Current value: " + std::to_string(ctl_bool->get());
45 else
46 mooseWarning("Chain control data output has not been enabled for this this data type: ",
47 item.second->type());
48 map_str += "\n";
49 }
50
51 return map_str;
52}
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition MooseError.h:345
const std::map< std::string, std::unique_ptr< ChainControlDataBase > > & getChainControlDataMap() const
Gets the map of ChainControlData names to the relevant ChainControlDataBase.
void copyValuesBack()
Copies current chain control data values into old values.
std::string outputChainControlMap() const
Output the chain control map to a string.
std::map< std::string, std::unique_ptr< ChainControlDataBase > > _chain_control_data_map
Map of chain control data name to its value.
bool hasChainControlData(const std::string &data_name) const
Queries if the chain control data of the given name exists.
Concrete definition of a parameter value for a specified type.
Base class for MOOSE-based applications.
Definition MooseApp.h:110