https://mooseframework.inl.gov
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ExecFlagEnum Class Reference

A MultiMooseEnum object to hold "execute_on" flags. More...

#include <ExecFlagEnum.h>

Inheritance diagram for ExecFlagEnum:
[legend]

Public Member Functions

 ExecFlagEnum ()
 
 ExecFlagEnum (const ExecFlagEnum &other)
 
 ExecFlagEnum (const MultiMooseEnum &other)
 
ExecFlagEnumoperator= (const ExecFlagEnum &other)=default
 
std::string getDocString () const
 Generate a documentation string for the "execute_on" parameter. More...
 
const std::set< ExecFlagType > & items () const
 Reference the all the available items. More...
 
const std::string & operator[] (unsigned int i) const
 Indexing operator Operator to retrieve an item from the MultiMooseEnum. More...
 
unsigned int get (unsigned int i) const
 Indexing operator Operator to retrieve the id of an item from the MultiMooseEnum. More...
 
template<typename T >
std::vector< T > getEnum () const
 get the current values cast to a vector of enum type T. Deprecated, use getSetValueIDs instead. More...
 
template<typename T >
std::vector< T > getSetValueIDs () const
 get the current values cast to a vector of enum type T More...
 
unsigned int size () const
 Return the number of active items in the MultiMooseEnum. More...
 
virtual bool isValid () const override
 IsValid. More...
 
MooseEnumBaseoperator+= (const std::string &name)
 
MooseEnumBaseoperator+= (const std::initializer_list< std::string > &names)
 
void addValidName (const std::string &name)
 Extends the range of possible values the variable can be set to. More...
 
void addValidName (const std::initializer_list< std::string > &names)
 
void addValidName (const MultiMooseEnum &names)
 
virtual void deprecate (const std::string &name, const std::string &raw_name="")
 Deprecates various options in the MOOSE enum. More...
 
std::vector< std::string > getNames () const
 Method for returning a vector of all valid enumeration names for this instance. More...
 
std::string getRawNames () const
 Method for returning the raw name strings for this instance. More...
 
std::vector< intgetIDs () const
 Method for returning a vector of ids for this instance. More...
 
bool isOutOfRangeAllowed () const
 isOutOfRangeAllowed More...
 
void addDocumentation (const std::string &name, const std::string &doc)
 Add an item documentation string. More...
 
const std::map< MooseEnumItem, std::string > & getItemDocumentation () const
 Get the map containing each item's documentation string. More...
 
int getNextValidID () const
 Compute the next valid ID. More...
 
template<typename... Args>
void addAvailableFlags (const ExecFlagType &flag, Args... flags)
 Add additional execute_on flags to the list of possible flags. More...
 
const ExecFlagTypeaddAvailableFlags (const ExecFlagType &flag)
 
ExecFlagEnumoperator= (const std::initializer_list< ExecFlagType > &flags)
 
ExecFlagEnumoperator= (const ExecFlagType &flags)
 
ExecFlagEnumoperator+= (const std::initializer_list< ExecFlagType > &flags)
 
ExecFlagEnumoperator+= (const ExecFlagType &flags)
 
MultiMooseEnumoperator= (const MultiMooseEnum &other_enum)=default
 Assignment operators for setting the current flags. More...
 
MultiMooseEnumoperator= (const std::string &names)
 Assignment operators for setting the current flags. More...
 
MultiMooseEnumoperator= (const std::vector< std::string > &names)
 Assignment operators for setting the current flags. More...
 
MultiMooseEnumoperator= (const std::set< std::string > &names)
 Assignment operators for setting the current flags. More...
 
template<typename... Args>
void removeAvailableFlags (const ExecFlagType &flag, Args... flags)
 Remove flags from being available. More...
 
void removeAvailableFlags (const ExecFlagType &flag)
 
bool operator== (const MultiMooseEnum &value) const
 Comparison operators for comparing with character constants, MultiMooseEnums or integer values. More...
 
bool operator!= (const MultiMooseEnum &value) const
 
bool contains (const std::string &value) const
 Methods for seeing if a value is set in the MultiMooseEnum. More...
 
bool contains (int value) const
 
bool contains (unsigned short value) const
 
bool contains (const MultiMooseEnum &value) const
 
bool contains (const MooseEnumItem &value) const
 
bool isValueSet (const std::string &value) const
 Methods for seeing if a value is set in the MultiMooseEnum. More...
 
bool isValueSet (int value) const
 
bool isValueSet (unsigned short value) const
 
bool isValueSet (const MultiMooseEnum &value) const
 
bool isValueSet (const MooseEnumItem &value) const
 
void erase (const std::string &names)
 Un-assign, or unset a value. More...
 
void erase (const std::vector< std::string > &names)
 
void erase (const std::set< std::string > &names)
 
void eraseSetValue (const std::string &names)
 Un-assign, or unset a value. More...
 
void eraseSetValue (const std::vector< std::string > &names)
 
void eraseSetValue (const std::set< std::string > &names)
 
void push_back (const std::string &names)
 Insert operators Operator to insert (push_back) values into the enum. More...
 
void push_back (const std::vector< std::string > &names)
 
void push_back (const std::set< std::string > &names)
 
void push_back (const MultiMooseEnum &other_enum)
 
void setAdditionalValue (const std::string &names)
 Insert operators Operator to insert (push_back) values into the enum. More...
 
void setAdditionalValue (const std::vector< std::string > &names)
 
void setAdditionalValue (const std::set< std::string > &names)
 
void setAdditionalValue (const MultiMooseEnum &other_enum)
 
MooseEnumIterator begin () const
 Returns a begin/end iterator to all of the set values in the enum. More...
 
MooseEnumIterator end () const
 
void clearSetValues ()
 Clear the MultiMooseEnum. More...
 
void clear ()
 
std::set< MooseEnumItem >::const_iterator find (const MooseEnumItem &other) const
 Locate an item. More...
 
std::set< MooseEnumItem >::const_iterator find (const std::string &name) const
 
std::set< MooseEnumItem >::const_iterator find (int id) const
 

Protected Member Functions

void appendCurrent (const ExecFlagType &item)
 Append the list of current flags. More...
 
virtual void checkDeprecated () const override
 Check whether any of the current values are deprecated when called. More...
 
void checkDeprecated (const MooseEnumItem &item) const
 Check and warn deprecated values. More...
 
template<typename InputIterator >
MultiMooseEnumassignValues (InputIterator first, InputIterator last, bool append)
 Helper method for all inserts and assignment operators. More...
 
template<typename InputIterator >
void removeSetValues (InputIterator first, InputIterator last)
 Helper method for un-assigning enumeration values. More...
 
void addEnumerationNames (const std::string &names)
 Methods to add possible enumeration value to the enum. More...
 
const MooseEnumItemaddEnumerationName (const std::string &raw_name)
 
const MooseEnumItemaddEnumerationName (const std::string &name, const int &value)
 
const MooseEnumItemaddEnumerationItem (const MooseEnumItem &item)
 

Protected Attributes

