https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ControllableParameter.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#include "MooseUtils.h"
12
13void
15{
16 _items.push_back(item);
17}
18
19std::string
21{
22 std::ostringstream oss;
23 for (auto item_ptr : _items)
24 oss << item_ptr->dump();
25 return oss.str();
26}
27
28void
30{
31 for (const ControllableItem * const item : _items)
32 {
33 const std::set<ExecFlagType> & flags = item->getExecuteOnFlags();
34 if (!flags.empty() && flags.find(current) == flags.end())
35 mooseError("The controllable parameter (",
36 item->name(),
37 ") is not allowed to execute on '",
38 current,
39 "', it is only allowed to execute on '",
40 MooseUtils::join(flags, " "),
41 "'.");
42 }
43}
44
45std::ostream &
46operator<<(std::ostream & stream, const ControllableParameter & obj)
47{
48 return stream << obj.dump();
49}
std::ostream & operator<<(std::ostream &stream, const ControllableParameter &obj)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
An intermediate object for building a "controllable item", where an "item" can refer to multiple inpu...
The ControllableParameter class is simply a set of ControllableItem objects.
void add(ControllableItem *item)
Adds the supplied item with the other items within this object.
std::string dump() const
Return a string that lists the parameters stored by this object.
std::vector< ControllableItem * > _items
Storage for the ControllableItems, these are stored as pointers to avoid copies.
void checkExecuteOnType(const ExecFlagType &current) const
Check the execute flags.
Class for containing MooseEnum item information.