Go to the documentation of this file.
12 #include "libmesh/parameters.h"
35 libMesh::Parameters::Value * value,
36 const std::set<ExecFlagType> & flags = {});
58 void set(
const T & value,
bool type_check =
true);
64 std::vector<T>
get(
bool type_check =
true)
const;
89 std::string
type()
const;
94 virtual std::string
dump(
unsigned int indent = 0)
const;
120 std::vector<std::pair<MooseObjectParameterName, libMesh::Parameters::Value *>>
_pairs;
129 template <
typename T>
133 for (
auto & pair :
_pairs)
135 libMesh::Parameters::Parameter<T> * param =
136 dynamic_cast<libMesh::Parameters::Parameter<T> *
>(pair.second);
137 if (type_check && param ==
nullptr)
140 "' parameter the supplied template argument must be of type '",
143 else if (param !=
nullptr)
145 param->set() = value;
151 template <
typename T>
155 std::vector<T> output;
156 output.reserve(
_pairs.size());
157 for (
const auto & pair :
_pairs)
159 libMesh::Parameters::Parameter<T> * param =
160 dynamic_cast<libMesh::Parameters::Parameter<T> *
>(pair.second);
161 if (type_check && param ==
nullptr)
164 "' parameter the supplied template argument must be of type '",
167 else if (param !=
nullptr)
168 output.push_back(param->get());
173 template <
typename T>
177 return std::all_of(
_pairs.begin(),
179 [](std::pair<MooseObjectParameterName, libMesh::Parameters::Value *> pair) {
180 libMesh::Parameters::Parameter<T> * param =
181 dynamic_cast<libMesh::Parameters::Parameter<T> *
>(pair.second);
182 return param !=
nullptr;
194 virtual std::string
dump(
unsigned int indent = 0)
const override;
bool check() const
Return true if the template argument is valid for ALL items.
virtual std::string dump(unsigned int indent=0) const override
Returns a string displaying the parameter name and current value.
std::string type() const
Return the type of the master parameter.
std::string indent(unsigned int spaces)
Create empty string for indenting.
An intermediate object for building a "controllable item", where an "item" can refer to multiple inpu...
std::vector< T > get(bool type_check=true) const
Return a copy of all values for this "item".
ControllableItem & operator=(const ControllableItem &)=delete
virtual ~ControllableItem()=default
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
bool operator!=(const ControllableItem &rhs) const
const std::set< ExecFlagType > & getExecuteOnFlags() const
Return the execute flag restrictions, an empty set is un-restricted.
bool operator==(const ControllableItem &rhs) const
Use the master name for comparison operators to allow object to work within a set/map.
ControllableAlias(const MooseObjectParameterName &name, ControllableItem *)
A class for storing an input parameter name.
bool _changed
Flag for ControlOutput, allows output objects to keep track of when a parameter is altered.
ControllableItem()
Constructor for creating an empty item (see ControllableAlias)
void connect(ControllableItem *item, bool type_check=true)
Connects the supplied item with this item to allow for multiple parameters to be changed by one.
Allows for aliases to be defined via InputParameterWarehouse::addControllableParameterAlias.
virtual const MooseObjectParameterName & name() const override
Return the name of the master parameter.
friend std::ostream & operator<<(std::ostream &stream, const ControllableItem &obj)
Allows this to be used with std:: cout.
virtual std::string dump(unsigned int indent=0) const
Returns a string displaying the parameter name and current value.
void resetChanged()
Methods for ControlOutput::outputChangedControls, these don't have meaning outside of this function.
std::vector< std::pair< MooseObjectParameterName, libMesh::Parameters::Value * > > _pairs
List of names for this item.
std::set< ExecFlagType > _execute_flags
Flags to which the control is restricted (if not set it is unrestricted)
bool operator<(const ControllableItem &rhs) const
MooseObjectParameterName _name
void set(const T &value, bool type_check=true)
Set the value(s) of the controlled parameters stored in this class.
virtual const MooseObjectParameterName & name() const
Return the name of the master parameter.