std::vector< MooseEnumItem_current_values
 The current value(s) of the MultiMooseEnum. More...
 
std::set< MooseEnumItem_items
 Storage for the assigned items. More...
 
std::map< MooseEnumItem, MooseEnumItem_deprecated_items
 The map of deprecated names and optional replacements. More...
 
bool _allow_out_of_range
 Flag to enable enumeration items not previously defined. More...
 
std::map< MooseEnumItem, std::string > _item_documentation
 The map of items and their respective documentation strings. More...
 

Detailed Description

A MultiMooseEnum object to hold "execute_on" flags.

This object allows available flags to be added or removed thus each object can control the flags that are available.

Definition at line 21 of file ExecFlagEnum.h.

Constructor & Destructor Documentation

◆ ExecFlagEnum() [1/3]

ExecFlagEnum::ExecFlagEnum ( )

Definition at line 15 of file ExecFlagEnum.C.

15 : MultiMooseEnum() {}
MultiMooseEnum()
Protected constructor for use by libmesh::Parameters.

◆ ExecFlagEnum() [2/3]

ExecFlagEnum::ExecFlagEnum ( const ExecFlagEnum other)

Definition at line 17 of file ExecFlagEnum.C.

17 : MultiMooseEnum(other) {}
MultiMooseEnum()
Protected constructor for use by libmesh::Parameters.

◆ ExecFlagEnum() [3/3]

ExecFlagEnum::ExecFlagEnum ( const MultiMooseEnum other)

Definition at line 16 of file ExecFlagEnum.C.

16 : MultiMooseEnum(other) {}
MultiMooseEnum()
Protected constructor for use by libmesh::Parameters.

Member Function Documentation

◆ addAvailableFlags() [1/2]

template<typename... Args>
void ExecFlagEnum::addAvailableFlags ( const ExecFlagType flag,
Args...  flags 
)

Add additional execute_on flags to the list of possible flags.

Use a recursive variadic template function to allow for an arbitrary number arguments: addAvaiableFlags(EXEC_INITIAL); addAvaiableFlags(EXEC_INITIAL, EXEC_TIMESTEP_END);

Definition at line 82 of file ExecFlagEnum.h.

Referenced by AdvancedOutput::addValidParams(), Output::getDefaultExecFlagEnum(), moose::internal::ExecFlagRegistry::registerFlag(), FunctorMaterial::validParams(), SpatialUserObjectFunctor< ElementIntegralVariableUserObject >::validParams(), Postprocessor::validParams(), MultiAppTransfer::validParams(), Control::validParams(), Sampler::validParams(), AuxKernelTempl< Real >::validParams(), and MultiApp::validParams().

83 {
84  addAvailableFlags(flag);
85  addAvailableFlags(flags...);
86 }
void addAvailableFlags(const ExecFlagType &flag, Args... flags)
Add additional execute_on flags to the list of possible flags.
Definition: ExecFlagEnum.h:82

◆ addAvailableFlags() [2/2]

const ExecFlagType & ExecFlagEnum::addAvailableFlags ( const ExecFlagType flag)

Definition at line 20 of file ExecFlagEnum.C.

21 {
22  return addEnumerationItem(flag);
23 }
const MooseEnumItem & addEnumerationItem(const MooseEnumItem &item)

◆ addDocumentation()

void MooseEnumBase::addDocumentation ( const std::string &  name,
const std::string &  doc 
)
inherited

Add an item documentation string.

Definition at line 175 of file MooseEnumBase.C.

Referenced by PseudoTimestep::validParams(), and ReferenceResidualInterface::validParams().

