From a06dad5d494e9c843b64b3b13be15383ee3d422b Mon Sep 17 00:00:00 2001 From: Patrick Behne Date: Mon, 15 Jul 2024 10:14:11 -0600 Subject: [PATCH 01/10] Renamed MultiMooseEnum's _current attribure to _current_values for clarity. --- framework/include/utils/MultiMooseEnum.h | 16 +++--- framework/src/utils/ExecFlagEnum.C | 2 +- framework/src/utils/MultiMooseEnum.C | 66 ++++++++++++------------ 3 files changed, 43 insertions(+), 41 deletions(-) diff --git a/framework/include/utils/MultiMooseEnum.h b/framework/include/utils/MultiMooseEnum.h index 65ef1814515f..d07f0756be3e 100644 --- a/framework/include/utils/MultiMooseEnum.h +++ b/framework/include/utils/MultiMooseEnum.h @@ -146,8 +146,8 @@ class MultiMooseEnum : public MooseEnumBase * Returns a begin/end iterator to all of the items in the enum. Items will * always be capitalized. */ - MooseEnumIterator begin() const { return _current.begin(); } - MooseEnumIterator end() const { return _current.end(); } + MooseEnumIterator begin() const { return _current_values.begin(); } + MooseEnumIterator end() const { return _current_values.end(); } ///@} /** @@ -164,7 +164,7 @@ class MultiMooseEnum : public MooseEnumBase * IsValid * @return - a Boolean indicating whether this Enumeration has been set */ - virtual bool isValid() const override { return !_current.empty(); } + virtual bool isValid() const override { return !_current_values.empty(); } // InputParameters and Output is allowed to create an empty enum but is responsible for // filling it in after the fact @@ -192,10 +192,10 @@ class MultiMooseEnum : public MooseEnumBase /** * Set the current items. */ - void setCurrentItems(const std::vector & current); + void setCurrentItems(const std::vector & current_items); - /// The current id - std::vector _current; + /// The current value(s) of the MultiMooseEnum. + std::vector _current_values; /** * Protected constructor for use by libmesh::Parameters @@ -218,7 +218,7 @@ MultiMooseEnum::getEnum() const "The type requested from MooseEnum::getEnum must be an enum type!\n\n"); #endif std::vector enum_vec; - for (const auto & current : _current) - enum_vec.push_back(static_cast(current.id())); + for (const auto & current_value : _current_values) + enum_vec.push_back(static_cast(current_value.id())); return enum_vec; } diff --git a/framework/src/utils/ExecFlagEnum.C b/framework/src/utils/ExecFlagEnum.C index 74c009948138..227bb95da2fd 100644 --- a/framework/src/utils/ExecFlagEnum.C +++ b/framework/src/utils/ExecFlagEnum.C @@ -86,5 +86,5 @@ ExecFlagEnum::appendCurrent(const ExecFlagType & item) item, "' is not an available item for the " "ExecFlagEnum object, thus it cannot be set as current."); - _current.push_back(item); + _current_values.push_back(item); } diff --git a/framework/src/utils/MultiMooseEnum.C b/framework/src/utils/MultiMooseEnum.C index b33b2639b48f..2d0f99c89d11 100644 --- a/framework/src/utils/MultiMooseEnum.C +++ b/framework/src/utils/MultiMooseEnum.C @@ -28,7 +28,7 @@ MultiMooseEnum::MultiMooseEnum(std::string names, } MultiMooseEnum::MultiMooseEnum(const MultiMooseEnum & other_enum) - : MooseEnumBase(other_enum), _current(other_enum._current) + : MooseEnumBase(other_enum), _current_values(other_enum._current_values) { } @@ -60,34 +60,34 @@ MultiMooseEnum::operator!=(const MultiMooseEnum & value) const bool MultiMooseEnum::contains(const std::string & value) const { - return std::find_if(_current.begin(), - _current.end(), + return std::find_if(_current_values.begin(), + _current_values.end(), [&value](const MooseEnumItem & item) - { return item == value; }) != _current.end(); + { return item == value; }) != _current_values.end(); } bool MultiMooseEnum::contains(int value) const { - return std::find_if(_current.begin(), - _current.end(), + return std::find_if(_current_values.begin(), + _current_values.end(), [&value](const MooseEnumItem & item) - { return item == value; }) != _current.end(); + { return item == value; }) != _current_values.end(); } bool MultiMooseEnum::contains(unsigned short value) const { - return std::find_if(_current.begin(), - _current.end(), + return std::find_if(_current_values.begin(), + _current_values.end(), [&value](const MooseEnumItem & item) - { return item == value; }) != _current.end(); + { return item == value; }) != _current_values.end(); } bool MultiMooseEnum::contains(const MultiMooseEnum & value) const { - for (const auto & item : value._current) + for (const auto & item : value._current_values) if (!contains(item)) return false; return true; @@ -96,10 +96,10 @@ MultiMooseEnum::contains(const MultiMooseEnum & value) const bool MultiMooseEnum::contains(const MooseEnumItem & value) const { - return std::find_if(_current.begin(), - _current.end(), + return std::find_if(_current_values.begin(), + _current_values.end(), [&value](const MooseEnumItem & item) - { return item == value; }) != _current.end(); + { return item == value; }) != _current_values.end(); } MultiMooseEnum & @@ -171,21 +171,21 @@ MultiMooseEnum::push_back(const MultiMooseEnum & other_enum) const std::string & MultiMooseEnum::operator[](unsigned int i) const { - mooseAssert(i < _current.size(), - "Access out of bounds in MultiMooseEnum (i: " << i << " size: " << _current.size() - << ")"); + mooseAssert(i < _current_values.size(), + "Access out of bounds in MultiMooseEnum (i: " << i << " size: " + << _current_values.size() << ")"); - return _current[i].rawName(); + return _current_values[i].rawName(); } unsigned int MultiMooseEnum::get(unsigned int i) const { - mooseAssert(i < _current.size(), - "Access out of bounds in MultiMooseEnum (i: " << i << " size: " << _current.size() - << ")"); + mooseAssert(i < _current_values.size(), + "Access out of bounds in MultiMooseEnum (i: " << i << " size: " + << _current_values.size() << ")"); - return _current[i].id(); + return _current_values[i].id(); } template @@ -210,11 +210,11 @@ MultiMooseEnum::assign(InputIterator first, InputIterator last, bool append) { MooseEnumItem created(*it, getNextValidID()); addEnumerationItem(created); - _current.push_back(created); + _current_values.push_back(created); } } else - _current.push_back(*iter); + _current_values.push_back(*iter); } checkDeprecated(); return *this; @@ -227,35 +227,37 @@ MultiMooseEnum::remove(InputIterator first, InputIterator last) // Create a new list of enumerations by striping out the supplied values for (InputIterator it = first; it != last; ++it) { - std::vector::iterator iter = std::find_if( - _current.begin(), _current.end(), [it](const MooseEnumItem & item) { return item == *it; }); - if (iter != _current.end()) - _current.erase(iter); + std::vector::iterator iter = + std::find_if(_current_values.begin(), + _current_values.end(), + [it](const MooseEnumItem & item) { return item == *it; }); + if (iter != _current_values.end()) + _current_values.erase(iter); } } void MultiMooseEnum::clear() { - _current.clear(); + _current_values.clear(); } unsigned int MultiMooseEnum::size() const { - return _current.size(); + return _current_values.size(); } void MultiMooseEnum::checkDeprecated() const { - for (const auto & item : _current) + for (const auto & item : _current_values) MooseEnumBase::checkDeprecated(item); } std::ostream & operator<<(std::ostream & out, const MultiMooseEnum & obj) { - out << Moose::stringify(obj._current, " "); + out << Moose::stringify(obj._current_values, " "); return out; } From 3d546e849cdcfcd8f60923c6dd50c062803a8490 Mon Sep 17 00:00:00 2001 From: Patrick Behne Date: Mon, 15 Jul 2024 11:24:57 -0600 Subject: [PATCH 02/10] Improved documentation of MultiMooseEnum class. Ref #21834. --- framework/include/utils/MultiMooseEnum.h | 36 +++++++++++++----------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/framework/include/utils/MultiMooseEnum.h b/framework/include/utils/MultiMooseEnum.h index d07f0756be3e..c44070942960 100644 --- a/framework/include/utils/MultiMooseEnum.h +++ b/framework/include/utils/MultiMooseEnum.h @@ -27,13 +27,15 @@ typedef std::vector::const_iterator MooseEnumIterator; /** * This is a "smart" enum class intended to replace many of the - * shortcomings in the C++ enum type It should be initialized with a - * comma-separated list of strings which become the enum values. You - * may also optionally supply numeric ints for one or more values - * similar to a C++ enum. This is done with the "=" sign. It can be - * used any place where an integer (switch statements), const char* or - * std::string is expected. In addition the InputParameters system - * has full support for this Enum type + * shortcomings in the C++ enum type. There are two parts to a MultiMooseEnum: + * 1) The list of all possible values that a variable can have and + * 2) The subset of these values that the variable is actually set to. + * It should be initialized with a comma-separated list of strings which + * become the possible enum values. You may also optionally supply numeric + * ints for one or more values similar to a C++ enum. This is done with the + * "=" sign. It can be used any place where an integer (switch statements), + * const char* or * std::string is expected. In addition the + * InputParameters system has full support for this Enum type. */ class MultiMooseEnum : public MooseEnumBase { @@ -41,11 +43,11 @@ class MultiMooseEnum : public MooseEnumBase /** * Constructor that takes a list of enumeration values, and a separate string to set a default for * this instance - * @param names - a list of names for this enumeration - * @param default_names - the default value for this enumeration instance + * @param names - a list of all possible values (names) for this enumeration + * @param default_names - the value(s), if any, to set this enumeration instance to * @param allow_out_of_range - determines whether this enumeration will accept values outside of - * it's range of - * defined values. + * it's range of initially defined values, allowing for the possiblity to add additional valid + * values to an object after it has been initialized. */ MultiMooseEnum(std::string names, std::string default_names = "", @@ -76,8 +78,8 @@ class MultiMooseEnum : public MooseEnumBase ///@{ /** - * Contains methods for seeing if a value is in the MultiMooseEnum. - * @return bool - the truth value indicating whether the value is present + * Contains methods for seeing if a value is set in the MultiMooseEnum. + * @return bool - the truth value indicating whether the value is set */ bool contains(const std::string & value) const; bool contains(int value) const; @@ -88,7 +90,7 @@ class MultiMooseEnum : public MooseEnumBase ///@{ /** - * Assignment operators + * Assignment operators to set the objects value from the list of possible values. * @param names - a string, set, or vector representing one of the enumeration values. * @return A reference to this object for chaining */ @@ -99,7 +101,7 @@ class MultiMooseEnum : public MooseEnumBase ///@{ /** - * Un-assign a value + * Un-assign, or unset a value * @param names - a string, set, or vector giving the name to erase from the enumeration values */ void erase(const std::string & names); @@ -112,7 +114,7 @@ class MultiMooseEnum : public MooseEnumBase * Insert operators * Operator to insert (push_back) values into the enum. Existing values are preserved and * duplicates are stored. - * @param names - a string, set, or vector representing one of the enumeration values. + * @param names - a string, set, or vector representing the enumeration values to set. */ void push_back(const std::string & names); void push_back(const std::vector & names); @@ -190,7 +192,7 @@ class MultiMooseEnum : public MooseEnumBase void remove(InputIterator first, InputIterator last); /** - * Set the current items. + * Set the current items/values. */ void setCurrentItems(const std::vector & current_items); From 71d50616cc2e9dd101eb602c181cbc3d201a1f5a Mon Sep 17 00:00:00 2001 From: Patrick Behne Date: Tue, 16 Jul 2024 11:07:21 -0600 Subject: [PATCH 03/10] Renamed MultiMooseEnum methods for clarity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The following methods were renamed as follows: erase -> eraseSetValue push_back -> setAdditionalValue getEnum -> getSetValueIDs clear -> clearSetValues assign -> assignValues remove -> removeSetValues The operator+= method inherited from MooseEnumBase was deleted because “+=“ does not clearly communicate whether the list of possible variable values, the variable value itself, or both are changed. This method was replaced by one with the more descriptive name “addValidName”. --- framework/include/utils/MultiMooseEnum.h | 68 ++++++++++++------- framework/src/interfaces/SetupInterface.C | 2 +- .../src/materials/ParsedMaterialHelper.C | 2 +- framework/src/outputs/AdvancedOutput.C | 2 +- framework/src/outputs/Console.C | 18 ++--- framework/src/outputs/Output.C | 4 +- framework/src/outputs/PetscOutput.C | 8 +-- framework/src/splits/Split.C | 2 +- framework/src/transfers/MultiAppTransfer.C | 6 +- framework/src/utils/ExecFlagEnum.C | 4 +- framework/src/utils/MultiMooseEnum.C | 50 +++++++------- framework/src/utils/PetscSupport.C | 6 +- .../src/actions/RadiationTransferAction.C | 6 +- .../userobjects/PINSFVRhieChowInterpolator.C | 2 +- .../src/actions/CohesiveZoneAction.C | 4 +- .../src/actions/CohesiveZoneActionBase.C | 6 +- .../QuasiStaticSolidMechanicsPhysics.C | 4 +- .../QuasiStaticSolidMechanicsPhysicsBase.C | 6 +- .../thermal_hydraulics/src/base/Simulation.C | 2 +- unit/src/MooseEnumTest.C | 39 +++-------- 20 files changed, 119 insertions(+), 122 deletions(-) diff --git a/framework/include/utils/MultiMooseEnum.h b/framework/include/utils/MultiMooseEnum.h index c44070942960..0c3523fd6678 100644 --- a/framework/include/utils/MultiMooseEnum.h +++ b/framework/include/utils/MultiMooseEnum.h @@ -43,14 +43,14 @@ class MultiMooseEnum : public MooseEnumBase /** * Constructor that takes a list of enumeration values, and a separate string to set a default for * this instance - * @param names - a list of all possible values (names) for this enumeration - * @param default_names - the value(s), if any, to set this enumeration instance to + * @param valid_names - a list of all possible values (names) for this enumeration + * @param initialization_values - the value(s), if any, to set this enumeration instance to * @param allow_out_of_range - determines whether this enumeration will accept values outside of * it's range of initially defined values, allowing for the possiblity to add additional valid * values to an object after it has been initialized. */ - MultiMooseEnum(std::string names, - std::string default_names = "", + MultiMooseEnum(std::string valid_names, + std::string initialization_values = "", bool allow_out_of_range = false); /** @@ -78,7 +78,7 @@ class MultiMooseEnum : public MooseEnumBase ///@{ /** - * Contains methods for seeing if a value is set in the MultiMooseEnum. + * Methods for seeing if a value is set in the MultiMooseEnum. * @return bool - the truth value indicating whether the value is set */ bool contains(const std::string & value) const; @@ -104,9 +104,9 @@ class MultiMooseEnum : public MooseEnumBase * Un-assign, or unset a value * @param names - a string, set, or vector giving the name to erase from the enumeration values */ - void erase(const std::string & names); - void erase(const std::vector & names); - void erase(const std::set & names); + void eraseSetValue(const std::string & names); + void eraseSetValue(const std::vector & names); + void eraseSetValue(const std::set & names); ///@} ///@{ @@ -116,10 +116,10 @@ class MultiMooseEnum : public MooseEnumBase * duplicates are stored. * @param names - a string, set, or vector representing the enumeration values to set. */ - void push_back(const std::string & names); - void push_back(const std::vector & names); - void push_back(const std::set & names); - void push_back(const MultiMooseEnum & other_enum); + void setAdditionalValue(const std::string & names); + void setAdditionalValue(const std::vector & names); + void setAdditionalValue(const std::set & names); + void setAdditionalValue(const MultiMooseEnum & other_enum); ///@} /** @@ -133,20 +133,20 @@ class MultiMooseEnum : public MooseEnumBase /** * Indexing operator - * Operator to retrieve an item from the MultiMooseEnum. - * @param i index + * Operator to retrieve the id of an item from the MultiMooseEnum. + * @param i index corresponding to the desired item * @returns the id of the MooseEnumItem at the supplied index */ unsigned int get(unsigned int i) const; /// get the current values cast to a vector of enum type T template - std::vector getEnum() const; + std::vector getSetValueIDs() const; ///@{ /** - * Returns a begin/end iterator to all of the items in the enum. Items will - * always be capitalized. + * Returns a begin/end iterator to all of the set values in the enum. + * Items will always be capitalized. */ MooseEnumIterator begin() const { return _current_values.begin(); } MooseEnumIterator end() const { return _current_values.end(); } @@ -155,7 +155,7 @@ class MultiMooseEnum : public MooseEnumBase /** * Clear the MultiMooseEnum */ - void clear(); + void clearSetValues(); /** * Return the number of active items in the MultiMooseEnum @@ -175,26 +175,42 @@ class MultiMooseEnum : public MooseEnumBase /// Operator for printing to iostreams friend std::ostream & operator<<(std::ostream & out, const MultiMooseEnum & obj); + // If left enabled, the following functions would add possible values + // (to _items) that an enumerated variable can take. However "+=" is not a + // descriptive enough funtion name for this and should not be used in case + // users get confused that the operator actually changes the set values of the + // variable (_current_values). We should re-implement this logic under a method + // with a more descirptive name to force users to be informed. + MooseEnumBase & operator+=(const std::string & name) = delete; + MooseEnumBase & operator+=(const std::initializer_list & names) = delete; + + // The following replaces operator+= with a more descriptive name + /// Extends the range of possible values the variable can be set to + MooseEnumBase & addValidName(const std::string & name) { return MooseEnumBase::operator+=(name); } + MooseEnumBase & addValidName(const std::initializer_list & names) + { + return MooseEnumBase::operator+=(names); + } + protected: /// Check whether any of the current values are deprecated when called virtual void checkDeprecated() const override; /** * Helper method for all inserts and assignment operators + * @param first An iterator specifying the beginning of the range of values to set + * @param last An iterator specifying the end of the range of values to set */ template - MultiMooseEnum & assign(InputIterator first, InputIterator last, bool append); + MultiMooseEnum & assignValues(InputIterator first, InputIterator last, bool append); /** * Helper method for un-assigning enumeration values + * @param first An iterator specifying the beginning of the range of values to set + * @param last An iterator specifying the end of the range of values to set */ template - void remove(InputIterator first, InputIterator last); - - /** - * Set the current items/values. - */ - void setCurrentItems(const std::vector & current_items); + void removeSetValues(InputIterator first, InputIterator last); /// The current value(s) of the MultiMooseEnum. std::vector _current_values; @@ -213,7 +229,7 @@ class MultiMooseEnum : public MooseEnumBase template std::vector -MultiMooseEnum::getEnum() const +MultiMooseEnum::getSetValueIDs() const { #ifdef LIBMESH_HAVE_CXX11_TYPE_TRAITS static_assert(std::is_enum::value == true, diff --git a/framework/src/interfaces/SetupInterface.C b/framework/src/interfaces/SetupInterface.C index 7bf214ec6afb..7fbbfea58da2 100644 --- a/framework/src/interfaces/SetupInterface.C +++ b/framework/src/interfaces/SetupInterface.C @@ -31,7 +31,7 @@ SetupInterface::SetupInterface(const MooseObject * moose_object) (moose_object->parameters().getCheckedPointerParam("_fe_problem_base")) ->getCurrentExecuteOnFlag()) { - _empty_execute_enum.clear(); // remove any flags for the case when "execute_on" is not used + _empty_execute_enum.clearSetValues(); // remove any flags for the case when "execute_on" is not used } SetupInterface::~SetupInterface() {} diff --git a/framework/src/materials/ParsedMaterialHelper.C b/framework/src/materials/ParsedMaterialHelper.C index 481a41ccd789..6d39977eaec0 100644 --- a/framework/src/materials/ParsedMaterialHelper.C +++ b/framework/src/materials/ParsedMaterialHelper.C @@ -42,7 +42,7 @@ ParsedMaterialHelper::ParsedMaterialHelper(const InputParameters & parame FunctionParserUtils(parameters), _symbol_names(_nargs), _extra_symbols( - this->template getParam("extra_symbols").template getEnum()), + this->template getParam("extra_symbols").template getSetValueIDs()), _tol(0), _map_mode(map_mode), _upstream_mat_names(this->template getParam>("upstream_materials")), diff --git a/framework/src/outputs/AdvancedOutput.C b/framework/src/outputs/AdvancedOutput.C index 093df6878376..b8b77960d141 100644 --- a/framework/src/outputs/AdvancedOutput.C +++ b/framework/src/outputs/AdvancedOutput.C @@ -495,7 +495,7 @@ AdvancedOutput::initExecutionTypes(const std::string & name, ExecFlagEnum & inpu else if (!_pars.have_parameter(param_name)) { input = _execute_on; - input.clear(); + input.clearSetValues(); } } diff --git a/framework/src/outputs/Console.C b/framework/src/outputs/Console.C index 13535b3f59db..ca5bea846e03 100644 --- a/framework/src/outputs/Console.C +++ b/framework/src/outputs/Console.C @@ -214,13 +214,13 @@ Console::Console(const InputParameters & parameters) // Honor the 'print_linear_residuals' option, only if 'linear' has not been set in 'execute_on' // by the user if (common && common->getParam("print_linear_residuals")) - _execute_on.push_back("linear"); + _execute_on.setAdditionalValue("linear"); else - _execute_on.erase("linear"); + _execute_on.eraseSetValue("linear"); if (common && common->getParam("print_nonlinear_residuals")) - _execute_on.push_back("nonlinear"); + _execute_on.setAdditionalValue("nonlinear"); else - _execute_on.erase("nonlinear"); + _execute_on.eraseSetValue("nonlinear"); } if (!_pars.isParamSetByUser("perf_log") && common && common->getParam("print_perf_log")) @@ -235,12 +235,12 @@ Console::Console(const InputParameters & parameters) { const ExecFlagEnum & common_execute_on = common->getParam("execute_on"); for (auto & mme : common_execute_on) - _execute_on.push_back(mme); + _execute_on.setAdditionalValue(mme); } // If --show-outputs is used, enable it if (_app.getParam("show_outputs")) - _system_info_flags.push_back("output"); + _system_info_flags.setAdditionalValue("output"); } Console::~Console() @@ -292,11 +292,11 @@ Console::initialSetup() if (_execute_on.contains("final")) { if (!_pars.isParamSetByUser("postprocessor_execute_on")) - _advanced_execute_on["postprocessors"].push_back("final"); + _advanced_execute_on["postprocessors"].setAdditionalValue("final"); if (!_pars.isParamSetByUser("scalars_execute_on")) - _advanced_execute_on["scalars"].push_back("final"); + _advanced_execute_on["scalars"].setAdditionalValue("final"); if (!_pars.isParamSetByUser("vector_postprocessor_execute_on")) - _advanced_execute_on["vector_postprocessors"].push_back("final"); + _advanced_execute_on["vector_postprocessors"].setAdditionalValue("final"); } } diff --git a/framework/src/outputs/Output.C b/framework/src/outputs/Output.C index 1bbd8e3a18b3..2b05db9ac3dc 100644 --- a/framework/src/outputs/Output.C +++ b/framework/src/outputs/Output.C @@ -88,7 +88,7 @@ Output::validParams() // Add ability to append to the 'execute_on' list params.addParam("additional_execute_on", exec_enum, exec_enum.getDocString()); - params.set("additional_execute_on").clear(); + params.set("additional_execute_on").clearSetValues(); params.addParamNamesToGroup("execute_on additional_execute_on", "Execution scheduling"); // 'Timing' group @@ -201,7 +201,7 @@ Output::Output(const InputParameters & parameters) { const ExecFlagEnum & add = getParam("additional_execute_on"); for (auto & me : add) - _execute_on.push_back(me); + _execute_on.setAdditionalValue(me); } if (isParamValid("output_limiting_function")) diff --git a/framework/src/outputs/PetscOutput.C b/framework/src/outputs/PetscOutput.C index 3a8b231522f7..4c34eea0fd32 100644 --- a/framework/src/outputs/PetscOutput.C +++ b/framework/src/outputs/PetscOutput.C @@ -186,15 +186,15 @@ PetscOutput::PetscOutput(const InputParameters & parameters) { // Output toggle support if (getParam("output_linear")) - _execute_on.push_back("linear"); + _execute_on.setAdditionalValue("linear"); if (getParam("output_nonlinear")) - _execute_on.push_back("nonlinear"); + _execute_on.setAdditionalValue("nonlinear"); // Nonlinear residual start-time supplied by user if (isParamValid("nonlinear_residual_start_time")) { _nonlinear_start_time = getParam("nonlinear_residual_start_time"); - _execute_on.push_back("nonlinear"); + _execute_on.setAdditionalValue("nonlinear"); } // Nonlinear residual end-time supplied by user @@ -205,7 +205,7 @@ PetscOutput::PetscOutput(const InputParameters & parameters) if (isParamValid("linear_residual_start_time")) { _linear_start_time = getParam("linear_residual_start_time"); - _execute_on.push_back("linear"); + _execute_on.setAdditionalValue("linear"); } // Linear residual end-time supplied by user diff --git a/framework/src/splits/Split.C b/framework/src/splits/Split.C index b3ea4df2624a..9af81fc19032 100644 --- a/framework/src/splits/Split.C +++ b/framework/src/splits/Split.C @@ -183,7 +183,7 @@ Split::setup(NonlinearSystemBase & nl, const std::string & prefix) mooseError("Invalid PETSc option name ", op, " for Split ", _name); // push back PETSc options - po.flags.push_back(prefix + op.substr(1)); + po.flags.setAdditionalValue(prefix + op.substr(1)); } for (auto & option : _petsc_options.pairs) diff --git a/framework/src/transfers/MultiAppTransfer.C b/framework/src/transfers/MultiAppTransfer.C index bf22464e8bc3..11594e54dd4a 100644 --- a/framework/src/transfers/MultiAppTransfer.C +++ b/framework/src/transfers/MultiAppTransfer.C @@ -129,11 +129,11 @@ MultiAppTransfer::MultiAppTransfer(const InputParameters & parameters) if (!isParamValid("direction")) { if (_from_multi_app && (!_to_multi_app || _from_multi_app == _to_multi_app)) - _directions.push_back("from_multiapp"); + _directions.setAdditionalValue("from_multiapp"); if (_to_multi_app && (!_from_multi_app || _from_multi_app == _to_multi_app)) - _directions.push_back("to_multiapp"); + _directions.setAdditionalValue("to_multiapp"); if (_from_multi_app && _to_multi_app && _from_multi_app != _to_multi_app) - _directions.push_back("between_multiapp"); + _directions.setAdditionalValue("between_multiapp"); // So it's available in the next constructors _direction = _directions[0]; diff --git a/framework/src/utils/ExecFlagEnum.C b/framework/src/utils/ExecFlagEnum.C index 227bb95da2fd..23d24ae3e2f6 100644 --- a/framework/src/utils/ExecFlagEnum.C +++ b/framework/src/utils/ExecFlagEnum.C @@ -48,7 +48,7 @@ ExecFlagEnum::getDocString() const ExecFlagEnum & ExecFlagEnum::operator=(const std::initializer_list & flags) { - clear(); + clearSetValues(); *this += flags; return *this; } @@ -56,7 +56,7 @@ ExecFlagEnum::operator=(const std::initializer_list & flags) ExecFlagEnum & ExecFlagEnum::operator=(const ExecFlagType & flag) { - clear(); + clearSetValues(); *this += flag; return *this; } diff --git a/framework/src/utils/MultiMooseEnum.C b/framework/src/utils/MultiMooseEnum.C index 2d0f99c89d11..76f7343e5a66 100644 --- a/framework/src/utils/MultiMooseEnum.C +++ b/framework/src/utils/MultiMooseEnum.C @@ -19,12 +19,12 @@ #include #include -MultiMooseEnum::MultiMooseEnum(std::string names, - std::string default_names, +MultiMooseEnum::MultiMooseEnum(std::string valid_names, + std::string initialization_values, bool allow_out_of_range) - : MooseEnumBase(names, allow_out_of_range) + : MooseEnumBase(valid_names, allow_out_of_range) { - *this = default_names; + *this = initialization_values; } MultiMooseEnum::MultiMooseEnum(const MultiMooseEnum & other_enum) @@ -107,65 +107,65 @@ MultiMooseEnum::operator=(const std::string & names) { std::vector names_vector; MooseUtils::tokenize(names, names_vector, 1, " "); - return assign(names_vector.begin(), names_vector.end(), false); + return assignValues(names_vector.begin(), names_vector.end(), false); } MultiMooseEnum & MultiMooseEnum::operator=(const std::vector & names) { - return assign(names.begin(), names.end(), false); + return assignValues(names.begin(), names.end(), false); } MultiMooseEnum & MultiMooseEnum::operator=(const std::set & names) { - return assign(names.begin(), names.end(), false); + return assignValues(names.begin(), names.end(), false); } void -MultiMooseEnum::erase(const std::string & names) +MultiMooseEnum::eraseSetValue(const std::string & names) { std::vector names_vector; MooseUtils::tokenize(names, names_vector, 1, " "); - remove(names_vector.begin(), names_vector.end()); + removeSetValues(names_vector.begin(), names_vector.end()); } void -MultiMooseEnum::erase(const std::vector & names) +MultiMooseEnum::eraseSetValue(const std::vector & names) { - remove(names.begin(), names.end()); + removeSetValues(names.begin(), names.end()); } void -MultiMooseEnum::erase(const std::set & names) +MultiMooseEnum::eraseSetValue(const std::set & names) { - remove(names.begin(), names.end()); + removeSetValues(names.begin(), names.end()); } void -MultiMooseEnum::push_back(const std::string & names) +MultiMooseEnum::setAdditionalValue(const std::string & names) { std::vector names_vector; MooseUtils::tokenize(names, names_vector, 1, " "); - assign(names_vector.begin(), names_vector.end(), true); + assignValues(names_vector.begin(), names_vector.end(), true); } void -MultiMooseEnum::push_back(const std::vector & names) +MultiMooseEnum::setAdditionalValue(const std::vector & names) { - assign(names.begin(), names.end(), true); + assignValues(names.begin(), names.end(), true); } void -MultiMooseEnum::push_back(const std::set & names) +MultiMooseEnum::setAdditionalValue(const std::set & names) { - assign(names.begin(), names.end(), true); + assignValues(names.begin(), names.end(), true); } void -MultiMooseEnum::push_back(const MultiMooseEnum & other_enum) +MultiMooseEnum::setAdditionalValue(const MultiMooseEnum & other_enum) { - assign(other_enum.begin(), other_enum.end(), true); + assignValues(other_enum.begin(), other_enum.end(), true); } const std::string & @@ -190,10 +190,10 @@ MultiMooseEnum::get(unsigned int i) const template MultiMooseEnum & -MultiMooseEnum::assign(InputIterator first, InputIterator last, bool append) +MultiMooseEnum::assignValues(InputIterator first, InputIterator last, bool append) { if (!append) - clear(); + clearSetValues(); for (InputIterator it = first; it != last; ++it) { @@ -222,7 +222,7 @@ MultiMooseEnum::assign(InputIterator first, InputIterator last, bool append) template void -MultiMooseEnum::remove(InputIterator first, InputIterator last) +MultiMooseEnum::removeSetValues(InputIterator first, InputIterator last) { // Create a new list of enumerations by striping out the supplied values for (InputIterator it = first; it != last; ++it) @@ -237,7 +237,7 @@ MultiMooseEnum::remove(InputIterator first, InputIterator last) } void -MultiMooseEnum::clear() +MultiMooseEnum::clearSetValues() { _current_values.clear(); } diff --git a/framework/src/utils/PetscSupport.C b/framework/src/utils/PetscSupport.C index 3d4a315dc1d9..7876c438cca8 100644 --- a/framework/src/utils/PetscSupport.C +++ b/framework/src/utils/PetscSupport.C @@ -651,7 +651,7 @@ processPetscFlags(const MultiMooseEnum & petsc_flags, PetscOptions & po) // Update the stored items, but do not create duplicates if (!po.flags.contains(option)) - po.flags.push_back(option); + po.flags.setAdditionalValue(option); } } @@ -1043,7 +1043,7 @@ disableNonlinearConvergedReason(FEProblemBase & fe_problem) { auto & petsc_options = fe_problem.getPetscOptions(); - petsc_options.flags.erase("-snes_converged_reason"); + petsc_options.flags.eraseSetValue("-snes_converged_reason"); auto & pairs = petsc_options.pairs; auto it = MooseUtils::findPair(pairs, "-snes_converged_reason", MooseUtils::Any); @@ -1056,7 +1056,7 @@ disableLinearConvergedReason(FEProblemBase & fe_problem) { auto & petsc_options = fe_problem.getPetscOptions(); - petsc_options.flags.erase("-ksp_converged_reason"); + petsc_options.flags.eraseSetValue("-ksp_converged_reason"); auto & pairs = petsc_options.pairs; auto it = MooseUtils::findPair(pairs, "-ksp_converged_reason", MooseUtils::Any); diff --git a/modules/heat_transfer/src/actions/RadiationTransferAction.C b/modules/heat_transfer/src/actions/RadiationTransferAction.C index 5b785e626e0f..0a4ab2c0c056 100644 --- a/modules/heat_transfer/src/actions/RadiationTransferAction.C +++ b/modules/heat_transfer/src/actions/RadiationTransferAction.C @@ -49,7 +49,7 @@ RadiationTransferAction::validParams() "Number of radiation patches per sideset."); MultiMooseEnum partitioning( "default=-3 metis=-2 parmetis=-1 linear=0 centroid hilbert_sfc morton_sfc", "default"); - partitioning += "grid"; + partitioning.addValidName("grid"); params.addParam( "partitioners", partitioning, @@ -488,9 +488,9 @@ RadiationTransferAction::addMeshGenerator() MultiMooseEnum partitioners = getParam("partitioners"); if (!_pars.isParamSetByUser("partitioners")) { - partitioners.clear(); + partitioners.clearSetValues(); for (unsigned int j = 0; j < _boundary_names.size(); ++j) - partitioners.push_back("metis"); + partitioners.setAdditionalValue("metis"); } MultiMooseEnum direction = getParam("centroid_partitioner_directions"); diff --git a/modules/navier_stokes/src/userobjects/PINSFVRhieChowInterpolator.C b/modules/navier_stokes/src/userobjects/PINSFVRhieChowInterpolator.C index 8d1985a7b3f7..32440a455f20 100644 --- a/modules/navier_stokes/src/userobjects/PINSFVRhieChowInterpolator.C +++ b/modules/navier_stokes/src/userobjects/PINSFVRhieChowInterpolator.C @@ -22,7 +22,7 @@ PINSFVRhieChowInterpolator::validParams() params.addClassDescription("Performs interpolations and reconstructions of porosity and computes " "the Rhie-Chow face velocities."); ExecFlagEnum & exec_enum = params.set("execute_on", /*quiet=*/true); - exec_enum.push_back(EXEC_INITIAL); + exec_enum.setAdditionalValue(EXEC_INITIAL); params.addRequiredParam(NS::porosity, "The porosity"); params.addParam( "smoothing_layers", diff --git a/modules/solid_mechanics/src/actions/CohesiveZoneAction.C b/modules/solid_mechanics/src/actions/CohesiveZoneAction.C index 32e4472ed652..f38bc3ce5b7e 100644 --- a/modules/solid_mechanics/src/actions/CohesiveZoneAction.C +++ b/modules/solid_mechanics/src/actions/CohesiveZoneAction.C @@ -239,7 +239,7 @@ CohesiveZoneAction::verifyOrderAndFamilyOutputs() // if no value was provided, chose the default CONSTANT if (_material_output_order.size() == 0) - _material_output_order.push_back("CONSTANT"); + _material_output_order.setAdditionalValue("CONSTANT"); // For only one order, make all orders the same magnitude if (_material_output_order.size() == 1) @@ -254,7 +254,7 @@ CohesiveZoneAction::verifyOrderAndFamilyOutputs() // if no value was provided, chose the default MONOMIAL if (_material_output_family.size() == 0) - _material_output_family.push_back("MONOMIAL"); + _material_output_family.setAdditionalValue("MONOMIAL"); // For only one family, make all families that value if (_material_output_family.size() == 1) diff --git a/modules/solid_mechanics/src/actions/CohesiveZoneActionBase.C b/modules/solid_mechanics/src/actions/CohesiveZoneActionBase.C index f9853a113a44..50df4be54ae3 100644 --- a/modules/solid_mechanics/src/actions/CohesiveZoneActionBase.C +++ b/modules/solid_mechanics/src/actions/CohesiveZoneActionBase.C @@ -125,11 +125,11 @@ CohesiveZoneActionBase::CohesiveZoneActionBase(const InputParameters & params) : getParam("additional_material_output_family"); for (auto & output : additional_generate_output) - generate_output.push_back(output); + generate_output.setAdditionalValue(output); for (auto & order : additional_material_output_order) - material_output_order.push_back(order); + material_output_order.setAdditionalValue(order); for (auto & family : additional_material_output_family) - material_output_family.push_back(family); + material_output_family.setAdditionalValue(family); pars.set("generate_output") = generate_output; pars.set("material_output_order") = material_output_order; diff --git a/modules/solid_mechanics/src/physics/QuasiStaticSolidMechanicsPhysics.C b/modules/solid_mechanics/src/physics/QuasiStaticSolidMechanicsPhysics.C index 4acd5a3d07fb..8c440d38df4e 100644 --- a/modules/solid_mechanics/src/physics/QuasiStaticSolidMechanicsPhysics.C +++ b/modules/solid_mechanics/src/physics/QuasiStaticSolidMechanicsPhysics.C @@ -772,7 +772,7 @@ QuasiStaticSolidMechanicsPhysics::verifyOrderAndFamilyOutputs() // if no value was provided, chose the default CONSTANT if (_material_output_order.size() == 0) - _material_output_order.push_back("CONSTANT"); + _material_output_order.setAdditionalValue("CONSTANT"); // For only one order, make all orders the same magnitude if (_material_output_order.size() == 1) @@ -787,7 +787,7 @@ QuasiStaticSolidMechanicsPhysics::verifyOrderAndFamilyOutputs() // if no value was provided, chose the default MONOMIAL if (_material_output_family.size() == 0) - _material_output_family.push_back("MONOMIAL"); + _material_output_family.setAdditionalValue("MONOMIAL"); // For only one family, make all families that value if (_material_output_family.size() == 1) diff --git a/modules/solid_mechanics/src/physics/QuasiStaticSolidMechanicsPhysicsBase.C b/modules/solid_mechanics/src/physics/QuasiStaticSolidMechanicsPhysicsBase.C index e4cdc0641fa0..0074edbc2839 100644 --- a/modules/solid_mechanics/src/physics/QuasiStaticSolidMechanicsPhysicsBase.C +++ b/modules/solid_mechanics/src/physics/QuasiStaticSolidMechanicsPhysicsBase.C @@ -275,11 +275,11 @@ QuasiStaticSolidMechanicsPhysicsBase::QuasiStaticSolidMechanicsPhysicsBase( getParam("additional_material_output_family"); for (auto & output : additional_generate_output) - generate_output.push_back(output); + generate_output.setAdditionalValue(output); for (auto & order : additional_material_output_order) - material_output_order.push_back(order); + material_output_order.setAdditionalValue(order); for (auto & family : additional_material_output_family) - material_output_family.push_back(family); + material_output_family.setAdditionalValue(family); pars.set("generate_output") = generate_output; pars.set("material_output_order") = material_output_order; diff --git a/modules/thermal_hydraulics/src/base/Simulation.C b/modules/thermal_hydraulics/src/base/Simulation.C index d742aeaaf67f..184b100ebd23 100644 --- a/modules/thermal_hydraulics/src/base/Simulation.C +++ b/modules/thermal_hydraulics/src/base/Simulation.C @@ -706,7 +706,7 @@ Simulation::setupCoordinateSystem() { blocks.push_back(subdomains[i]); // coord_types.push_back("XYZ"); - coord_types.push_back(coord_sys[i] == Moose::COORD_RZ ? "RZ" : "XYZ"); + coord_types.setAdditionalValue(coord_sys[i] == Moose::COORD_RZ ? "RZ" : "XYZ"); } } } diff --git a/unit/src/MooseEnumTest.C b/unit/src/MooseEnumTest.C index f60666fef471..98344ec7c230 100644 --- a/unit/src/MooseEnumTest.C +++ b/unit/src/MooseEnumTest.C @@ -25,7 +25,7 @@ TEST(MooseEnum, multiTestOne) EXPECT_EQ(mme.contains("three"), false); EXPECT_EQ(mme.contains("four"), false); - mme.push_back("four"); + mme.setAdditionalValue("four"); EXPECT_EQ(mme.contains("one"), false); EXPECT_EQ(mme.contains("two"), true); EXPECT_EQ(mme.contains("three"), false); @@ -34,10 +34,10 @@ TEST(MooseEnum, multiTestOne) // isValid EXPECT_EQ(mme.isValid(), true); - mme.clear(); + mme.clearSetValues(); EXPECT_EQ(mme.isValid(), false); - mme.push_back("one three"); + mme.setAdditionalValue("one three"); EXPECT_EQ(mme.contains("one"), true); EXPECT_EQ(mme.contains("two"), false); EXPECT_EQ(mme.contains("three"), true); @@ -65,30 +65,30 @@ TEST(MooseEnum, multiTestOne) EXPECT_EQ(mme.contains("four"), false); // Insert - mme.push_back(mvec); + mme.setAdditionalValue(mvec); EXPECT_EQ(mme.contains("one"), true); EXPECT_EQ(mme.contains("two"), true); EXPECT_EQ(mme.contains("three"), true); EXPECT_EQ(mme.contains("four"), false); // Insert another valid multi-enum - mme.clear(); + mme.clearSetValues(); mme = "one four"; MultiMooseEnum mme2("one two three four", "three"); - mme.push_back(mme2); + mme.setAdditionalValue(mme2); EXPECT_EQ(mme.contains("one"), true); EXPECT_EQ(mme.contains("two"), false); EXPECT_EQ(mme.contains("three"), true); EXPECT_EQ(mme.contains("four"), true); - mme.clear(); + mme.clearSetValues(); mme = "one four"; EXPECT_EQ(mme.contains("one"), true); EXPECT_EQ(mme.contains("two"), false); EXPECT_EQ(mme.contains("three"), false); EXPECT_EQ(mme.contains("four"), true); - mme.push_back("three four"); + mme.setAdditionalValue("three four"); EXPECT_EQ(mme.contains("one"), true); EXPECT_EQ(mme.contains("two"), false); EXPECT_EQ(mme.contains("three"), true); @@ -114,7 +114,7 @@ TEST(MooseEnum, multiTestOne) EXPECT_EQ(difference.size(), 0); // Order and indexing - mme.clear(); + mme.clearSetValues(); mme = "one two four"; EXPECT_EQ(mme.contains("three"), false); @@ -157,7 +157,7 @@ TEST(MooseEnum, testDeprecate) { MultiMooseEnum mme("one too two three four"); mme.deprecate("too", "two"); - mme.push_back("one"); + mme.setAdditionalValue("one"); mme = "too"; FAIL() << "missing expected error"; } @@ -371,25 +371,6 @@ TEST(MooseEnum, operatorEqual) } } -TEST(MooseEnum, operatorPlus) -{ - MooseEnum a("a=1 b=2", "a"); - a += "c=3"; - a += {"d=4", "e=5"}; - - MooseEnum b("a=1 b=2 c=3 d=4 e=5"); - - EXPECT_TRUE(a.items() == b.items()); - - MultiMooseEnum c("a=1 b=2", "a"); - c += "c=3"; - c += {"d=4", "e=5"}; - - MultiMooseEnum d("a=1 b=2 c=3 d=4 e=5"); - - EXPECT_TRUE(c.items() == d.items()); -} - TEST(MooseEnum, getIDs) { MooseEnum a("a=1980 e=1949", "e"); From 3f67f62cea534ae844bc1edf365bbb1c5c44243b Mon Sep 17 00:00:00 2001 From: Patrick Behne Date: Tue, 16 Jul 2024 13:00:22 -0600 Subject: [PATCH 04/10] Removed default value from constructor's initialization_values, added a consturctor with no parameter to specify initialization_values. --- framework/include/utils/MultiMooseEnum.h | 25 ++++++++++++++++--- framework/src/interfaces/SetupInterface.C | 3 ++- .../src/materials/ParsedMaterialHelper.C | 4 +-- framework/src/utils/MultiMooseEnum.C | 13 ++++++++++ 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/framework/include/utils/MultiMooseEnum.h b/framework/include/utils/MultiMooseEnum.h index 0c3523fd6678..a75c6903c117 100644 --- a/framework/include/utils/MultiMooseEnum.h +++ b/framework/include/utils/MultiMooseEnum.h @@ -40,18 +40,35 @@ typedef std::vector::const_iterator MooseEnumIterator; class MultiMooseEnum : public MooseEnumBase { public: + ///@{ /** - * Constructor that takes a list of enumeration values, and a separate string to set a default for - * this instance + * Constructor that takes a list of valid enumeration values, and a separate string to set default + * values for this instance * @param valid_names - a list of all possible values (names) for this enumeration - * @param initialization_values - the value(s), if any, to set this enumeration instance to + * @param initialization_values - the value(s) to set this enumeration instance to * @param allow_out_of_range - determines whether this enumeration will accept values outside of * it's range of initially defined values, allowing for the possiblity to add additional valid * values to an object after it has been initialized. */ MultiMooseEnum(std::string valid_names, - std::string initialization_values = "", + std::string initialization_values, + bool allow_out_of_range = false); + // We need to explicitly define this version so MultiMooseEnum("one two", "one") + // doesn't implicitly convert "one" to a bool use use the 2-parameter constructor + MultiMooseEnum(std::string valid_names, + const char * initialization_values, bool allow_out_of_range = false); + ///@} + + /** + * Constructor that takes a list of valid enumeration values, and does not set this instance to + * any particular value. + * @param valid_names - a list of all possible values (names) for this enumeration + * @param allow_out_of_range - determines whether this enumeration will accept values outside of + * it's range of initially defined values, allowing for the possiblity to add additional valid + * values to an object after it has been initialized. + */ + MultiMooseEnum(std::string valid_names, bool allow_out_of_range = false); /** * Copy Constructor diff --git a/framework/src/interfaces/SetupInterface.C b/framework/src/interfaces/SetupInterface.C index 7fbbfea58da2..85b193fedba4 100644 --- a/framework/src/interfaces/SetupInterface.C +++ b/framework/src/interfaces/SetupInterface.C @@ -31,7 +31,8 @@ SetupInterface::SetupInterface(const MooseObject * moose_object) (moose_object->parameters().getCheckedPointerParam("_fe_problem_base")) ->getCurrentExecuteOnFlag()) { - _empty_execute_enum.clearSetValues(); // remove any flags for the case when "execute_on" is not used + _empty_execute_enum + .clearSetValues(); // remove any flags for the case when "execute_on" is not used } SetupInterface::~SetupInterface() {} diff --git a/framework/src/materials/ParsedMaterialHelper.C b/framework/src/materials/ParsedMaterialHelper.C index 6d39977eaec0..c664545983c5 100644 --- a/framework/src/materials/ParsedMaterialHelper.C +++ b/framework/src/materials/ParsedMaterialHelper.C @@ -41,8 +41,8 @@ ParsedMaterialHelper::ParsedMaterialHelper(const InputParameters & parame : FunctionMaterialBase(parameters), FunctionParserUtils(parameters), _symbol_names(_nargs), - _extra_symbols( - this->template getParam("extra_symbols").template getSetValueIDs()), + _extra_symbols(this->template getParam("extra_symbols") + .template getSetValueIDs()), _tol(0), _map_mode(map_mode), _upstream_mat_names(this->template getParam>("upstream_materials")), diff --git a/framework/src/utils/MultiMooseEnum.C b/framework/src/utils/MultiMooseEnum.C index 76f7343e5a66..a755d027d550 100644 --- a/framework/src/utils/MultiMooseEnum.C +++ b/framework/src/utils/MultiMooseEnum.C @@ -27,6 +27,19 @@ MultiMooseEnum::MultiMooseEnum(std::string valid_names, *this = initialization_values; } +MultiMooseEnum::MultiMooseEnum(std::string valid_names, + const char * initialization_values, + bool allow_out_of_range) + : MultiMooseEnum(valid_names, std::string(initialization_values), allow_out_of_range) +{ +} + +MultiMooseEnum::MultiMooseEnum(std::string valid_names, bool allow_out_of_range) + // Set default variable value to nothing ("") + : MultiMooseEnum(valid_names, "", allow_out_of_range) +{ +} + MultiMooseEnum::MultiMooseEnum(const MultiMooseEnum & other_enum) : MooseEnumBase(other_enum), _current_values(other_enum._current_values) { From 56b4845f5ccaf8be553c7a1c7910b71afb0511e5 Mon Sep 17 00:00:00 2001 From: Patrick Behne Date: Tue, 16 Jul 2024 20:11:09 -0600 Subject: [PATCH 05/10] Updated push_back to setAdditionalValue in geochemistry. --- modules/geochemistry/unit/src/GeochemicalSystemTest.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/geochemistry/unit/src/GeochemicalSystemTest.C b/modules/geochemistry/unit/src/GeochemicalSystemTest.C index 23f8f8130ac3..be5a0954255e 100644 --- a/modules/geochemistry/unit/src/GeochemicalSystemTest.C +++ b/modules/geochemistry/unit/src/GeochemicalSystemTest.C @@ -15,7 +15,7 @@ TEST_F(GeochemicalSystemTest, constructWithMultiMooseEnum) MultiMooseEnum constraint_user_meaning( "kg_solvent_water bulk_composition bulk_composition_with_kinetic free_concentration " "free_mineral activity log10activity fugacity log10fugacity"); - constraint_user_meaning.push_back( + constraint_user_meaning.setAdditionalValue( "activity bulk_composition bulk_composition free_concentration"); MultiMooseEnum constraint_unit("dimensionless moles molal kg g mg ug kg_per_kg_solvent " "g_per_kg_solvent mg_per_kg_solvent ug_per_kg_solvent cm3"); From efee1d3a0485f6de9bf153c0baa36cc5ecbd094e Mon Sep 17 00:00:00 2001 From: Patrick Behne Date: Wed, 17 Jul 2024 08:05:03 -0600 Subject: [PATCH 06/10] Updated push_back to setAdditionalValue in geochemistry (again). --- modules/geochemistry/unit/src/GeochemicalSystemTest.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/geochemistry/unit/src/GeochemicalSystemTest.C b/modules/geochemistry/unit/src/GeochemicalSystemTest.C index be5a0954255e..c8d44baf9175 100644 --- a/modules/geochemistry/unit/src/GeochemicalSystemTest.C +++ b/modules/geochemistry/unit/src/GeochemicalSystemTest.C @@ -19,7 +19,7 @@ TEST_F(GeochemicalSystemTest, constructWithMultiMooseEnum) "activity bulk_composition bulk_composition free_concentration"); MultiMooseEnum constraint_unit("dimensionless moles molal kg g mg ug kg_per_kg_solvent " "g_per_kg_solvent mg_per_kg_solvent ug_per_kg_solvent cm3"); - constraint_unit.push_back("dimensionless moles moles molal"); + constraint_unit.setAdditionalValue("dimensionless moles moles molal"); ModelGeochemicalDatabase mgd_calcite2 = _model_calcite.modelGeochemicalDatabase(); const GeochemicalSystem egs(mgd_calcite2, _ac3, From 0ac6699b83e561148484cddbd660d1e85bd1f43f Mon Sep 17 00:00:00 2001 From: Patrick Behne Date: Thu, 25 Jul 2024 15:12:06 -0600 Subject: [PATCH 07/10] Deprecated old names for renamed methods, addressed code review. --- framework/include/utils/MultiMooseEnum.h | 46 ++++++++---- framework/src/utils/MultiMooseEnum.C | 90 ++++++++++++++++++++++++ 2 files changed, 123 insertions(+), 13 deletions(-) diff --git a/framework/include/utils/MultiMooseEnum.h b/framework/include/utils/MultiMooseEnum.h index a75c6903c117..543892e19c43 100644 --- a/framework/include/utils/MultiMooseEnum.h +++ b/framework/include/utils/MultiMooseEnum.h @@ -12,6 +12,7 @@ // MOOSE includes #include "Moose.h" #include "MooseEnumBase.h" +#include "MooseError.h" // C++ includes #include @@ -47,14 +48,14 @@ class MultiMooseEnum : public MooseEnumBase * @param valid_names - a list of all possible values (names) for this enumeration * @param initialization_values - the value(s) to set this enumeration instance to * @param allow_out_of_range - determines whether this enumeration will accept values outside of - * it's range of initially defined values, allowing for the possiblity to add additional valid + * its range of initially defined values. A value of true allows the addition of valid * values to an object after it has been initialized. */ MultiMooseEnum(std::string valid_names, std::string initialization_values, bool allow_out_of_range = false); // We need to explicitly define this version so MultiMooseEnum("one two", "one") - // doesn't implicitly convert "one" to a bool use use the 2-parameter constructor + // doesn't implicitly convert "one" to a bool and use the 2-parameter constructor MultiMooseEnum(std::string valid_names, const char * initialization_values, bool allow_out_of_range = false); @@ -65,7 +66,7 @@ class MultiMooseEnum : public MooseEnumBase * any particular value. * @param valid_names - a list of all possible values (names) for this enumeration * @param allow_out_of_range - determines whether this enumeration will accept values outside of - * it's range of initially defined values, allowing for the possiblity to add additional valid + * its range of initially defined values. A value of true allows the addition of valid * values to an object after it has been initialized. */ MultiMooseEnum(std::string valid_names, bool allow_out_of_range = false); @@ -124,6 +125,9 @@ class MultiMooseEnum : public MooseEnumBase void eraseSetValue(const std::string & names); void eraseSetValue(const std::vector & names); void eraseSetValue(const std::set & names); + void erase(const std::string & names); + void erase(const std::vector & names); + void erase(const std::set & names); ///@} ///@{ @@ -137,6 +141,10 @@ class MultiMooseEnum : public MooseEnumBase void setAdditionalValue(const std::vector & names); void setAdditionalValue(const std::set & names); void setAdditionalValue(const MultiMooseEnum & other_enum); + void push_back(const std::string & names); + void push_back(const std::vector & names); + void push_back(const std::set & names); + void push_back(const MultiMooseEnum & other_enum); ///@} /** @@ -156,9 +164,13 @@ class MultiMooseEnum : public MooseEnumBase */ unsigned int get(unsigned int i) const; + ///@{ /// get the current values cast to a vector of enum type T template std::vector getSetValueIDs() const; + template + std::vector getEnum() const; + ///@} ///@{ /** @@ -169,10 +181,13 @@ class MultiMooseEnum : public MooseEnumBase MooseEnumIterator end() const { return _current_values.end(); } ///@} + ///@{ /** * Clear the MultiMooseEnum */ void clearSetValues(); + void clear(); + ///@} /** * Return the number of active items in the MultiMooseEnum @@ -192,22 +207,19 @@ class MultiMooseEnum : public MooseEnumBase /// Operator for printing to iostreams friend std::ostream & operator<<(std::ostream & out, const MultiMooseEnum & obj); - // If left enabled, the following functions would add possible values + // The following functions would add possible values // (to _items) that an enumerated variable can take. However "+=" is not a // descriptive enough funtion name for this and should not be used in case // users get confused that the operator actually changes the set values of the - // variable (_current_values). We should re-implement this logic under a method - // with a more descirptive name to force users to be informed. - MooseEnumBase & operator+=(const std::string & name) = delete; - MooseEnumBase & operator+=(const std::initializer_list & names) = delete; + // variable (_current_values). We have re-implemented this logic under a method + // with a more descirptive name to force users to be informed. These are deprecated. + MooseEnumBase & operator+=(const std::string & name); + MooseEnumBase & operator+=(const std::initializer_list & names); // The following replaces operator+= with a more descriptive name /// Extends the range of possible values the variable can be set to - MooseEnumBase & addValidName(const std::string & name) { return MooseEnumBase::operator+=(name); } - MooseEnumBase & addValidName(const std::initializer_list & names) - { - return MooseEnumBase::operator+=(names); - } + void addValidName(const std::string & name); + void addValidName(const std::initializer_list & names); protected: /// Check whether any of the current values are deprecated when called @@ -257,3 +269,11 @@ MultiMooseEnum::getSetValueIDs() const enum_vec.push_back(static_cast(current_value.id())); return enum_vec; } + +template +std::vector +MultiMooseEnum::getEnum() const +{ + mooseDeprecated("MultiMooseEnum::getEnum is deprecated, use MultiMooseEnum::getSetValueIDs"); + return MultiMooseEnum::getSetValueIDs(); +} diff --git a/framework/src/utils/MultiMooseEnum.C b/framework/src/utils/MultiMooseEnum.C index a755d027d550..92efce728739 100644 --- a/framework/src/utils/MultiMooseEnum.C +++ b/framework/src/utils/MultiMooseEnum.C @@ -7,11 +7,13 @@ //* Licensed under LGPL 2.1, please see LICENSE for details //* https://www.gnu.org/licenses/lgpl-2.1.html +#include "MooseEnumBase.h" #include "MultiMooseEnum.h" #include "MooseUtils.h" #include "MooseError.h" #include "Conversion.h" +#include #include #include #include @@ -143,18 +145,39 @@ MultiMooseEnum::eraseSetValue(const std::string & names) removeSetValues(names_vector.begin(), names_vector.end()); } +void +MultiMooseEnum::erase(const std::string & names) +{ + mooseDeprecated("MultiMooseEnum::erase is deprecated, use MultiMooseEnum::eraseSetValue"); + MultiMooseEnum::erase(names); +} + void MultiMooseEnum::eraseSetValue(const std::vector & names) { removeSetValues(names.begin(), names.end()); } +void +MultiMooseEnum::erase(const std::vector & names) +{ + mooseDeprecated("MultiMooseEnum::erase is deprecated, use MultiMooseEnum::eraseSetValue"); + MultiMooseEnum::erase(names); +} + void MultiMooseEnum::eraseSetValue(const std::set & names) { removeSetValues(names.begin(), names.end()); } +void +MultiMooseEnum::erase(const std::set & names) +{ + mooseDeprecated("MultiMooseEnum::erase is deprecated, use MultiMooseEnum::eraseSetValue"); + MultiMooseEnum::erase(names); +} + void MultiMooseEnum::setAdditionalValue(const std::string & names) { @@ -163,24 +186,56 @@ MultiMooseEnum::setAdditionalValue(const std::string & names) assignValues(names_vector.begin(), names_vector.end(), true); } +void +MultiMooseEnum::push_back(const std::string & names) +{ + mooseDeprecated( + "MultiMooseEnum::push_back is deprecated, use MultiMooseEnum::setAdditionalValue"); + MultiMooseEnum::setAdditionalValue(names); +} + void MultiMooseEnum::setAdditionalValue(const std::vector & names) { assignValues(names.begin(), names.end(), true); } +void +MultiMooseEnum::push_back(const std::vector & names) +{ + mooseDeprecated( + "MultiMooseEnum::push_back is deprecated, use MultiMooseEnum::setAdditionalValue"); + MultiMooseEnum::setAdditionalValue(names); +} + void MultiMooseEnum::setAdditionalValue(const std::set & names) { assignValues(names.begin(), names.end(), true); } +void +MultiMooseEnum::push_back(const std::set & names) +{ + mooseDeprecated( + "MultiMooseEnum::push_back is deprecated, use MultiMooseEnum::setAdditionalValue"); + MultiMooseEnum::setAdditionalValue(names); +} + void MultiMooseEnum::setAdditionalValue(const MultiMooseEnum & other_enum) { assignValues(other_enum.begin(), other_enum.end(), true); } +void +MultiMooseEnum::push_back(const MultiMooseEnum & other_enum) +{ + mooseDeprecated( + "MultiMooseEnum::push_back is deprecated, use MultiMooseEnum::setAdditionalValue"); + MultiMooseEnum::setAdditionalValue(other_enum); +} + const std::string & MultiMooseEnum::operator[](unsigned int i) const { @@ -255,6 +310,13 @@ MultiMooseEnum::clearSetValues() _current_values.clear(); } +void +MultiMooseEnum::clear() +{ + mooseDeprecated("MultiMooseEnum::clear is deprecated, use MultiMooseEnum::clearSetValues"); + clearSetValues(); +} + unsigned int MultiMooseEnum::size() const { @@ -274,3 +336,31 @@ operator<<(std::ostream & out, const MultiMooseEnum & obj) out << Moose::stringify(obj._current_values, " "); return out; } + +void +MultiMooseEnum::addValidName(const std::string & name) +{ + addEnumerationName(name); + checkDeprecated(); +} + +MooseEnumBase & +MultiMooseEnum::operator+=(const std::string & name) +{ + mooseDeprecated("MultiMooseEnum::operator+= is deprecated, use MultiMooseEnum::addValidName"); + return MooseEnumBase::operator+=(name); +} + +void +MultiMooseEnum::addValidName(const std::initializer_list & names) +{ + for (const auto & name : names) + addValidName(name); +} + +MooseEnumBase & +MultiMooseEnum::operator+=(const std::initializer_list & names) +{ + mooseDeprecated("MultiMooseEnum::operator+= is deprecated, use MultiMooseEnum::addValidName"); + return MooseEnumBase::operator+=(names); +} From 8e38003767022df36163a2296e599e4395174131 Mon Sep 17 00:00:00 2001 From: Patrick Behne Date: Thu, 25 Jul 2024 15:44:14 -0600 Subject: [PATCH 08/10] Renamed MultiMooseEnum::contains -> MultiMooseEnum::isValueSet --- framework/include/auxkernels/TagAuxBase.h | 2 +- framework/include/outputs/AdvancedOutput.h | 2 +- framework/include/reporters/IterationInfo.h | 2 +- framework/include/reporters/MeshInfo.h | 5 +- framework/include/utils/MultiMooseEnum.h | 5 ++ .../src/executioners/EigenExecutionerBase.C | 10 ++-- framework/src/executioners/Eigenvalue.C | 2 +- .../src/ics/IntegralPreservingFunctionIC.C | 2 +- framework/src/outputs/AdvancedOutput.C | 26 +++++----- framework/src/outputs/CSV.C | 6 +-- framework/src/outputs/Console.C | 24 ++++----- framework/src/outputs/JSONOutput.C | 4 +- framework/src/outputs/Output.C | 2 +- framework/src/outputs/PerfGraphOutput.C | 2 +- framework/src/outputs/XMLOutput.C | 4 +- .../ChangeOverFixedPointPostprocessor.C | 4 +- .../ChangeOverTimePostprocessor.C | 4 +- framework/src/problems/FEProblemBase.C | 12 ++--- framework/src/reporters/ElementReporter.C | 2 +- framework/src/reporters/GeneralReporter.C | 2 +- framework/src/reporters/MeshInfo.C | 24 ++++----- framework/src/reporters/NodalReporter.C | 2 +- .../src/reporters/RestartableDataReporter.C | 12 ++--- .../transfers/MultiAppConservativeTransfer.C | 4 +- .../src/transfers/MultiAppReporterTransfer.C | 4 +- ...VariableValueSamplePostprocessorTransfer.C | 13 ++--- framework/src/userobjects/Terminator.C | 2 +- framework/src/utils/ExecFlagEnum.C | 2 +- framework/src/utils/MultiMooseEnum.C | 49 ++++++++++++++++--- framework/src/utils/PetscSupport.C | 4 +- .../src/postprocessors/VolumetricFlowRate.C | 2 +- .../src/userobjects/NSPressurePin.C | 2 +- .../include/reporters/OptimizationInfo.h | 2 +- .../src/executioners/OptimizeSolve.C | 8 +-- .../src/reporters/OptimizationInfo.C | 8 +-- .../userobjects/AdvectiveFluxCalculatorBase.C | 2 +- .../src/userobjects/RayTracingStudy.C | 4 +- .../src/actions/ParameterStudyAction.C | 10 ++-- .../src/controls/MultiAppSamplerControl.C | 2 +- 39 files changed, 160 insertions(+), 118 deletions(-) diff --git a/framework/include/auxkernels/TagAuxBase.h b/framework/include/auxkernels/TagAuxBase.h index 9fb50769065c..775f9637d1c1 100644 --- a/framework/include/auxkernels/TagAuxBase.h +++ b/framework/include/auxkernels/TagAuxBase.h @@ -61,7 +61,7 @@ TagAuxBase::TagAuxBase(const InputParameters & parameters) : T(parameters), _scaled(this->template getParam("scaled")) { auto & execute_on = this->template getParam("execute_on"); - if (execute_on.size() != 1 || !execute_on.contains(EXEC_TIMESTEP_END)) + if (execute_on.size() != 1 || !execute_on.isValueSet(EXEC_TIMESTEP_END)) paramError("execute_on", "must be set to EXEC_TIMESTEP_END"); } diff --git a/framework/include/outputs/AdvancedOutput.h b/framework/include/outputs/AdvancedOutput.h index 49e1d5bb2848..a13a9d01bec8 100644 --- a/framework/include/outputs/AdvancedOutput.h +++ b/framework/include/outputs/AdvancedOutput.h @@ -408,7 +408,7 @@ AdvancedOutput::initPostprocessorOrVectorPostprocessorLists(const std::string & { if (!_advanced_execute_on.contains(execute_data_name) || (_advanced_execute_on[execute_data_name].isValid() && - _advanced_execute_on[execute_data_name].contains("none"))) + _advanced_execute_on[execute_data_name].isValueSet("none"))) { const bool is_pp_type = (execute_data_name == "postprocessors"); const std::string pp_type_str = is_pp_type ? "post-processor" : "vector post-processor"; diff --git a/framework/include/reporters/IterationInfo.h b/framework/include/reporters/IterationInfo.h index ae1a463039f4..16b7771ba48e 100644 --- a/framework/include/reporters/IterationInfo.h +++ b/framework/include/reporters/IterationInfo.h @@ -50,7 +50,7 @@ template T & IterationInfo::declareHelper(const std::string & item_name, T & dummy, bool extra_check) { - return (extra_check && (!_items.isValid() || _items.contains(item_name))) + return (extra_check && (!_items.isValid() || _items.isValueSet(item_name))) ? declareValueByName(item_name, REPORTER_MODE_REPLICATED) : dummy; } diff --git a/framework/include/reporters/MeshInfo.h b/framework/include/reporters/MeshInfo.h index 55bcabbc2d0f..ec9efa1267b7 100644 --- a/framework/include/reporters/MeshInfo.h +++ b/framework/include/reporters/MeshInfo.h @@ -94,8 +94,9 @@ template T & MeshInfo::declareHelper(const std::string & item_name, const ReporterMode mode) { - return (!_items.isValid() || _items.contains(item_name)) ? declareValueByName(item_name, mode) - : declareUnusedValue(); + return (!_items.isValid() || _items.isValueSet(item_name)) + ? declareValueByName(item_name, mode) + : declareUnusedValue(); } void to_json(nlohmann::json & json, const std::map & sidesets); diff --git a/framework/include/utils/MultiMooseEnum.h b/framework/include/utils/MultiMooseEnum.h index 543892e19c43..7f520fa8d4a7 100644 --- a/framework/include/utils/MultiMooseEnum.h +++ b/framework/include/utils/MultiMooseEnum.h @@ -99,6 +99,11 @@ class MultiMooseEnum : public MooseEnumBase * Methods for seeing if a value is set in the MultiMooseEnum. * @return bool - the truth value indicating whether the value is set */ + bool isValueSet(const std::string & value) const; + bool isValueSet(int value) const; + bool isValueSet(unsigned short value) const; + bool isValueSet(const MultiMooseEnum & value) const; + bool isValueSet(const MooseEnumItem & value) const; bool contains(const std::string & value) const; bool contains(int value) const; bool contains(unsigned short value) const; diff --git a/framework/src/executioners/EigenExecutionerBase.C b/framework/src/executioners/EigenExecutionerBase.C index 873805d0314d..faef76e1b853 100644 --- a/framework/src/executioners/EigenExecutionerBase.C +++ b/framework/src/executioners/EigenExecutionerBase.C @@ -101,7 +101,7 @@ EigenExecutionerBase::init() // check when the postprocessors are evaluated const ExecFlagEnum & bx_exec = _problem.getUserObject(getParam("bx_norm")).getExecuteOnEnum(); - if (!bx_exec.contains(EXEC_LINEAR)) + if (!bx_exec.isValueSet(EXEC_LINEAR)) mooseError("Postprocessor " + getParam("bx_norm") + " requires execute_on = 'linear'"); @@ -112,7 +112,7 @@ EigenExecutionerBase::init() _norm_exec = bx_exec; // check if _source_integral has been evaluated during initialSetup() - if (!bx_exec.contains(EXEC_INITIAL)) + if (!bx_exec.isValueSet(EXEC_INITIAL)) _problem.execute(EXEC_LINEAR); if (_source_integral == 0.0) @@ -185,7 +185,7 @@ EigenExecutionerBase::inversePowerIteration(unsigned int min_iter, { solution_diff = &_problem.getPostprocessorValueByName(xdiff); const ExecFlagEnum & xdiff_exec = _problem.getUserObject(xdiff).getExecuteOnEnum(); - if (!xdiff_exec.contains(EXEC_LINEAR)) + if (!xdiff_exec.isValueSet(EXEC_LINEAR)) mooseError("Postprocessor " + xdiff + " requires execute_on = 'linear'"); } @@ -391,14 +391,14 @@ EigenExecutionerBase::postExecute() } Real s = 1.0; - if (_norm_exec.contains(EXEC_CUSTOM)) + if (_norm_exec.isValueSet(EXEC_CUSTOM)) { _console << " Cannot let the normalization postprocessor on custom.\n"; _console << " Normalization is abandoned!" << std::endl; } else { - bool force = _norm_exec.contains(EXEC_TIMESTEP_END) || _norm_exec.contains(EXEC_LINEAR); + bool force = _norm_exec.isValueSet(EXEC_TIMESTEP_END) || _norm_exec.isValueSet(EXEC_LINEAR); s = normalizeSolution(force); if (!MooseUtils::absoluteFuzzyEqual(s, 1.0)) _console << " Solution is rescaled with factor " << s << " for normalization!" << std::endl; diff --git a/framework/src/executioners/Eigenvalue.C b/framework/src/executioners/Eigenvalue.C index 7133be2f8124..cf2634dd9080 100644 --- a/framework/src/executioners/Eigenvalue.C +++ b/framework/src/executioners/Eigenvalue.C @@ -156,7 +156,7 @@ Eigenvalue::init() { const auto & normpp = getParam("normalization"); const auto & exec = _eigen_problem.getUserObject(normpp).getExecuteOnEnum(); - if (!exec.contains(EXEC_LINEAR)) + if (!exec.isValueSet(EXEC_LINEAR)) mooseError("Normalization postprocessor ", normpp, " requires execute_on = 'linear'"); } diff --git a/framework/src/ics/IntegralPreservingFunctionIC.C b/framework/src/ics/IntegralPreservingFunctionIC.C index 0a0b565ae561..ffc1ebe861f1 100644 --- a/framework/src/ics/IntegralPreservingFunctionIC.C +++ b/framework/src/ics/IntegralPreservingFunctionIC.C @@ -37,7 +37,7 @@ void IntegralPreservingFunctionIC::initialSetup() { const UserObject & pp = _fe_problem.getUserObject(_pp_name); - if (!pp.getExecuteOnEnum().contains(EXEC_INITIAL)) + if (!pp.getExecuteOnEnum().isValueSet(EXEC_INITIAL)) mooseError("The 'execute_on' parameter for the '" + _pp_name + "' postprocessor must include 'initial'!"); } diff --git a/framework/src/outputs/AdvancedOutput.C b/framework/src/outputs/AdvancedOutput.C index b8b77960d141..3898acf0ef9a 100644 --- a/framework/src/outputs/AdvancedOutput.C +++ b/framework/src/outputs/AdvancedOutput.C @@ -338,7 +338,7 @@ AdvancedOutput::wantOutput(const std::string & name, const ExecFlagType & type) return false; // Do not output if the 'none' is contained by the execute_on - if (_advanced_execute_on.contains(name) && _advanced_execute_on[name].contains("none")) + if (_advanced_execute_on.contains(name) && _advanced_execute_on[name].isValueSet("none")) return false; // Data output flag, true if data exists to be output @@ -362,7 +362,7 @@ AdvancedOutput::wantOutput(const std::string & name, const ExecFlagType & type) // (2) The current output type is contained in the list of output execution types // (3) The current execution time is "final" or "forced" and the data has not already been // output - if (execute_data_flag && _advanced_execute_on[name].contains(type) && + if (execute_data_flag && _advanced_execute_on[name].isValueSet(type) && !(type == EXEC_FINAL && _last_execute_time[name] == _time)) return true; else @@ -687,7 +687,7 @@ AdvancedOutput::addValidParams(InputParameters & params, const MultiMooseEnum & empty_execute_on.addAvailableFlags(EXEC_FAILED); // Nodal output - if (types.contains("nodal")) + if (types.isValueSet("nodal")) { params.addParam( "execute_nodal_on", empty_execute_on, "Control the output of nodal variables"); @@ -695,7 +695,7 @@ AdvancedOutput::addValidParams(InputParameters & params, const MultiMooseEnum & } // Elemental output - if (types.contains("elemental")) + if (types.isValueSet("elemental")) { params.addParam( "execute_elemental_on", empty_execute_on, "Control the output of elemental variables"); @@ -722,7 +722,7 @@ AdvancedOutput::addValidParams(InputParameters & params, const MultiMooseEnum & } // Scalar variable output - if (types.contains("scalar")) + if (types.isValueSet("scalar")) { params.addParam( "execute_scalars_on", empty_execute_on, "Control the output of scalar variables"); @@ -730,14 +730,14 @@ AdvancedOutput::addValidParams(InputParameters & params, const MultiMooseEnum & } // Nodal and scalar output - if (types.contains("nodal") && types.contains("scalar")) + if (types.isValueSet("nodal") && types.isValueSet("scalar")) { params.addParam("scalar_as_nodal", false, "Output scalar variables as nodal"); params.addParamNamesToGroup("scalar_as_nodal", "Conversions before output"); } // Elemental and nodal - if (types.contains("elemental") && types.contains("nodal")) + if (types.isValueSet("elemental") && types.isValueSet("nodal")) { params.addParam( "elemental_as_nodal", false, "Output elemental nonlinear variables as nodal"); @@ -745,7 +745,7 @@ AdvancedOutput::addValidParams(InputParameters & params, const MultiMooseEnum & } // Postprocessors - if (types.contains("postprocessor")) + if (types.isValueSet("postprocessor")) { params.addParam( "execute_postprocessors_on", empty_execute_on, "Control of when postprocessors are output"); @@ -753,7 +753,7 @@ AdvancedOutput::addValidParams(InputParameters & params, const MultiMooseEnum & } // Vector Postprocessors - if (types.contains("vector_postprocessor")) + if (types.isValueSet("vector_postprocessor")) { params.addParam("execute_vector_postprocessors_on", empty_execute_on, @@ -763,7 +763,7 @@ AdvancedOutput::addValidParams(InputParameters & params, const MultiMooseEnum & } // Reporters - if (types.contains("reporter")) + if (types.isValueSet("reporter")) { params.addParam( "execute_reporters_on", empty_execute_on, "Control of when Reporter values are output"); @@ -771,7 +771,7 @@ AdvancedOutput::addValidParams(InputParameters & params, const MultiMooseEnum & } // Input file - if (types.contains("input")) + if (types.isValueSet("input")) { params.addParam( "execute_input_on", empty_execute_on, "Enable/disable the output of the input file"); @@ -779,7 +779,7 @@ AdvancedOutput::addValidParams(InputParameters & params, const MultiMooseEnum & } // System Information - if (types.contains("system_information")) + if (types.isValueSet("system_information")) { params.addParam("execute_system_information_on", empty_execute_on, @@ -792,7 +792,7 @@ bool AdvancedOutput::hasOutputHelper(const std::string & name) { return !_execute_data[name].output.empty() && _advanced_execute_on.contains(name) && - _advanced_execute_on[name].isValid() && !_advanced_execute_on[name].contains("none"); + _advanced_execute_on[name].isValid() && !_advanced_execute_on[name].isValueSet("none"); } bool diff --git a/framework/src/outputs/CSV.C b/framework/src/outputs/CSV.C index 0fddd6748917..de8a598da070 100644 --- a/framework/src/outputs/CSV.C +++ b/framework/src/outputs/CSV.C @@ -102,9 +102,9 @@ CSV::initialSetup() const auto n_pps = getPostprocessorOutput().size(); const auto n_scalars = getScalarOutput().size(); const auto n_reporters = getReporterOutput().size(); - const bool pp_active = n_pps > 0 && !pp_execute_on.contains(EXEC_NONE); - const bool scalar_active = n_scalars > 0 && !scalar_execute_on.contains(EXEC_NONE); - const bool reporter_active = n_reporters > 0 && !reporter_execute_on.contains(EXEC_NONE); + const bool pp_active = n_pps > 0 && !pp_execute_on.isValueSet(EXEC_NONE); + const bool scalar_active = n_scalars > 0 && !scalar_execute_on.isValueSet(EXEC_NONE); + const bool reporter_active = n_reporters > 0 && !reporter_execute_on.isValueSet(EXEC_NONE); if ((pp_execute_on != scalar_execute_on && pp_active && scalar_active) || (pp_execute_on != reporter_execute_on && pp_active && reporter_active)) mooseError("The parameters 'execute_postprocessors_on', 'execute_scalars_on', and " diff --git a/framework/src/outputs/Console.C b/framework/src/outputs/Console.C index ca5bea846e03..fadcbd9d2c12 100644 --- a/framework/src/outputs/Console.C +++ b/framework/src/outputs/Console.C @@ -289,7 +289,7 @@ Console::initialSetup() // If the user adds "final" to the execute on, append this to the postprocessors, scalars, etc., // but only // if the parameter (e.g., postprocessor_execute_on) has not been modified by the user. - if (_execute_on.contains("final")) + if (_execute_on.isValueSet("final")) { if (!_pars.isParamSetByUser("postprocessor_execute_on")) _advanced_execute_on["postprocessors"].setAdditionalValue("final"); @@ -342,16 +342,16 @@ Console::output() // Write the timestep information ("Time Step 0 ..."), this is controlled with "execute_on" // We only write the initial and final here. All of the intermediate outputs will be written // through timestepSetup. - if (type == EXEC_INITIAL && _execute_on.contains(EXEC_INITIAL)) + if (type == EXEC_INITIAL && _execute_on.isValueSet(EXEC_INITIAL)) writeTimestepInformation(/*output_dt = */ false); - else if (type == EXEC_FINAL && _execute_on.contains(EXEC_FINAL)) + else if (type == EXEC_FINAL && _execute_on.isValueSet(EXEC_FINAL)) { if (wantOutput("postprocessors", type) || wantOutput("scalars", type)) _console << "\nFINAL:\n"; } // Print Non-linear Residual (control with "execute_on") - if (type == EXEC_NONLINEAR && _execute_on.contains(EXEC_NONLINEAR)) + if (type == EXEC_NONLINEAR && _execute_on.isValueSet(EXEC_NONLINEAR)) { if (_nonlinear_iter == 0) _old_nonlinear_norm = std::numeric_limits::max(); @@ -363,7 +363,7 @@ Console::output() } // Print Linear Residual (control with "execute_on") - else if (type == EXEC_LINEAR && _execute_on.contains(EXEC_LINEAR)) + else if (type == EXEC_LINEAR && _execute_on.isValueSet(EXEC_LINEAR)) { if (_linear_iter == 0) _old_linear_norm = std::numeric_limits::max(); @@ -698,13 +698,13 @@ Console::outputSystemInformation() if (_app.multiAppNumber() > 0) return; - if (_system_info_flags.contains("framework")) + if (_system_info_flags.isValueSet("framework")) _console << ConsoleUtils::outputFrameworkInformation(_app); - if (_system_info_flags.contains("mesh")) + if (_system_info_flags.isValueSet("mesh")) _console << ConsoleUtils::outputMeshInformation(*_problem_ptr); - if (_system_info_flags.contains("nonlinear")) + if (_system_info_flags.isValueSet("nonlinear")) { for (const auto i : make_range(_problem_ptr->numNonlinearSystems())) { @@ -717,24 +717,24 @@ Console::outputSystemInformation() } } - if (_system_info_flags.contains("aux")) + if (_system_info_flags.isValueSet("aux")) { std::string output = ConsoleUtils::outputAuxiliarySystemInformation(*_problem_ptr); if (!output.empty()) _console << "Auxiliary System:\n" << output; } - if (_system_info_flags.contains("relationship")) + if (_system_info_flags.isValueSet("relationship")) { std::string output = ConsoleUtils::outputRelationshipManagerInformation(_app); if (!output.empty()) _console << "Relationship Managers:\n" << output; } - if (_system_info_flags.contains("execution")) + if (_system_info_flags.isValueSet("execution")) _console << ConsoleUtils::outputExecutionInformation(_app, *_problem_ptr); - if (_system_info_flags.contains("output")) + if (_system_info_flags.isValueSet("output")) _console << ConsoleUtils::outputOutputInformation(_app); // Output the legacy flags, these cannot be turned off so they become annoying to people. diff --git a/framework/src/outputs/JSONOutput.C b/framework/src/outputs/JSONOutput.C index e23fb865a803..8f3820fa0e56 100644 --- a/framework/src/outputs/JSONOutput.C +++ b/framework/src/outputs/JSONOutput.C @@ -98,9 +98,9 @@ JSONOutput::outputReporters() // Add time/iteration information current_node["time"] = _problem_ptr->time(); current_node["time_step"] = _problem_ptr->timeStep(); - if (_execute_enum.contains(EXEC_LINEAR) && !_on_nonlinear_residual) + if (_execute_enum.isValueSet(EXEC_LINEAR) && !_on_nonlinear_residual) current_node["linear_iteration"] = _linear_iter; - if (_execute_enum.contains(EXEC_NONLINEAR)) + if (_execute_enum.isValueSet(EXEC_NONLINEAR)) current_node["nonlinear_iteration"] = _nonlinear_iter; // Inject processor info diff --git a/framework/src/outputs/Output.C b/framework/src/outputs/Output.C index 2b05db9ac3dc..8f740d733121 100644 --- a/framework/src/outputs/Output.C +++ b/framework/src/outputs/Output.C @@ -276,7 +276,7 @@ Output::outputStep(const ExecFlagType & type) bool Output::shouldOutput() { - if (_execute_on.contains(_current_execute_flag) || _current_execute_flag == EXEC_FORCED) + if (_execute_on.isValueSet(_current_execute_flag) || _current_execute_flag == EXEC_FORCED) return true; return false; } diff --git a/framework/src/outputs/PerfGraphOutput.C b/framework/src/outputs/PerfGraphOutput.C index 85cd42762eb7..34b7d823b4f4 100644 --- a/framework/src/outputs/PerfGraphOutput.C +++ b/framework/src/outputs/PerfGraphOutput.C @@ -61,7 +61,7 @@ bool PerfGraphOutput::shouldOutput() { // We don't want the Perflog to get dumped at odd times. Ignore the FORCED flag. - return _execute_on.contains(_current_execute_flag); + return _execute_on.isValueSet(_current_execute_flag); } void diff --git a/framework/src/outputs/XMLOutput.C b/framework/src/outputs/XMLOutput.C index 1a729c0ed558..92a98de41de2 100644 --- a/framework/src/outputs/XMLOutput.C +++ b/framework/src/outputs/XMLOutput.C @@ -54,9 +54,9 @@ XMLOutput::outputVectorPostprocessors() // is not required. vec_node.append_attribute("time") = _problem_ptr->time(); vec_node.append_attribute("timestep") = _problem_ptr->timeStep(); - if (_execute_enum.contains(EXEC_LINEAR) && !_on_nonlinear_residual) + if (_execute_enum.isValueSet(EXEC_LINEAR) && !_on_nonlinear_residual) vec_node.append_attribute("linear_iteration") = _linear_iter; - if (_execute_enum.contains(EXEC_NONLINEAR)) + if (_execute_enum.isValueSet(EXEC_NONLINEAR)) vec_node.append_attribute("nonlinear_iteration") = _nonlinear_iter; // The VPP objects to be output diff --git a/framework/src/postprocessors/ChangeOverFixedPointPostprocessor.C b/framework/src/postprocessors/ChangeOverFixedPointPostprocessor.C index 222b765dbcba..047aa0f80b55 100644 --- a/framework/src/postprocessors/ChangeOverFixedPointPostprocessor.C +++ b/framework/src/postprocessors/ChangeOverFixedPointPostprocessor.C @@ -50,13 +50,13 @@ ChangeOverFixedPointPostprocessor::ChangeOverFixedPointPostprocessor( // ensure dependent post-processor is executed on initial const PostprocessorName & pp_name = getParam("postprocessor"); const UserObject & pp = _fe_problem.getUserObject(pp_name); - if (!pp.getExecuteOnEnum().contains(EXEC_INITIAL)) + if (!pp.getExecuteOnEnum().isValueSet(EXEC_INITIAL)) mooseError("When 'change_with_respect_to_initial' is specified to be true, 'execute_on' for " "the dependent post-processor ('" + pp_name + "') must include 'initial'"); // ensure THIS post-processor is executed on initial - if (!_execute_enum.contains(EXEC_INITIAL)) + if (!_execute_enum.isValueSet(EXEC_INITIAL)) mooseError("When 'change_with_respect_to_initial' is specified to be true, 'execute_on' for " "the ChangeOverFixedPointPostprocessor ('" + name() + "') must include 'initial'"); diff --git a/framework/src/postprocessors/ChangeOverTimePostprocessor.C b/framework/src/postprocessors/ChangeOverTimePostprocessor.C index 7233a6463a33..14300877949d 100644 --- a/framework/src/postprocessors/ChangeOverTimePostprocessor.C +++ b/framework/src/postprocessors/ChangeOverTimePostprocessor.C @@ -45,13 +45,13 @@ ChangeOverTimePostprocessor::ChangeOverTimePostprocessor(const InputParameters & // ensure dependent post-processor is executed on initial const PostprocessorName & pp_name = getParam("postprocessor"); const UserObject & pp = _fe_problem.getUserObject(pp_name); - if (!pp.getExecuteOnEnum().contains(EXEC_INITIAL)) + if (!pp.getExecuteOnEnum().isValueSet(EXEC_INITIAL)) mooseError("When 'change_with_respect_to_initial' is specified to be true, 'execute_on' for " "the dependent post-processor ('" + pp_name + "') must include 'initial'"); // ensure THIS post-processor is executed on initial - if (!_execute_enum.contains(EXEC_INITIAL)) + if (!_execute_enum.isValueSet(EXEC_INITIAL)) mooseError("When 'change_with_respect_to_initial' is specified to be true, 'execute_on' for " "the ChangeOverTimePostprocessor ('" + name() + "') must include 'initial'"); diff --git a/framework/src/problems/FEProblemBase.C b/framework/src/problems/FEProblemBase.C index b024a6918396..d73a2a00cd63 100644 --- a/framework/src/problems/FEProblemBase.C +++ b/framework/src/problems/FEProblemBase.C @@ -5288,7 +5288,7 @@ FEProblemBase::addTransfer(const std::string & transfer_name, // flag so the set by user flag is not reset, calling set with the true flag causes the set // by user status to be reset, which should only be done if the EXEC_SAME_AS_MULTIAPP is // being applied to the object. - if (parameters.get("execute_on").contains(EXEC_SAME_AS_MULTIAPP)) + if (parameters.get("execute_on").isValueSet(EXEC_SAME_AS_MULTIAPP)) { ExecFlagEnum & exec_enum = parameters.set("execute_on", true); std::shared_ptr multiapp; @@ -5314,11 +5314,11 @@ FEProblemBase::addTransfer(const std::string & transfer_name, std::dynamic_pointer_cast(transfer); if (multi_app_transfer) { - if (multi_app_transfer->directions().contains(MultiAppTransfer::TO_MULTIAPP)) + if (multi_app_transfer->directions().isValueSet(MultiAppTransfer::TO_MULTIAPP)) _to_multi_app_transfers.addObject(multi_app_transfer); - if (multi_app_transfer->directions().contains(MultiAppTransfer::FROM_MULTIAPP)) + if (multi_app_transfer->directions().isValueSet(MultiAppTransfer::FROM_MULTIAPP)) _from_multi_app_transfers.addObject(multi_app_transfer); - if (multi_app_transfer->directions().contains(MultiAppTransfer::BETWEEN_MULTIAPP)) + if (multi_app_transfer->directions().isValueSet(MultiAppTransfer::BETWEEN_MULTIAPP)) _between_multi_app_transfers.addObject(multi_app_transfer); } else @@ -8757,8 +8757,8 @@ FEProblemBase::shouldPrintExecution(const THREAD_ID tid) const if (tid != 0) return false; - if (_print_execution_on.contains(_current_execute_on_flag) || - _print_execution_on.contains(EXEC_ALWAYS)) + if (_print_execution_on.isValueSet(_current_execute_on_flag) || + _print_execution_on.isValueSet(EXEC_ALWAYS)) return true; else return false; diff --git a/framework/src/reporters/ElementReporter.C b/framework/src/reporters/ElementReporter.C index 47ad04d7e451..e034ce0a139f 100644 --- a/framework/src/reporters/ElementReporter.C +++ b/framework/src/reporters/ElementReporter.C @@ -32,5 +32,5 @@ ElementReporter::shouldStore() const { // Either we always store, or we store if the current execution flag matches // a flag that is within this ElementReporter's 'execute_on' - return _always_store || getExecuteOnEnum().contains(_fe_problem.getCurrentExecuteOnFlag()); + return _always_store || getExecuteOnEnum().isValueSet(_fe_problem.getCurrentExecuteOnFlag()); } diff --git a/framework/src/reporters/GeneralReporter.C b/framework/src/reporters/GeneralReporter.C index 6cdc664545b9..f4fc97aa9089 100644 --- a/framework/src/reporters/GeneralReporter.C +++ b/framework/src/reporters/GeneralReporter.C @@ -32,5 +32,5 @@ GeneralReporter::shouldStore() const { // Either we always store, or we store if the current execution flag matches // a flag that is within this GeneralReporter's 'execute_on' - return _always_store || getExecuteOnEnum().contains(_fe_problem.getCurrentExecuteOnFlag()); + return _always_store || getExecuteOnEnum().isValueSet(_fe_problem.getCurrentExecuteOnFlag()); } diff --git a/framework/src/reporters/MeshInfo.C b/framework/src/reporters/MeshInfo.C index 5361f16d1f14..69139a4558fd 100644 --- a/framework/src/reporters/MeshInfo.C +++ b/framework/src/reporters/MeshInfo.C @@ -118,8 +118,8 @@ MeshInfo::possiblyAddSidesetInfo() const bool include_all = !_items.isValid(); - if (include_all || _items.contains("local_sidesets") || _items.contains("local_sideset_elems") || - _items.contains("sideset_elems")) + if (include_all || _items.isValueSet("local_sidesets") || + _items.isValueSet("local_sideset_elems") || _items.isValueSet("sideset_elems")) { _local_sidesets.clear(); _local_sideset_elems.clear(); @@ -137,7 +137,7 @@ MeshInfo::possiblyAddSidesetInfo() } // For local sidesets: copy over the local info, remove the sides, and add the names - if (include_all || _items.contains("local_sidesets")) + if (include_all || _items.isValueSet("local_sidesets")) { // Copy over the local sideset info, remove the sides, and add the names _local_sidesets = sidesets; @@ -147,7 +147,7 @@ MeshInfo::possiblyAddSidesetInfo() } // For local sideset elems: copy over the local info, and add the names - if (include_all || _items.contains("local_sideset_elems")) + if (include_all || _items.isValueSet("local_sideset_elems")) { _local_sideset_elems = sidesets; sort_sides(_local_sideset_elems); @@ -155,7 +155,7 @@ MeshInfo::possiblyAddSidesetInfo() } // For the global sideset elems, we need to communicate all of the elems - if (include_all || _items.contains("sideset_elems")) + if (include_all || _items.isValueSet("sideset_elems")) { // Set up a structure for sending each (id, elem id, side) tuple to root std::map>> send_info; @@ -338,7 +338,7 @@ MeshInfo::possiblyAddSubdomainInfo() // For global subdomain information without elements, we can simplify communication. // All we need are the subdomain IDs from libMesh and then add the names (global) - if (include_all || _items.contains("subdomains")) + if (include_all || _items.isValueSet("subdomains")) { _subdomains.clear(); diff --git a/framework/src/reporters/NodalReporter.C b/framework/src/reporters/NodalReporter.C index 73eaf257cc79..67a9c405e857 100644 --- a/framework/src/reporters/NodalReporter.C +++ b/framework/src/reporters/NodalReporter.C @@ -32,5 +32,5 @@ NodalReporter::shouldStore() const { // Either we always store, or we store if the current execution flag matches // a flag that is within this NodalReporter's 'execute_on' - return _always_store || getExecuteOnEnum().contains(_fe_problem.getCurrentExecuteOnFlag()); + return _always_store || getExecuteOnEnum().isValueSet(_fe_problem.getCurrentExecuteOnFlag()); } diff --git a/framework/src/reporters/RestartableDataReporter.C b/framework/src/reporters/RestartableDataReporter.C index a1600b432ec1..287dec9a3fe7 100644 --- a/framework/src/reporters/RestartableDataReporter.C +++ b/framework/src/reporters/RestartableDataReporter.C @@ -64,13 +64,13 @@ RestartableDataReporter::getDataParams() const const auto & entries = getParam("entries"); RestartableDataValue::StoreJSONParams params; - params.value = entries.contains("value"); - params.type = entries.contains("type"); + params.value = entries.isValueSet("value"); + params.type = entries.isValueSet("type"); params.name = false; - params.declared = entries.contains("declared"); - params.loaded = entries.contains("loaded"); - params.stored = entries.contains("stored"); - params.has_context = entries.contains("has_context"); + params.declared = entries.isValueSet("declared"); + params.loaded = entries.isValueSet("loaded"); + params.stored = entries.isValueSet("stored"); + params.has_context = entries.isValueSet("has_context"); return params; } diff --git a/framework/src/transfers/MultiAppConservativeTransfer.C b/framework/src/transfers/MultiAppConservativeTransfer.C index 78b1dcf8cdd8..f2d844c7b237 100644 --- a/framework/src/transfers/MultiAppConservativeTransfer.C +++ b/framework/src/transfers/MultiAppConservativeTransfer.C @@ -171,7 +171,7 @@ MultiAppConservativeTransfer::initialSetup() auto & execute_on = parent_problem.getUserObjectBase(pp).getExecuteOnEnum(); const auto & type = parent_problem.getUserObjectBase(pp).type(); // Check if parent app has transfer execute_on - if (!execute_on.contains(EXEC_TRANSFER)) + if (!execute_on.isValueSet(EXEC_TRANSFER)) mooseError( "execute_on='transfer' is required in the conservative transfer for " + type + " '", pp, @@ -197,7 +197,7 @@ MultiAppConservativeTransfer::initialSetup() auto & execute_on = sub_problem.getUserObjectBase(sub_pp).getExecuteOnEnum(); const auto & type = sub_problem.getUserObjectBase(sub_pp).type(); // Check if sub pp has transfer execute_on - if (!execute_on.contains(EXEC_TRANSFER)) + if (!execute_on.isValueSet(EXEC_TRANSFER)) mooseError( "execute_on='transfer' is required in the conservative transfer for " + type + " '", sub_pp, diff --git a/framework/src/transfers/MultiAppReporterTransfer.C b/framework/src/transfers/MultiAppReporterTransfer.C index 1033d8e932f0..687c1f97d432 100644 --- a/framework/src/transfers/MultiAppReporterTransfer.C +++ b/framework/src/transfers/MultiAppReporterTransfer.C @@ -69,7 +69,7 @@ MultiAppReporterTransfer::MultiAppReporterTransfer(const InputParameters & param paramError( "subapp_index", "The supplied sub-application index is greater than the number of sub-applications."); - else if (_directions.contains(FROM_MULTIAPP) && + else if (_directions.isValueSet(FROM_MULTIAPP) && _subapp_index == std::numeric_limits::max() && multi_app->numGlobalApps() > 1 && !_distribute_reporter_vector) paramError("from_multi_app", @@ -95,7 +95,7 @@ MultiAppReporterTransfer::initialSetup() // that we consume a replicated version. // Find proper FEProblem FEProblemBase * problem_ptr = nullptr; - if (_directions.contains(TO_MULTIAPP)) + if (_directions.isValueSet(TO_MULTIAPP)) problem_ptr = &getToMultiApp()->problemBase(); else if (_subapp_index == std::numeric_limits::max() && getFromMultiApp()->hasLocalApp(0)) diff --git a/framework/src/transfers/MultiAppVariableValueSamplePostprocessorTransfer.C b/framework/src/transfers/MultiAppVariableValueSamplePostprocessorTransfer.C index 150a57862dcf..2ee4bb322613 100644 --- a/framework/src/transfers/MultiAppVariableValueSamplePostprocessorTransfer.C +++ b/framework/src/transfers/MultiAppVariableValueSamplePostprocessorTransfer.C @@ -68,7 +68,7 @@ MultiAppVariableValueSamplePostprocessorTransfer::MultiAppVariableValueSamplePos if (_directions.size() != 1) paramError("direction", "This transfer is only unidirectional"); - if (_directions.contains("from_multiapp")) + if (_directions.isValueSet("from_multiapp")) { // Check that the variable is a CONSTANT MONOMIAL. auto & fe_type = _var.feType(); @@ -80,7 +80,7 @@ MultiAppVariableValueSamplePostprocessorTransfer::MultiAppVariableValueSamplePos if (!_fe_problem.getAuxiliarySystem().hasVariable(_var_name)) paramError("source_variable", "Variable must be an auxiliary variable"); } - else if (_directions.contains("between_multiapp")) + else if (_directions.isValueSet("between_multiapp")) mooseError("MultiAppVariableValueSamplePostprocessorTransfer has not been made to support " "sibling transfers"); @@ -97,7 +97,7 @@ MultiAppVariableValueSamplePostprocessorTransfer::MultiAppVariableValueSamplePos void MultiAppVariableValueSamplePostprocessorTransfer::setupPostprocessorCommunication() { - if (!_directions.contains("from_multiapp")) + if (!_directions.isValueSet("from_multiapp")) return; const auto num_global_apps = getFromMultiApp()->numGlobalApps(); @@ -125,7 +125,7 @@ MultiAppVariableValueSamplePostprocessorTransfer::setupPostprocessorCommunicatio void MultiAppVariableValueSamplePostprocessorTransfer::cacheElemToPostprocessorData() { - if (!_directions.contains("from_multiapp")) + if (!_directions.isValueSet("from_multiapp")) return; // Cache the Multiapp position ID for every element. @@ -179,8 +179,9 @@ MultiAppVariableValueSamplePostprocessorTransfer::initialSetup() { MultiAppTransfer::initialSetup(); - unsigned int num_apps = _directions.contains("from_multiapp") ? getFromMultiApp()->numGlobalApps() - : getToMultiApp()->numGlobalApps(); + unsigned int num_apps = _directions.isValueSet("from_multiapp") + ? getFromMultiApp()->numGlobalApps() + : getToMultiApp()->numGlobalApps(); if (_map_comp_to_child && num_apps % _var.count() != 0) paramError("map_array_variable_components_to_child_apps", "The number of sub-applications (", diff --git a/framework/src/userobjects/Terminator.C b/framework/src/userobjects/Terminator.C index 90e49b5b7c02..85a4ce3f7da1 100644 --- a/framework/src/userobjects/Terminator.C +++ b/framework/src/userobjects/Terminator.C @@ -95,7 +95,7 @@ Terminator::initialSetup() { const auto & pp_exec = _fe_problem.getUserObjectBase(_pp_names[i], _tid).getExecuteOnEnum(); for (const auto & flag : getExecuteOnEnum()) - if (!pp_exec.contains(flag) && flag != EXEC_FINAL) + if (!pp_exec.isValueSet(flag) && flag != EXEC_FINAL) paramWarning("expression", "Postprocessor '" + _pp_names[i] + "' is not executed on " + flag.name() + ", which it really should be to serve in the criterion " diff --git a/framework/src/utils/ExecFlagEnum.C b/framework/src/utils/ExecFlagEnum.C index 23d24ae3e2f6..09574afb08af 100644 --- a/framework/src/utils/ExecFlagEnum.C +++ b/framework/src/utils/ExecFlagEnum.C @@ -29,7 +29,7 @@ ExecFlagEnum::removeAvailableFlags(const ExecFlagType & flag) flag, "' is not an available enum item for the " "MultiMooseEnum object, thus it cannot be removed."); - else if (contains(flag)) + else if (isValueSet(flag)) mooseError("The supplied item '", flag, "' is a selected item, thus it can not be removed."); _items.erase(flag); diff --git a/framework/src/utils/MultiMooseEnum.C b/framework/src/utils/MultiMooseEnum.C index 92efce728739..b07a4543e06c 100644 --- a/framework/src/utils/MultiMooseEnum.C +++ b/framework/src/utils/MultiMooseEnum.C @@ -63,7 +63,7 @@ MultiMooseEnum::operator==(const MultiMooseEnum & value) const // Return false if this enum does not contain an item from the other, since they are the same // size at this point if this is true then they are equal. - return contains(value); + return isValueSet(value); } bool @@ -73,7 +73,7 @@ MultiMooseEnum::operator!=(const MultiMooseEnum & value) const } bool -MultiMooseEnum::contains(const std::string & value) const +MultiMooseEnum::isValueSet(const std::string & value) const { return std::find_if(_current_values.begin(), _current_values.end(), @@ -82,7 +82,14 @@ MultiMooseEnum::contains(const std::string & value) const } bool -MultiMooseEnum::contains(int value) const +MultiMooseEnum::contains(const std::string & value) const +{ + mooseDeprecated("MultiMooseEnum::contains is deprecated, use MultiMooseEnum::isValueSet"); + return isValueSet(value); +} + +bool +MultiMooseEnum::isValueSet(int value) const { return std::find_if(_current_values.begin(), _current_values.end(), @@ -91,7 +98,14 @@ MultiMooseEnum::contains(int value) const } bool -MultiMooseEnum::contains(unsigned short value) const +MultiMooseEnum::contains(int value) const +{ + mooseDeprecated("MultiMooseEnum::contains is deprecated, use MultiMooseEnum::isValueSet"); + return isValueSet(value); +} + +bool +MultiMooseEnum::isValueSet(unsigned short value) const { return std::find_if(_current_values.begin(), _current_values.end(), @@ -100,16 +114,30 @@ MultiMooseEnum::contains(unsigned short value) const } bool -MultiMooseEnum::contains(const MultiMooseEnum & value) const +MultiMooseEnum::contains(unsigned short value) const +{ + mooseDeprecated("MultiMooseEnum::contains is deprecated, use MultiMooseEnum::isValueSet"); + return isValueSet(value); +} + +bool +MultiMooseEnum::isValueSet(const MultiMooseEnum & value) const { for (const auto & item : value._current_values) - if (!contains(item)) + if (!isValueSet(item)) return false; return true; } bool -MultiMooseEnum::contains(const MooseEnumItem & value) const +MultiMooseEnum::contains(const MultiMooseEnum & value) const +{ + mooseDeprecated("MultiMooseEnum::contains is deprecated, use MultiMooseEnum::isValueSet"); + return isValueSet(value); +} + +bool +MultiMooseEnum::isValueSet(const MooseEnumItem & value) const { return std::find_if(_current_values.begin(), _current_values.end(), @@ -117,6 +145,13 @@ MultiMooseEnum::contains(const MooseEnumItem & value) const { return item == value; }) != _current_values.end(); } +bool +MultiMooseEnum::contains(const MooseEnumItem & value) const +{ + mooseDeprecated("MultiMooseEnum::contains is deprecated, use MultiMooseEnum::isValueSet"); + return isValueSet(value); +} + MultiMooseEnum & MultiMooseEnum::operator=(const std::string & names) { diff --git a/framework/src/utils/PetscSupport.C b/framework/src/utils/PetscSupport.C index 7876c438cca8..ca2798fbf56d 100644 --- a/framework/src/utils/PetscSupport.C +++ b/framework/src/utils/PetscSupport.C @@ -650,7 +650,7 @@ processPetscFlags(const MultiMooseEnum & petsc_flags, PetscOptions & po) } // Update the stored items, but do not create duplicates - if (!po.flags.contains(option)) + if (!po.flags.isValueSet(option)) po.flags.setAdditionalValue(option); } } @@ -667,7 +667,7 @@ processPetscPairs(const std::vector> & pet std::make_pair(false, "-ksp_converged_reason")}}; for (auto & reason_flag : reason_flags) - if (po.flags.contains(reason_flag.second)) + if (po.flags.isValueSet(reason_flag.second)) // We register the reason option as already existing reason_flag.first = true; diff --git a/modules/navier_stokes/src/postprocessors/VolumetricFlowRate.C b/modules/navier_stokes/src/postprocessors/VolumetricFlowRate.C index 8aa253e68724..7c9220f8809d 100644 --- a/modules/navier_stokes/src/postprocessors/VolumetricFlowRate.C +++ b/modules/navier_stokes/src/postprocessors/VolumetricFlowRate.C @@ -101,7 +101,7 @@ VolumetricFlowRate::initialSetup() // - the time integrator is not ready to compute time derivatives // - the setup routine is called too early for porosity functions to be initialized // We must check that the boundaries requested are all external - if (getExecuteOnEnum().contains(EXEC_INITIAL)) + if (getExecuteOnEnum().isValueSet(EXEC_INITIAL)) for (const auto bid : boundaryIDs()) { if (!_mesh.isBoundaryFullyExternalToSubdomains(bid, _rc_uo->blockIDs())) diff --git a/modules/navier_stokes/src/userobjects/NSPressurePin.C b/modules/navier_stokes/src/userobjects/NSPressurePin.C index 0256c416c5f5..be5897ff4908 100644 --- a/modules/navier_stokes/src/userobjects/NSPressurePin.C +++ b/modules/navier_stokes/src/userobjects/NSPressurePin.C @@ -77,7 +77,7 @@ NSPressurePin::initialSetup() if (_pressure_pin_type == "average" && !_fe_problem.getUserObjectBase(getParam("pressure_average")) .getExecuteOnEnum() - .contains(getExecuteOnEnum())) + .isValueSet(getExecuteOnEnum())) paramError("pressure_average", "Pressure average postprocessor must include the pin execute_on flags"); } diff --git a/modules/optimization/include/reporters/OptimizationInfo.h b/modules/optimization/include/reporters/OptimizationInfo.h index b31db7a5c4f8..7143606e7235 100644 --- a/modules/optimization/include/reporters/OptimizationInfo.h +++ b/modules/optimization/include/reporters/OptimizationInfo.h @@ -48,7 +48,7 @@ template T & OptimizationInfo::declareHelper(const std::string & item_name, const ReporterMode mode) { - if (!_items.isValid() || _items.contains(item_name)) + if (!_items.isValid() || _items.isValueSet(item_name)) { return declareValueByName(item_name, mode); } diff --git a/modules/optimization/src/executioners/OptimizeSolve.C b/modules/optimization/src/executioners/OptimizeSolve.C index d6e7068acef8..d70d52f99f46 100644 --- a/modules/optimization/src/executioners/OptimizeSolve.C +++ b/modules/optimization/src/executioners/OptimizeSolve.C @@ -436,7 +436,7 @@ OptimizeSolve::objectiveFunction() _problem.outputStep(OptimizationAppTypes::EXEC_FORWARD); mooseError("Forward solve multiapp failed!"); } - if (_solve_on.contains(OptimizationAppTypes::EXEC_FORWARD)) + if (_solve_on.isValueSet(OptimizationAppTypes::EXEC_FORWARD)) _inner_solve->solve(); _obj_iterate++; @@ -454,7 +454,7 @@ OptimizeSolve::gradientFunction(libMesh::PetscVector & gradient) _problem.restoreMultiApps(OptimizationAppTypes::EXEC_ADJOINT); if (!_problem.execMultiApps(OptimizationAppTypes::EXEC_ADJOINT)) mooseError("Adjoint solve multiapp failed!"); - if (_solve_on.contains(OptimizationAppTypes::EXEC_ADJOINT)) + if (_solve_on.isValueSet(OptimizationAppTypes::EXEC_ADJOINT)) _inner_solve->solve(); _grad_iterate++; @@ -480,7 +480,7 @@ OptimizeSolve::applyHessian(libMesh::PetscVector & s, libMesh::PetscVect _problem.restoreMultiApps(OptimizationAppTypes::EXEC_HOMOGENEOUS_FORWARD); if (!_problem.execMultiApps(OptimizationAppTypes::EXEC_HOMOGENEOUS_FORWARD)) mooseError("Homogeneous forward solve multiapp failed!"); - if (_solve_on.contains(OptimizationAppTypes::EXEC_HOMOGENEOUS_FORWARD)) + if (_solve_on.isValueSet(OptimizationAppTypes::EXEC_HOMOGENEOUS_FORWARD)) _inner_solve->solve(); _obj_function->setMisfitToSimulatedValues(); @@ -490,7 +490,7 @@ OptimizeSolve::applyHessian(libMesh::PetscVector & s, libMesh::PetscVect _problem.restoreMultiApps(OptimizationAppTypes::EXEC_ADJOINT); if (!_problem.execMultiApps(OptimizationAppTypes::EXEC_ADJOINT)) mooseError("Adjoint solve multiapp failed!"); - if (_solve_on.contains(OptimizationAppTypes::EXEC_ADJOINT)) + if (_solve_on.isValueSet(OptimizationAppTypes::EXEC_ADJOINT)) _inner_solve->solve(); _obj_function->computeGradient(Hs); diff --git a/modules/optimization/src/reporters/OptimizationInfo.C b/modules/optimization/src/reporters/OptimizationInfo.C index d1fcfe3d2d56..3200e2e34676 100644 --- a/modules/optimization/src/reporters/OptimizationInfo.C +++ b/modules/optimization/src/reporters/OptimizationInfo.C @@ -38,19 +38,19 @@ OptimizationInfo::OptimizationInfo(const InputParameters & parameters) _xdiff(declareHelper>("xdiff", REPORTER_MODE_REPLICATED)), _currentIterate(declareHelper>("current_iterate", REPORTER_MODE_REPLICATED)), _objectiveIterate( - (!_items.isValid() || _items.contains("current_iterate")) + (!_items.isValid() || _items.isValueSet("current_iterate")) ? declareValueByName>("objective_iterate", REPORTER_MODE_REPLICATED) : declareUnusedValue>()), _gradientIterate( - (!_items.isValid() || _items.contains("current_iterate")) + (!_items.isValid() || _items.isValueSet("current_iterate")) ? declareValueByName>("gradient_iterate", REPORTER_MODE_REPLICATED) : declareUnusedValue>()), _hessianIterate( - (!_items.isValid() || _items.contains("current_iterate")) + (!_items.isValid() || _items.isValueSet("current_iterate")) ? declareValueByName>("hessian_iterate", REPORTER_MODE_REPLICATED) : declareUnusedValue>()), _functionSolves( - (!_items.isValid() || _items.contains("current_iterate")) + (!_items.isValid() || _items.isValueSet("current_iterate")) ? declareValueByName>("function_solves", REPORTER_MODE_REPLICATED) : declareUnusedValue>()) { diff --git a/modules/porous_flow/src/userobjects/AdvectiveFluxCalculatorBase.C b/modules/porous_flow/src/userobjects/AdvectiveFluxCalculatorBase.C index be0a19ca6bc4..44b185faae8b 100644 --- a/modules/porous_flow/src/userobjects/AdvectiveFluxCalculatorBase.C +++ b/modules/porous_flow/src/userobjects/AdvectiveFluxCalculatorBase.C @@ -66,7 +66,7 @@ AdvectiveFluxCalculatorBase::AdvectiveFluxCalculatorBase(const InputParameters & _pairs_to_send(), _allowable_MB_wastage(getParam("allowable_MB_wastage")) { - if (!_execute_enum.contains(EXEC_LINEAR)) + if (!_execute_enum.isValueSet(EXEC_LINEAR)) paramError( "execute_on", "The AdvectiveFluxCalculator UserObject " + name() + diff --git a/modules/ray_tracing/src/userobjects/RayTracingStudy.C b/modules/ray_tracing/src/userobjects/RayTracingStudy.C index 6daa43c450b1..609571691094 100644 --- a/modules/ray_tracing/src/userobjects/RayTracingStudy.C +++ b/modules/ray_tracing/src/userobjects/RayTracingStudy.C @@ -193,7 +193,7 @@ RayTracingStudy::RayTracingStudy(const InputParameters & parameters) } // Evaluating on residual and Jacobian evaluation - if (_execute_enum.contains(EXEC_PRE_KERNELS)) + if (_execute_enum.isValueSet(EXEC_PRE_KERNELS)) { if (_execute_enum.size() > 1) paramError("execute_on", @@ -248,7 +248,7 @@ RayTracingStudy::initialSetup() std::vector ray_kernels; getRayKernels(ray_kernels, 0); for (const auto & rkb : ray_kernels) - if (dynamic_cast(rkb) && !_execute_enum.contains(EXEC_PRE_KERNELS)) + if (dynamic_cast(rkb) && !_execute_enum.isValueSet(EXEC_PRE_KERNELS)) mooseError("This study has RayKernel objects that contribute to residuals and Jacobians.", "\nIn this case, the study must use the execute_on = PRE_KERNELS"); diff --git a/modules/stochastic_tools/src/actions/ParameterStudyAction.C b/modules/stochastic_tools/src/actions/ParameterStudyAction.C index f395a1013b1b..2d04e1020123 100644 --- a/modules/stochastic_tools/src/actions/ParameterStudyAction.C +++ b/modules/stochastic_tools/src/actions/ParameterStudyAction.C @@ -499,7 +499,7 @@ ParameterStudyAction::act() const auto & output = getParam("output_type"); // Add csv output - if (output.contains("csv")) + if (output.isValueSet("csv")) { auto params = _factory.getValidParams("CSV"); params.set("execute_on") = {EXEC_TIMESTEP_END}; @@ -509,7 +509,7 @@ ParameterStudyAction::act() } // Add json output - if (output.contains("json") || _compute_stats) + if (output.isValueSet("json") || _compute_stats) { auto params = _factory.getValidParams("JSON"); params.set("execute_on") = {EXEC_TIMESTEP_END}; @@ -556,11 +556,11 @@ ParameterStudyAction::act() // Specify output objects const auto & output_type = getParam("output_type"); auto & outputs = params.set>("outputs"); - if (output_type.contains("csv")) + if (output_type.isValueSet("csv")) outputs.push_back(outputName("csv")); - if (output_type.contains("json")) + if (output_type.isValueSet("json")) outputs.push_back(outputName("json")); - if (output_type.contains("none")) + if (output_type.isValueSet("none")) outputs = {"none"}; params.set("execute_on") = {EXEC_TIMESTEP_END}; diff --git a/modules/stochastic_tools/src/controls/MultiAppSamplerControl.C b/modules/stochastic_tools/src/controls/MultiAppSamplerControl.C index f50679e2f2f3..6d6bc07d145c 100644 --- a/modules/stochastic_tools/src/controls/MultiAppSamplerControl.C +++ b/modules/stochastic_tools/src/controls/MultiAppSamplerControl.C @@ -48,7 +48,7 @@ MultiAppSamplerControl::MultiAppSamplerControl(const InputParameters & parameter _sampler(SamplerInterface::getSampler("sampler")), _param_names(getParam>("param_names")) { - if (!_sampler.getParam("execute_on").contains(EXEC_PRE_MULTIAPP_SETUP)) + if (!_sampler.getParam("execute_on").isValueSet(EXEC_PRE_MULTIAPP_SETUP)) _sampler.paramError( "execute_on", "The sampler object, '", From c8205c81eccd551d835cec3ceff674d2e267a410 Mon Sep 17 00:00:00 2001 From: Patrick Behne Date: Sat, 27 Jul 2024 20:03:47 -0600 Subject: [PATCH 09/10] Fixed some unintensional recursive calls. --- framework/src/utils/MultiMooseEnum.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/src/utils/MultiMooseEnum.C b/framework/src/utils/MultiMooseEnum.C index b07a4543e06c..ec5d77b91bff 100644 --- a/framework/src/utils/MultiMooseEnum.C +++ b/framework/src/utils/MultiMooseEnum.C @@ -184,7 +184,7 @@ void MultiMooseEnum::erase(const std::string & names) { mooseDeprecated("MultiMooseEnum::erase is deprecated, use MultiMooseEnum::eraseSetValue"); - MultiMooseEnum::erase(names); + MultiMooseEnum::eraseSetValue(names); } void @@ -197,7 +197,7 @@ void MultiMooseEnum::erase(const std::vector & names) { mooseDeprecated("MultiMooseEnum::erase is deprecated, use MultiMooseEnum::eraseSetValue"); - MultiMooseEnum::erase(names); + MultiMooseEnum::eraseSetValue(names); } void @@ -210,7 +210,7 @@ void MultiMooseEnum::erase(const std::set & names) { mooseDeprecated("MultiMooseEnum::erase is deprecated, use MultiMooseEnum::eraseSetValue"); - MultiMooseEnum::erase(names); + MultiMooseEnum::eraseSetValue(names); } void From 8cfbdfbccf8c2b8af8ada2f5358850e1026fbaa2 Mon Sep 17 00:00:00 2001 From: Patrick Behne Date: Sat, 3 Aug 2024 12:05:09 -0600 Subject: [PATCH 10/10] Addressed code review. --- framework/include/utils/MultiMooseEnum.h | 59 +++++++++++++++++------- framework/src/utils/MultiMooseEnum.C | 35 -------------- 2 files changed, 43 insertions(+), 51 deletions(-) diff --git a/framework/include/utils/MultiMooseEnum.h b/framework/include/utils/MultiMooseEnum.h index 7f520fa8d4a7..a2dc1ea9fae1 100644 --- a/framework/include/utils/MultiMooseEnum.h +++ b/framework/include/utils/MultiMooseEnum.h @@ -94,6 +94,19 @@ class MultiMooseEnum : public MooseEnumBase bool operator!=(const MultiMooseEnum & value) const; ///@} + ///@{ + /** + * Methods for seeing if a value is set in the MultiMooseEnum. + * @return bool - the truth value indicating whether the value is set + */ + bool contains(const std::string & value) const { return isValueSet(value); } + bool contains(int value) const { return isValueSet(value); } + bool contains(unsigned short value) const { return isValueSet(value); } + bool contains(const MultiMooseEnum & value) const { return isValueSet(value); } + bool contains(const MooseEnumItem & value) const { return isValueSet(value); } + ///@} + + // The following are aliases for contains with more descriptive name ///@{ /** * Methods for seeing if a value is set in the MultiMooseEnum. @@ -104,11 +117,6 @@ class MultiMooseEnum : public MooseEnumBase bool isValueSet(unsigned short value) const; bool isValueSet(const MultiMooseEnum & value) const; bool isValueSet(const MooseEnumItem & value) const; - bool contains(const std::string & value) const; - bool contains(int value) const; - bool contains(unsigned short value) const; - bool contains(const MultiMooseEnum & value) const; - bool contains(const MooseEnumItem & value) const; ///@} ///@{ @@ -122,6 +130,17 @@ class MultiMooseEnum : public MooseEnumBase MultiMooseEnum & operator=(const std::set & names); ///@} + ///@{ + /** + * Un-assign, or unset a value. Deprecated, use eraseSetValue instead. + * @param names - a string, set, or vector giving the name to erase from the enumeration values + */ + void erase(const std::string & names); + void erase(const std::vector & names); + void erase(const std::set & names); + ///@} + + // The following replaces erase with a more descriptive name ///@{ /** * Un-assign, or unset a value @@ -130,11 +149,22 @@ class MultiMooseEnum : public MooseEnumBase void eraseSetValue(const std::string & names); void eraseSetValue(const std::vector & names); void eraseSetValue(const std::set & names); - void erase(const std::string & names); - void erase(const std::vector & names); - void erase(const std::set & names); ///@} + ///@{ + /** + * Insert operators + * Operator to insert (push_back) values into the enum. Existing values are preserved and + * duplicates are stored. Deprecated, use setAdditionalValue instead. + * @param names - a string, set, or vector representing the enumeration values to set. + */ + void push_back(const std::string & names); + void push_back(const std::vector & names); + void push_back(const std::set & names); + void push_back(const MultiMooseEnum & other_enum); + ///@} + + // The following replaces push_back with a more descriptive name ///@{ /** * Insert operators @@ -146,10 +176,6 @@ class MultiMooseEnum : public MooseEnumBase void setAdditionalValue(const std::vector & names); void setAdditionalValue(const std::set & names); void setAdditionalValue(const MultiMooseEnum & other_enum); - void push_back(const std::string & names); - void push_back(const std::vector & names); - void push_back(const std::set & names); - void push_back(const MultiMooseEnum & other_enum); ///@} /** @@ -169,13 +195,14 @@ class MultiMooseEnum : public MooseEnumBase */ unsigned int get(unsigned int i) const; - ///@{ + /// get the current values cast to a vector of enum type T. Deprecated, use getSetValueIDs instead. + template + std::vector getEnum() const; + + // The following replaces getEnum with a more descriptive name /// get the current values cast to a vector of enum type T template std::vector getSetValueIDs() const; - template - std::vector getEnum() const; - ///@} ///@{ /** diff --git a/framework/src/utils/MultiMooseEnum.C b/framework/src/utils/MultiMooseEnum.C index ec5d77b91bff..2818a071061d 100644 --- a/framework/src/utils/MultiMooseEnum.C +++ b/framework/src/utils/MultiMooseEnum.C @@ -81,13 +81,6 @@ MultiMooseEnum::isValueSet(const std::string & value) const { return item == value; }) != _current_values.end(); } -bool -MultiMooseEnum::contains(const std::string & value) const -{ - mooseDeprecated("MultiMooseEnum::contains is deprecated, use MultiMooseEnum::isValueSet"); - return isValueSet(value); -} - bool MultiMooseEnum::isValueSet(int value) const { @@ -97,13 +90,6 @@ MultiMooseEnum::isValueSet(int value) const { return item == value; }) != _current_values.end(); } -bool -MultiMooseEnum::contains(int value) const -{ - mooseDeprecated("MultiMooseEnum::contains is deprecated, use MultiMooseEnum::isValueSet"); - return isValueSet(value); -} - bool MultiMooseEnum::isValueSet(unsigned short value) const { @@ -113,13 +99,6 @@ MultiMooseEnum::isValueSet(unsigned short value) const { return item == value; }) != _current_values.end(); } -bool -MultiMooseEnum::contains(unsigned short value) const -{ - mooseDeprecated("MultiMooseEnum::contains is deprecated, use MultiMooseEnum::isValueSet"); - return isValueSet(value); -} - bool MultiMooseEnum::isValueSet(const MultiMooseEnum & value) const { @@ -129,13 +108,6 @@ MultiMooseEnum::isValueSet(const MultiMooseEnum & value) const return true; } -bool -MultiMooseEnum::contains(const MultiMooseEnum & value) const -{ - mooseDeprecated("MultiMooseEnum::contains is deprecated, use MultiMooseEnum::isValueSet"); - return isValueSet(value); -} - bool MultiMooseEnum::isValueSet(const MooseEnumItem & value) const { @@ -145,13 +117,6 @@ MultiMooseEnum::isValueSet(const MooseEnumItem & value) const { return item == value; }) != _current_values.end(); } -bool -MultiMooseEnum::contains(const MooseEnumItem & value) const -{ - mooseDeprecated("MultiMooseEnum::contains is deprecated, use MultiMooseEnum::isValueSet"); - return isValueSet(value); -} - MultiMooseEnum & MultiMooseEnum::operator=(const std::string & names) {