MooseEnums have been around for a few years in MOOSE. They are useful anytime you need to create a list of options for your custom objects. MooseEnums automatically verify that a supplied option matches an item in the list (case-insensitive). MOOSE has full support for using them with the InputParameters class as well.
MultiMooseEnums are an extension of MooseEnum. They have all the same benefits but can store multiple options. They are easy to assign to and retrieve values from for building the logic in your objects.
// Note the center argument MultiMooseEnum execute_on("residual, jacobian, timestep initial custom timestep_begin", "initial timestep", "The stage of the simulation where this object is executed"); // Reassign the Enum execute_on = "residual timestep_begin"; // Insert an item execute_on.push_back("jacobian"); // Retrieve a value std::string value = execute_on; // Index like a vector // Return the size unsigned int size = execute_on.size(); // Return the number of unique items in the Enum unsigned int unique_size = execute_on.unique_size(); // Iterate over and print the options for (MooseEnumIterator it = execute_on.begin(); it != execute_on.end(); ++it) _console << *it << '\n'; // See if a value is in the Enum if (execute_on.contains("timestep")) // Not case sensitive doSomething();
For a complete list of features see the Doxygen page for MultiMooseEnumShare on Twitter Share on Facebook