176 {
177  auto it = find(name);
178  if (it == _items.end())
179  mooseError("Item '", name, "' not found in addDocumentation.");
180  _item_documentation[*it] = doc;
181 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
std::map< MooseEnumItem, std::string > _item_documentation
The map of items and their respective documentation strings.
std::set< MooseEnumItem > _items
Storage for the assigned items.
std::set< MooseEnumItem >::const_iterator find(const MooseEnumItem &other) const
Locate an item.

◆ addEnumerationItem()

const MooseEnumItem & MooseEnumBase::addEnumerationItem ( const MooseEnumItem item)
protectedinherited

Definition at line 117 of file MooseEnumBase.C.

Referenced by addAvailableFlags(), MooseEnumBase::addEnumerationName(), MultiMooseEnum::addValidName(), MultiMooseEnum::assignValues(), and ReporterProducerEnum::insert().

118 {
119  const auto & item_it = find(item);
120  if (item_it != _items.end()) // do nothing for identical insertions
121  return *item_it;
122 
123  if (find(item.id()) != _items.end())
124  mooseError("The supplied id ",
125  item.id(),
126  " already exists in the enumeration, cannot not add '",
127  item,
128  "'.");
129  if (find(item.name()) != _items.end())
130  mooseError("The name '", item.name(), "' already exists in the enumeration.");
131 
132  return *_items.insert(item).first;
133 }
const std::string & name() const
Definition: MooseEnumItem.h:35
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
std::set< MooseEnumItem > _items
Storage for the assigned items.
const int & id() const
Return the numeric, name, or raw name.
Definition: MooseEnumItem.h:34
std::set< MooseEnumItem >::const_iterator find(const MooseEnumItem &other) const
Locate an item.

◆ addEnumerationName() [1/2]

const MooseEnumItem & MooseEnumBase::addEnumerationName ( const std::string &  raw_name)
protectedinherited

Definition at line 73 of file MooseEnumBase.C.

Referenced by MooseEnumBase::addEnumerationNames(), MultiMooseEnum::addValidName(), and MooseEnumBase::operator+=().

74 {
75  // Make sure the option is not malformed
76  if (raw_name.find_first_of('=') == 0 || raw_name.find_last_of('=') == raw_name.length() - 1)
77  mooseError("You cannot place whitespace around the '=' character in MooseEnumBase");
78 
79  // Split on equals sign
80  std::vector<std::string> name_value;
81  MooseUtils::tokenize(MooseUtils::trim(raw_name), name_value, 1, "=");
82 
83  // There should be one or two items in the name_value
84  if (name_value.size() < 1 || name_value.size() > 2)
85  mooseError("Invalid option supplied in MooseEnumBase: ", raw_name);
86 
87  // Remove un-wanted space around string
88  name_value[0] = MooseUtils::trim(name_value[0]);
89 
90  // See if there is a value supplied for this option
91  // strtol allows for proper conversions of both int and hex strings
92  int value;
93  if (name_value.size() == 2)
94  value = std::strtol(name_value[1].c_str(), NULL, 0);
95  else
97 
98  return addEnumerationName(name_value[0], value);
99 }
int getNextValidID() const
Compute the next valid ID.
void tokenize(const std::string &str, std::vector< T > &elements, unsigned int min_len=1, const std::string &delims="/")
This function will split the passed in string on a set of delimiters appending the substrings to the ...
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
const MooseEnumItem & addEnumerationName(const std::string &raw_name)
Definition: MooseEnumBase.C:73
std::string trim(const std::string &str, const std::string &white_space=" \\\)
Standard scripting language trim function.

◆ addEnumerationName() [2/2]

const MooseEnumItem & MooseEnumBase::addEnumerationName ( const std::string &  name,
const int value 
)
protectedinherited

Definition at line 111 of file MooseEnumBase.C.

112 {
113  return addEnumerationItem(MooseEnumItem(name, value));
114 }
const MooseEnumItem & addEnumerationItem(const MooseEnumItem &item)
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:18

◆ addEnumerationNames()

void MooseEnumBase::addEnumerationNames ( const std::string &  names)
protectedinherited

Methods to add possible enumeration value to the enum.

The MooseEnum/MultiMooseEnum are not designed to be modified, with respect to the list of possible values. However, this is not the case for the ExecFlagEnum which is a special type of MultiMooseEnum for managing the "execute_on" flags. These methods are used by ExecFlagEnum to allow users to modify the available execute flags for their object.

Definition at line 64 of file MooseEnumBase.C.

Referenced by MooseEnumBase::MooseEnumBase().

65 {
66  std::vector<std::string> elements;
67  MooseUtils::tokenize(names, elements, 1, " ");
68  for (const std::string & raw_name : elements)
69  addEnumerationName(raw_name);
70 }
void tokenize(const std::string &str, std::vector< T > &elements, unsigned int min_len=1, const std::string &delims="/")
This function will split the passed in string on a set of delimiters appending the substrings to the ...
const MooseEnumItem & addEnumerationName(const std::string &raw_name)
Definition: MooseEnumBase.C:73

◆ addValidName() [1/3]

void MultiMooseEnum::addValidName ( const std::string &  name)
inherited

Extends the range of possible values the variable can be set to.

Definition at line 341 of file MultiMooseEnum.C.

Referenced by MultiMooseEnum::addValidName().

342 {
343  addEnumerationName(name);
344  checkDeprecated();
345 }
virtual void checkDeprecated() const override
Check whether any of the current values are deprecated when called.
const MooseEnumItem & addEnumerationName(const std::string &raw_name)
Definition: MooseEnumBase.C:73

◆ addValidName() [2/3]

void MultiMooseEnum::addValidName ( const std::initializer_list< std::string > &  names)
inherited

Definition at line 355 of file MultiMooseEnum.C.

356 {
357  for (const auto & name : names)
358  addValidName(name);
359 }
void addValidName(const std::string &name)
Extends the range of possible values the variable can be set to.

◆ addValidName() [3/3]

void MultiMooseEnum::addValidName ( const MultiMooseEnum names)
inherited

Definition at line 369 of file MultiMooseEnum.C.

370 {
371  for (const auto & item : names._items)
373 }
int getNextValidID() const
Compute the next valid ID.
const MooseEnumItem & addEnumerationItem(const MooseEnumItem &item)
std::set< MooseEnumItem > _items
Storage for the assigned items.
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:18

◆ appendCurrent()

void ExecFlagEnum::appendCurrent ( const ExecFlagType item)
protected

Append the list of current flags.

Definition at line 83 of file ExecFlagEnum.C.

Referenced by operator+=().

84 {
85  if (find(item) == _items.end())
86  mooseError("The supplied item '",
87  item,
88  "' is not an available item for the "
89  "ExecFlagEnum object, thus it cannot be set as current.");
90  _current_values.push_back(item);
91 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
std::set< MooseEnumItem > _items
Storage for the assigned items.
std::vector< MooseEnumItem > _current_values
The current value(s) of the MultiMooseEnum.
std::set< MooseEnumItem >::const_iterator find(const MooseEnumItem &other) const
Locate an item.

◆ assignValues()

template<typename InputIterator >
MultiMooseEnum & MultiMooseEnum::assignValues ( InputIterator  first,
InputIterator  last,
bool  append 
)
protectedinherited

Helper method for all inserts and assignment operators.

Parameters
firstAn iterator specifying the beginning of the range of values to set
lastAn iterator specifying the end of the range of values to set

Definition at line 261 of file MultiMooseEnum.C.

Referenced by MultiMooseEnum::operator=(), and MultiMooseEnum::setAdditionalValue().

262 {
263  if (!append)
264  clearSetValues();
265 
266  for (InputIterator it = first; it != last; ++it)
267  {
268  const auto iter = find(*it);
269  if (iter == _items.end())
270  {
271  if (!_allow_out_of_range) // Are out of range values allowed?
272  mooseError("Invalid option \"",
273  *it,
274  "\" in MultiMooseEnum. Valid options (not case-sensitive) are \"",
275  getRawNames(),
276  "\".");
277  else
278  {
279  MooseEnumItem created(*it, getNextValidID());
280  addEnumerationItem(created);
281  _current_values.push_back(created);
282  }
283  }
284  else
285  _current_values.push_back(*iter);
286  }
287  checkDeprecated();
288  return *this;
289 }
int getNextValidID() const
Compute the next valid ID.
virtual void checkDeprecated() const override
Check whether any of the current values are deprecated when called.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
std::string getRawNames() const
Method for returning the raw name strings for this instance.
const MooseEnumItem & addEnumerationItem(const MooseEnumItem &item)
std::set< MooseEnumItem > _items
Storage for the assigned items.
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:18
std::vector< MooseEnumItem > _current_values
The current value(s) of the MultiMooseEnum.
std::set< MooseEnumItem >::const_iterator find(const MooseEnumItem &other) const
Locate an item.
void clearSetValues()
Clear the MultiMooseEnum.
bool _allow_out_of_range
Flag to enable enumeration items not previously defined.

◆ begin()

MooseEnumIterator MultiMooseEnum::begin ( ) const
inlineinherited

◆ checkDeprecated() [1/2]

void MooseEnumBase::checkDeprecated ( const MooseEnumItem item) const
protectedinherited

Check and warn deprecated values.

Definition at line 136 of file MooseEnumBase.C.

137 {
138  std::map<MooseEnumItem, MooseEnumItem>::const_iterator it = _deprecated_items.find(item);
139  if (it != _deprecated_items.end())
140  {
141  if (it->second.name().empty())
142  mooseWarning(item.name() + " is deprecated");
143  else
144  mooseWarning(item.name() + " is deprecated, consider using " + it->second.name());
145  }
146 }
const std::string & name() const
Definition: MooseEnumItem.h:35
std::map< MooseEnumItem, MooseEnumItem > _deprecated_items
The map of deprecated names and optional replacements.
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition: MooseError.h:336

◆ checkDeprecated() [2/2]

void MultiMooseEnum::checkDeprecated ( ) const
overrideprotectedvirtualinherited

Check whether any of the current values are deprecated when called.

Implements MooseEnumBase.

Definition at line 327 of file MultiMooseEnum.C.

Referenced by MultiMooseEnum::addValidName(), MultiMooseEnum::assignValues(), and operator+=().

328 {
329  for (const auto & item : _current_values)
331 }
virtual void checkDeprecated() const =0
Method that must be implemented to check derived class values against the _deprecated_names.
std::vector< MooseEnumItem > _current_values
The current value(s) of the MultiMooseEnum.

◆ clear()

void MultiMooseEnum::clear ( )
inherited

Definition at line 314 of file MultiMooseEnum.C.

315 {
316  mooseDeprecated("MultiMooseEnum::clear is deprecated, use MultiMooseEnum::clearSetValues");
317  clearSetValues();
318 }
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:353
void clearSetValues()
Clear the MultiMooseEnum.

◆ clearSetValues()

void MultiMooseEnum::clearSetValues ( )
inherited

Clear the MultiMooseEnum.

Definition at line 308 of file MultiMooseEnum.C.

Referenced by MultiMooseEnum::assignValues(), MultiMooseEnum::clear(), AdvancedOutput::initExecutionTypes(), operator=(), and SetupInterface::SetupInterface().

309 {
310  _current_values.clear();
311 }
std::vector< MooseEnumItem > _current_values
The current value(s) of the MultiMooseEnum.

◆ contains() [1/5]

bool MultiMooseEnum::contains ( const std::string &  value) const
inlineinherited

Methods for seeing if a value is set in the MultiMooseEnum.

Returns
bool - the truth value indicating whether the value is set

Definition at line 102 of file MultiMooseEnum.h.

Referenced by SetupDebugAction::act(), EigenProblem::checkProblemIntegrity(), Moose::PetscSupport::dontAddPetscFlag(), Moose::PetscSupport::petscSetOptionsHelper(), BlockRestrictionDebugOutput::printBlockRestrictionMap(), and Moose::PetscSupport::setSinglePetscOptionIfAppropriate().

102 { return isValueSet(value); }
bool isValueSet(const std::string &value) const
Methods for seeing if a value is set in the MultiMooseEnum.

◆ contains() [2/5]

bool MultiMooseEnum::contains ( int  value) const
inlineinherited

Definition at line 103 of file MultiMooseEnum.h.

103 { return isValueSet(value); }
bool isValueSet(const std::string &value) const
Methods for seeing if a value is set in the MultiMooseEnum.

◆ contains() [3/5]

bool MultiMooseEnum::contains ( unsigned short  value) const
inlineinherited

Definition at line 104 of file MultiMooseEnum.h.

104 { return isValueSet(value); }
bool isValueSet(const std::string &value) const
Methods for seeing if a value is set in the MultiMooseEnum.

◆ contains() [4/5]

bool MultiMooseEnum::contains ( const MultiMooseEnum value) const
inlineinherited

Definition at line 105 of file MultiMooseEnum.h.

105 { return isValueSet(value); }
bool isValueSet(const std::string &value) const
Methods for seeing if a value is set in the MultiMooseEnum.

◆ contains() [5/5]

bool MultiMooseEnum::contains ( const MooseEnumItem value) const
inlineinherited

Definition at line 106 of file MultiMooseEnum.h.

106 { return isValueSet(value); }
bool isValueSet(const std::string &value) const
Methods for seeing if a value is set in the MultiMooseEnum.

◆ deprecate()

void MooseEnumBase::deprecate ( const std::string &  name,
const std::string &  raw_name = "" 
)
virtualinherited

Deprecates various options in the MOOSE enum.

For each deprecated option, you may supply an optional new option that will be used in a message telling the user which new option replaces the old one.

Definition at line 45 of file MooseEnumBase.C.

46 {
47  std::set<MooseEnumItem>::const_iterator deprecated = find(name);
48  if (deprecated == _items.end())
49  mooseError("Cannot deprecate the enum item ", name, ", is not an available value.");
50 
51  std::set<MooseEnumItem>::const_iterator replaced = find(raw_name);
52  if (replaced == _items.end())
53  mooseError("Cannot deprecate the enum item ",
54  name,
55  ", since the replaced item ",
56  raw_name,
57  " it is not an available value.");
58 
59  _deprecated_items.emplace(std::make_pair(*deprecated, *replaced));
61 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
std::map< MooseEnumItem, MooseEnumItem > _deprecated_items
The map of deprecated names and optional replacements.
virtual void checkDeprecated() const =0
Method that must be implemented to check derived class values against the _deprecated_names.
std::set< MooseEnumItem > _items
Storage for the assigned items.
std::set< MooseEnumItem >::const_iterator find(const MooseEnumItem &other) const
Locate an item.

◆ end()

MooseEnumIterator MultiMooseEnum::end ( ) const
inlineinherited

◆ erase() [1/3]

void MultiMooseEnum::erase ( const std::string &  names)
inherited

Un-assign, or unset a value.

Deprecated, use eraseSetValue instead.

Parameters
names- a string, set, or vector giving the name to erase from the enumeration values

Definition at line 149 of file MultiMooseEnum.C.

150 {
151  mooseDeprecated("MultiMooseEnum::erase is deprecated, use MultiMooseEnum::eraseSetValue");
153 }
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:353
void eraseSetValue(const std::string &names)
Un-assign, or unset a value.

◆ erase() [2/3]

void MultiMooseEnum::erase ( const std::vector< std::string > &  names)
inherited

Definition at line 162 of file MultiMooseEnum.C.

163 {
164  mooseDeprecated("MultiMooseEnum::erase is deprecated, use MultiMooseEnum::eraseSetValue");
166 }
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:353
void eraseSetValue(const std::string &names)
Un-assign, or unset a value.

◆ erase() [3/3]

void MultiMooseEnum::erase ( const std::set< std::string > &  names)
inherited

Definition at line 175 of file MultiMooseEnum.C.

176 {
177  mooseDeprecated("MultiMooseEnum::erase is deprecated, use MultiMooseEnum::eraseSetValue");
179 }
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:353
void eraseSetValue(const std::string &names)
Un-assign, or unset a value.

◆ eraseSetValue() [1/3]

void MultiMooseEnum::eraseSetValue ( const std::string &  names)
inherited

Un-assign, or unset a value.

Parameters
names- a string, set, or vector giving the name to erase from the enumeration values

Definition at line 141 of file MultiMooseEnum.C.

Referenced by Console::Console(), and MultiMooseEnum::erase().

142 {
143  std::vector<std::string> names_vector;
144  MooseUtils::tokenize(names, names_vector, 1, " ");
145  removeSetValues(names_vector.begin(), names_vector.end());
146 }
void tokenize(const std::string &str, std::vector< T > &elements, unsigned int min_len=1, const std::string &delims="/")
This function will split the passed in string on a set of delimiters appending the substrings to the ...
void removeSetValues(InputIterator first, InputIterator last)
Helper method for un-assigning enumeration values.

◆ eraseSetValue() [2/3]

void MultiMooseEnum::eraseSetValue ( const std::vector< std::string > &  names)
inherited

Definition at line 156 of file MultiMooseEnum.C.

157 {
158  removeSetValues(names.begin(), names.end());
159 }
void removeSetValues(InputIterator first, InputIterator last)
Helper method for un-assigning enumeration values.

◆ eraseSetValue() [3/3]

void MultiMooseEnum::eraseSetValue ( const std::set< std::string > &  names)
inherited

Definition at line 169 of file MultiMooseEnum.C.

170 {
171  removeSetValues(names.begin(), names.end());
172 }
void removeSetValues(InputIterator first, InputIterator last)
Helper method for un-assigning enumeration values.

◆ find() [1/3]

std::set< MooseEnumItem >::const_iterator MooseEnumBase::find ( const MooseEnumItem other) const
inherited

Locate an item.

Definition at line 206 of file MooseEnumBase.C.

Referenced by MooseEnumBase::addDocumentation(), MooseEnumBase::addEnumerationItem(), appendCurrent(), MooseEnum::assign(), MultiMooseEnum::assignValues(), MooseEnumBase::deprecate(), FVAdvection::FVAdvection(), MooseEnum::operator==(), moose::internal::ExecFlagRegistry::registerFlag(), removeAvailableFlags(), CreateExecutionerAction::setupAutoPreconditioning(), and ReadExecutorParamsAction::setupAutoPreconditioning().

207 {
208  const auto upper = MooseUtils::toUpper(other.name());
209  return std::find_if(_items.begin(),
210  _items.end(),
211  [&other, &upper](MooseEnumItem const & item)
212  { return item.id() == other.id() && item.name() == upper; });
213 }
const std::string & name() const
Definition: MooseEnumItem.h:35
std::string toUpper(const std::string &name)
Convert supplied string to upper case.
std::set< MooseEnumItem > _items
Storage for the assigned items.
const int & id() const
Return the numeric, name, or raw name.
Definition: MooseEnumItem.h:34
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:18

◆ find() [2/3]

std::set< MooseEnumItem >::const_iterator MooseEnumBase::find ( const std::string &  name) const
inherited

Definition at line 190 of file MooseEnumBase.C.

191 {
192  std::string upper = MooseUtils::toUpper(name);
193  return std::find_if(_items.begin(),
194  _items.end(),
195  [&upper](MooseEnumItem const & item) { return item.name() == upper; });
196 }
std::string toUpper(const std::string &name)
Convert supplied string to upper case.
std::set< MooseEnumItem > _items
Storage for the assigned items.
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:18

◆ find() [3/3]

std::set< MooseEnumItem >::const_iterator MooseEnumBase::find ( int  id) const
inherited

Definition at line 199 of file MooseEnumBase.C.

200 {
201  return std::find_if(
202  _items.begin(), _items.end(), [&id](MooseEnumItem const & item) { return item.id() == id; });
203 }
std::set< MooseEnumItem > _items
Storage for the assigned items.
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:18

◆ get()

unsigned int MultiMooseEnum::get ( unsigned int  i) const
inherited

Indexing operator Operator to retrieve the id of an item from the MultiMooseEnum.

Parameters
iindex corresponding to the desired item
Returns
the id of the MooseEnumItem at the supplied index

Definition at line 250 of file MultiMooseEnum.C.

Referenced by PiecewiseMulticonstant::sample(), Moose::Builder::setScalarParameter(), Moose::PetscSupport::storePetscOptions(), and Transfer::Transfer().

251 {
252  mooseAssert(i < _current_values.size(),
253  "Access out of bounds in MultiMooseEnum (i: " << i << " size: "
254  << _current_values.size() << ")");
255 
256  return _current_values[i].id();
257 }
std::vector< MooseEnumItem > _current_values
The current value(s) of the MultiMooseEnum.

◆ getDocString()

std::string ExecFlagEnum::getDocString ( ) const

Generate a documentation string for the "execute_on" parameter.

Definition at line 40 of file ExecFlagEnum.C.

Referenced by CommonOutputAction::validParams(), SetupInterface::validParams(), Output::validParams(), and AuxKernelTempl< Real >::validParams().

41 {
42  std::string doc("The list of flag(s) indicating when this object should be executed. For a "
43  "description of each flag, see ");
44  doc += MooseUtils::mooseDocsURL("source/interfaces/SetupInterface.html");
45  doc += ".";
46  return doc;
47 }
std::string mooseDocsURL(const std::string &path)
Returns the URL of a page located on the MOOSE documentation site.
Definition: MooseUtils.C:135

◆ getEnum()

template<typename T >
std::vector< T > MultiMooseEnum::getEnum ( ) const
inherited

get the current values cast to a vector of enum type T. Deprecated, use getSetValueIDs instead.

Definition at line 308 of file MultiMooseEnum.h.

309 {
310  mooseDeprecated("MultiMooseEnum::getEnum is deprecated, use MultiMooseEnum::getSetValueIDs");
311  return MultiMooseEnum::getSetValueIDs<T>();
312 }
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:353

◆ getIDs()

std::vector< int > MooseEnumBase::getIDs ( ) const
inherited

Method for returning a vector of ids for this instance.

Returns
a vector of ints containing the possible ids for this enumeration

Definition at line 165 of file MooseEnumBase.C.

Referenced by MooseEnum::assign().

166 {
167  std::vector<int> out;
168  out.reserve(_items.size());
169  for (const auto & item : _items)
170  out.push_back(item.id());
171  return out;
172 }
std::set< MooseEnumItem > _items
Storage for the assigned items.
OStreamProxy out

◆ getItemDocumentation()

const std::map< MooseEnumItem, std::string > & MooseEnumBase::getItemDocumentation ( ) const
inherited

Get the map containing each item's documentation string.

Definition at line 184 of file MooseEnumBase.C.

185 {
186  return _item_documentation;
187 }
std::map< MooseEnumItem, std::string > _item_documentation
The map of items and their respective documentation strings.

◆ getNames()

std::vector< std::string > MooseEnumBase::getNames ( ) const
inherited

Method for returning a vector of all valid enumeration names for this instance.

Returns
a vector of names

Definition at line 149 of file MooseEnumBase.C.

150 {
151  std::vector<std::string> out;
152  out.reserve(_items.size());
153  for (const auto & item : _items)
154  out.push_back(item.name());
155  return out;
156 }
std::set< MooseEnumItem > _items
Storage for the assigned items.
OStreamProxy out

◆ getNextValidID()

int MooseEnumBase::getNextValidID ( ) const
inherited

Compute the next valid ID.

Definition at line 102 of file MooseEnumBase.C.

Referenced by MooseEnumBase::addEnumerationName(), MultiMooseEnum::addValidName(), MooseEnum::assign(), MultiMooseEnum::assignValues(), and moose::internal::ExecFlagRegistry::registerFlag().

103 {
104  int value = -1; // Use -1 so if no values exist the first will be zero
105  for (const auto & item : _items)
106  value = std::max(value, item.id());
107  return ++value;
108 }
auto max(const L &left, const R &right)
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
std::set< MooseEnumItem > _items
Storage for the assigned items.

◆ getRawNames()

std::string MooseEnumBase::getRawNames ( ) const
inherited

Method for returning the raw name strings for this instance.

Returns
a space separated list of names

Definition at line 159 of file MooseEnumBase.C.

Referenced by MooseEnum::assign(), MultiMooseEnum::assignValues(), Moose::createMapFromVectorAndMultiMooseEnum(), AdvancedOutput::enableOutputTypes(), MooseEnum::operator==(), PiecewiseConstant::validParams(), LeastSquaresFit::validParams(), BatchMeshGeneratorAction::validParams(), and ComparisonPostprocessor::validParams().

160 {
161  return Moose::stringify(_items, " ");
162 }
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:64
std::set< MooseEnumItem > _items
Storage for the assigned items.

◆ getSetValueIDs()

template<typename T >
std::vector< T > MultiMooseEnum::getSetValueIDs ( ) const
inherited

get the current values cast to a vector of enum type T

Definition at line 294 of file MultiMooseEnum.h.

295 {
296 #ifdef LIBMESH_HAVE_CXX11_TYPE_TRAITS
297  static_assert(std::is_enum<T>::value == true,
298  "The type requested from MooseEnum::getEnum must be an enum type!\n\n");
299 #endif
300  std::vector<T> enum_vec;
301  for (const auto & current_value : _current_values)
302  enum_vec.push_back(static_cast<T>(current_value.id()));
303  return enum_vec;
304 }
std::vector< MooseEnumItem > _current_values
The current value(s) of the MultiMooseEnum.

◆ isOutOfRangeAllowed()

bool MooseEnumBase::isOutOfRangeAllowed ( ) const
inlineinherited

isOutOfRangeAllowed

Returns
- a Boolean indicating whether enum names out of range are allowed

Definition at line 88 of file MooseEnumBase.h.

88 { return _allow_out_of_range; }
bool _allow_out_of_range
Flag to enable enumeration items not previously defined.

◆ isValid()

virtual bool MultiMooseEnum::isValid ( ) const
inlineoverridevirtualinherited

IsValid.

Returns
- a Boolean indicating whether this Enumeration has been set

Implements MooseEnumBase.

Definition at line 233 of file MultiMooseEnum.h.

Referenced by SetupDebugAction::act(), IterationInfo::declareHelper(), MeshInfo::declareHelper(), MeshInfo::possiblyAddSidesetInfo(), MeshInfo::possiblyAddSubdomainInfo(), and BlockRestrictionDebugOutput::printBlockRestrictionMap().

233 { return !_current_values.empty(); }
std::vector< MooseEnumItem > _current_values
The current value(s) of the MultiMooseEnum.

◆ isValueSet() [1/5]

bool MultiMooseEnum::isValueSet ( const std::string &  value) const
inherited

Methods for seeing if a value is set in the MultiMooseEnum.

Returns
bool - the truth value indicating whether the value is set

Definition at line 76 of file MultiMooseEnum.C.

Referenced by Moose::PetscSupport::addPetscFlagsToPetscOptions(), FEProblemBase::addTransfer(), AdvancedOutput::addValidParams(), MultiAppVariableValueSamplePostprocessorTransfer::cacheElemToPostprocessorData(), ChangeOverFixedPointPostprocessor::ChangeOverFixedPointPostprocessor(), ChangeOverTimePostprocessor::ChangeOverTimePostprocessor(), MultiMooseEnum::contains(), IterationInfo::declareHelper(), MeshInfo::declareHelper(), EigenExecutionerBase::init(), MultiAppReporterTransfer::initialSetup(), IntegralPreservingFunctionIC::initialSetup(), MultiAppVariableValueSamplePostprocessorTransfer::initialSetup(), Console::initialSetup(), EigenExecutionerBase::inversePowerIteration(), MultiMooseEnum::isValueSet(), MultiAppReporterTransfer::MultiAppReporterTransfer(), MultiAppVariableValueSamplePostprocessorTransfer::MultiAppVariableValueSamplePostprocessorTransfer(), MultiMooseEnum::operator==(), Console::output(), JSONOutput::outputReporters(), Console::outputSystemInformation(), XMLOutput::outputVectorPostprocessors(), MeshInfo::possiblyAddSidesetInfo(), MeshInfo::possiblyAddSubdomainInfo(), EigenExecutionerBase::postExecute(), removeAvailableFlags(), MultiAppVariableValueSamplePostprocessorTransfer::setupPostprocessorCommunication(), PerfGraphOutput::shouldOutput(), Output::shouldOutput(), FEProblemBase::shouldPrintExecution(), NodalReporter::shouldStore(), ElementReporter::shouldStore(), and GeneralReporter::shouldStore().

77 {
78  return std::find_if(_current_values.begin(),
79  _current_values.end(),
80  [&value](const MooseEnumItem & item)
81  { return item == value; }) != _current_values.end();
82 }
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:18
std::vector< MooseEnumItem > _current_values
The current value(s) of the MultiMooseEnum.

◆ isValueSet() [2/5]

bool MultiMooseEnum::isValueSet ( int  value) const
inherited

Definition at line 85 of file MultiMooseEnum.C.

86 {
87  return std::find_if(_current_values.begin(),
88  _current_values.end(),
89  [&value](const MooseEnumItem & item)
90  { return item == value; }) != _current_values.end();
91 }
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:18
std::vector< MooseEnumItem > _current_values
The current value(s) of the MultiMooseEnum.

◆ isValueSet() [3/5]

bool MultiMooseEnum::isValueSet ( unsigned short  value) const
inherited

Definition at line 94 of file MultiMooseEnum.C.

95 {
96  return std::find_if(_current_values.begin(),
97  _current_values.end(),
98  [&value](const MooseEnumItem & item)
99  { return item == value; }) != _current_values.end();
100 }
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:18
std::vector< MooseEnumItem > _current_values
The current value(s) of the MultiMooseEnum.

◆ isValueSet() [4/5]

bool MultiMooseEnum::isValueSet ( const MultiMooseEnum value) const
inherited

Definition at line 103 of file MultiMooseEnum.C.

104 {
105  for (const auto & item : value._current_values)
106  if (!isValueSet(item))
107  return false;
108  return true;
109 }
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
bool isValueSet(const std::string &value) const
Methods for seeing if a value is set in the MultiMooseEnum.

◆ isValueSet() [5/5]

bool MultiMooseEnum::isValueSet ( const MooseEnumItem value) const
inherited

Definition at line 112 of file MultiMooseEnum.C.

113 {
114  return std::find_if(_current_values.begin(),
115  _current_values.end(),
116  [&value](const MooseEnumItem & item)
117  { return item == value; }) != _current_values.end();
118 }
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:18
std::vector< MooseEnumItem > _current_values
The current value(s) of the MultiMooseEnum.

◆ items()

const std::set<ExecFlagType>& ExecFlagEnum::items ( ) const
inline

Reference the all the available items.

Definition at line 71 of file ExecFlagEnum.h.

Referenced by ExecuteMooseObjectWarehouse< Transfer >::ExecuteMooseObjectWarehouse(), groupUserObjects(), EigenExecutionerBase::normalizeSolution(), and moose::internal::ExecFlagRegistry::registerFlag().

71 { return _items; }
std::set< MooseEnumItem > _items
Storage for the assigned items.

◆ operator!=()

bool MultiMooseEnum::operator!= ( const MultiMooseEnum value) const
inherited

Definition at line 70 of file MultiMooseEnum.C.

71 {
72  return !(*this == value);
73 }
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)

◆ operator+=() [1/4]

ExecFlagEnum & ExecFlagEnum::operator+= ( const std::initializer_list< ExecFlagType > &  flags)

Definition at line 66 of file ExecFlagEnum.C.

67 {
68  for (const ExecFlagType & flag : flags)
69  appendCurrent(flag);
71  return *this;
72 }
virtual void checkDeprecated() const override
Check whether any of the current values are deprecated when called.
void appendCurrent(const ExecFlagType &item)
Append the list of current flags.
Definition: ExecFlagEnum.C:83
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:18

◆ operator+=() [2/4]

ExecFlagEnum & ExecFlagEnum::operator+= ( const ExecFlagType flags)

Definition at line 75 of file ExecFlagEnum.C.

76 {
77  appendCurrent(flag);
79  return *this;
80 }
virtual void checkDeprecated() const override
Check whether any of the current values are deprecated when called.
void appendCurrent(const ExecFlagType &item)
Append the list of current flags.
Definition: ExecFlagEnum.C:83

◆ operator+=() [3/4]

MooseEnumBase & MultiMooseEnum::operator+= ( const std::string &  name)
inherited

Definition at line 348 of file MultiMooseEnum.C.

349 {
350  mooseDeprecated("MultiMooseEnum::operator+= is deprecated, use MultiMooseEnum::addValidName");
351  return MooseEnumBase::operator+=(name);
352 }
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:353
MooseEnumBase & operator+=(const std::string &name)
Adds an enumeration item from name.

◆ operator+=() [4/4]

MooseEnumBase & MultiMooseEnum::operator+= ( const std::initializer_list< std::string > &  names)
inherited

Definition at line 362 of file MultiMooseEnum.C.

363 {
364  mooseDeprecated("MultiMooseEnum::operator+= is deprecated, use MultiMooseEnum::addValidName");
365  return MooseEnumBase::operator+=(names);
366 }
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:353
MooseEnumBase & operator+=(const std::string &name)
Adds an enumeration item from name.

◆ operator=() [1/7]

ExecFlagEnum& ExecFlagEnum::operator= ( const ExecFlagEnum other)
default

◆ operator=() [2/7]

MultiMooseEnum& MultiMooseEnum::operator=
default

Assignment operators for setting the current flags.

◆ operator=() [3/7]

MultiMooseEnum & MultiMooseEnum::operator=

Assignment operators for setting the current flags.

Definition at line 121 of file MultiMooseEnum.C.

122 {
123  std::vector<std::string> names_vector;
124  MooseUtils::tokenize(names, names_vector, 1, " ");
125  return assignValues(names_vector.begin(), names_vector.end(), false);
126 }
MultiMooseEnum & assignValues(InputIterator first, InputIterator last, bool append)
Helper method for all inserts and assignment operators.
void tokenize(const std::string &str, std::vector< T > &elements, unsigned int min_len=1, const std::string &delims="/")
This function will split the passed in string on a set of delimiters appending the substrings to the ...

◆ operator=() [4/7]

MultiMooseEnum & MultiMooseEnum::operator=

Assignment operators for setting the current flags.

Definition at line 135 of file MultiMooseEnum.C.

136 {
137  return assignValues(names.begin(), names.end(), false);
138 }
MultiMooseEnum & assignValues(InputIterator first, InputIterator last, bool append)
Helper method for all inserts and assignment operators.

◆ operator=() [5/7]

MultiMooseEnum & MultiMooseEnum::operator=

Assignment operators for setting the current flags.

Definition at line 129 of file MultiMooseEnum.C.

130 {
131  return assignValues(names.begin(), names.end(), false);
132 }
MultiMooseEnum & assignValues(InputIterator first, InputIterator last, bool append)
Helper method for all inserts and assignment operators.

◆ operator=() [6/7]

ExecFlagEnum & ExecFlagEnum::operator= ( const std::initializer_list< ExecFlagType > &  flags)

Definition at line 50 of file ExecFlagEnum.C.

51 {
53  *this += flags;
54  return *this;
55 }
void clearSetValues()
Clear the MultiMooseEnum.

◆ operator=() [7/7]

ExecFlagEnum & ExecFlagEnum::operator= ( const ExecFlagType flags)

Definition at line 58 of file ExecFlagEnum.C.

59 {
61  *this += flag;
62  return *this;
63 }
void clearSetValues()
Clear the MultiMooseEnum.

◆ operator==()

bool MultiMooseEnum::operator== ( const MultiMooseEnum value) const
inherited

Comparison operators for comparing with character constants, MultiMooseEnums or integer values.

Parameters
value- RHS value to compare against
Returns
bool - the truth value for the comparison

Definition at line 58 of file MultiMooseEnum.C.

59 {
60  // Not the same if the lengths are different
61  if (value.size() != size())
62  return false;
63 
64  // Return false if this enum does not contain an item from the other, since they are the same
65  // size at this point if this is true then they are equal.
66  return isValueSet(value);
67 }
unsigned int size() const
Return the number of active items in the MultiMooseEnum.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
bool isValueSet(const std::string &value) const
Methods for seeing if a value is set in the MultiMooseEnum.

◆ operator[]()

const std::string & MultiMooseEnum::operator[] ( unsigned int  i) const
inherited

Indexing operator Operator to retrieve an item from the MultiMooseEnum.

The reference may not be used to change the item.

Parameters
iindex
Returns
a read/read-write reference to the item as a string.

Definition at line 240 of file MultiMooseEnum.C.

241 {
242  mooseAssert(i < _current_values.size(),
243  "Access out of bounds in MultiMooseEnum (i: " << i << " size: "
244  << _current_values.size() << ")");
245 
246  return _current_values[i].rawName();
247 }
std::vector< MooseEnumItem > _current_values
The current value(s) of the MultiMooseEnum.

◆ push_back() [1/4]

void MultiMooseEnum::push_back ( const std::string &  names)
inherited

Insert operators Operator to insert (push_back) values into the enum.

Existing values are preserved and duplicates are stored. Deprecated, use setAdditionalValue instead.

Parameters
names- a string, set, or vector representing the enumeration values to set.

Definition at line 190 of file MultiMooseEnum.C.

191 {
193  "MultiMooseEnum::push_back is deprecated, use MultiMooseEnum::setAdditionalValue");
195 }
void setAdditionalValue(const std::string &names)
Insert operators Operator to insert (push_back) values into the enum.
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:353

◆ push_back() [2/4]

void MultiMooseEnum::push_back ( const std::vector< std::string > &  names)
inherited

Definition at line 204 of file MultiMooseEnum.C.

205 {
207  "MultiMooseEnum::push_back is deprecated, use MultiMooseEnum::setAdditionalValue");
209 }
void setAdditionalValue(const std::string &names)
Insert operators Operator to insert (push_back) values into the enum.
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:353

◆ push_back() [3/4]

void MultiMooseEnum::push_back ( const std::set< std::string > &  names)
inherited

Definition at line 218 of file MultiMooseEnum.C.

219 {
221  "MultiMooseEnum::push_back is deprecated, use MultiMooseEnum::setAdditionalValue");
223 }
void setAdditionalValue(const std::string &names)
Insert operators Operator to insert (push_back) values into the enum.
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:353

◆ push_back() [4/4]

void MultiMooseEnum::push_back ( const MultiMooseEnum other_enum)
inherited

Definition at line 232 of file MultiMooseEnum.C.

233 {
235  "MultiMooseEnum::push_back is deprecated, use MultiMooseEnum::setAdditionalValue");
237 }
void setAdditionalValue(const std::string &names)
Insert operators Operator to insert (push_back) values into the enum.
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:353

◆ removeAvailableFlags() [1/2]

template<typename... Args>
void ExecFlagEnum::removeAvailableFlags ( const ExecFlagType flag,
Args...  flags 
)

Remove flags from being available.

Definition at line 90 of file ExecFlagEnum.h.

Referenced by PropertyReadFile::validParams().

91 {
93  removeAvailableFlags(flags...);
94 }
void removeAvailableFlags(const ExecFlagType &flag, Args... flags)
Remove flags from being available.
Definition: ExecFlagEnum.h:90

◆ removeAvailableFlags() [2/2]

void ExecFlagEnum::removeAvailableFlags ( const ExecFlagType flag)

Definition at line 26 of file ExecFlagEnum.C.

27 {
28  if (find(flag) == _items.end())
29  mooseError("The supplied item '",
30  flag,
31  "' is not an available enum item for the "
32  "MultiMooseEnum object, thus it cannot be removed.");
33  else if (isValueSet(flag))
34  mooseError("The supplied item '", flag, "' is a selected item, thus it can not be removed.");
35 
36  _items.erase(flag);
37 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
bool isValueSet(const std::string &value) const
Methods for seeing if a value is set in the MultiMooseEnum.
std::set< MooseEnumItem > _items
Storage for the assigned items.
std::set< MooseEnumItem >::const_iterator find(const MooseEnumItem &other) const
Locate an item.

◆ removeSetValues()

template<typename InputIterator >
void MultiMooseEnum::removeSetValues ( InputIterator  first,
InputIterator  last 
)
protectedinherited

Helper method for un-assigning enumeration values.

Parameters
firstAn iterator specifying the beginning of the range of values to set
lastAn iterator specifying the end of the range of values to set

Definition at line 293 of file MultiMooseEnum.C.

Referenced by MultiMooseEnum::eraseSetValue().

294 {
295  // Create a new list of enumerations by striping out the supplied values
296  for (InputIterator it = first; it != last; ++it)
297  {
298  std::vector<MooseEnumItem>::iterator iter =
299  std::find_if(_current_values.begin(),
300  _current_values.end(),
301  [it](const MooseEnumItem & item) { return item == *it; });
302  if (iter != _current_values.end())
303  _current_values.erase(iter);
304  }
305 }
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:18
std::vector< MooseEnumItem > _current_values
The current value(s) of the MultiMooseEnum.

◆ setAdditionalValue() [1/4]

void MultiMooseEnum::setAdditionalValue ( const std::string &  names)
inherited

Insert operators Operator to insert (push_back) values into the enum.

Existing values are preserved and duplicates are stored.

Parameters
names- a string, set, or vector representing the enumeration values to set.

Definition at line 182 of file MultiMooseEnum.C.

Referenced by Moose::PetscSupport::addPetscFlagsToPetscOptions(), Moose::PetscSupport::addPetscPairsToPetscOptions(), Console::Console(), Moose::PetscSupport::dontAddCommonSNESOptions(), Moose::PetscSupport::dontAddPetscFlag(), MultiAppTransfer::MultiAppTransfer(), Output::Output(), PetscOutput::PetscOutput(), and MultiMooseEnum::push_back().

183 {
184  std::vector<std::string> names_vector;
185  MooseUtils::tokenize(names, names_vector, 1, " ");
186  assignValues(names_vector.begin(), names_vector.end(), true);
187 }
MultiMooseEnum & assignValues(InputIterator first, InputIterator last, bool append)
Helper method for all inserts and assignment operators.
void tokenize(const std::string &str, std::vector< T > &elements, unsigned int min_len=1, const std::string &delims="/")
This function will split the passed in string on a set of delimiters appending the substrings to the ...

◆ setAdditionalValue() [2/4]

void MultiMooseEnum::setAdditionalValue ( const std::vector< std::string > &  names)
inherited

Definition at line 198 of file MultiMooseEnum.C.

199 {
200  assignValues(names.begin(), names.end(), true);
201 }
MultiMooseEnum & assignValues(InputIterator first, InputIterator last, bool append)
Helper method for all inserts and assignment operators.

◆ setAdditionalValue() [3/4]

void MultiMooseEnum::setAdditionalValue ( const std::set< std::string > &  names)
inherited

Definition at line 212 of file MultiMooseEnum.C.

213 {
214  assignValues(names.begin(), names.end(), true);
215 }
MultiMooseEnum & assignValues(InputIterator first, InputIterator last, bool append)
Helper method for all inserts and assignment operators.

◆ setAdditionalValue() [4/4]

void MultiMooseEnum::setAdditionalValue ( const MultiMooseEnum other_enum)
inherited

Definition at line 226 of file MultiMooseEnum.C.

227 {
228  assignValues(other_enum.begin(), other_enum.end(), true);
229 }
MultiMooseEnum & assignValues(InputIterator first, InputIterator last, bool append)
Helper method for all inserts and assignment operators.
MooseEnumIterator begin() const
Returns a begin/end iterator to all of the set values in the enum.
MooseEnumIterator end() const

◆ size()

unsigned int MultiMooseEnum::size ( ) const
inherited

Member Data Documentation

◆ _allow_out_of_range

bool MooseEnumBase::_allow_out_of_range
protectedinherited

Flag to enable enumeration items not previously defined.

Definition at line 163 of file MooseEnumBase.h.

Referenced by MooseEnum::assign(), MultiMooseEnum::assignValues(), MooseEnumBase::isOutOfRangeAllowed(), and MooseEnum::operator==().

◆ _current_values

std::vector<MooseEnumItem> MultiMooseEnum::_current_values
protectedinherited

◆ _deprecated_items

std::map<MooseEnumItem, MooseEnumItem> MooseEnumBase::_deprecated_items
protectedinherited

The map of deprecated names and optional replacements.

Definition at line 160 of file MooseEnumBase.h.

Referenced by MooseEnumBase::checkDeprecated(), and MooseEnumBase::deprecate().

◆ _item_documentation

std::map<MooseEnumItem, std::string> MooseEnumBase::_item_documentation
protectedinherited

The map of items and their respective documentation strings.

Definition at line 166 of file MooseEnumBase.h.

Referenced by MooseEnumBase::addDocumentation(), and MooseEnumBase::getItemDocumentation().

◆ _items

std::set<MooseEnumItem> MooseEnumBase::_items
protectedinherited

The documentation for this class was generated from the following files: