(0 comments)

MooseEnum

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.

MultiMooseEnum

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[0];  // 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 MultiMooseEnum

Currently unrated

Comments

There are currently no comments

New Comment

required

required (not published)

optional

R&D 100

Recent Blog Posts

Using our new clang-format Style

2 months, 2 weeks ago

Steady State Algorithm Change

11 months, 3 weeks ago

Making an App inherit from an App

12 months ago

Changing a published API (Deprecation)

1 year ago

DiscreteMaterial Objects

1 year, 2 months ago

Recent Posts

Archive

2017
2016
2015
2014

Tags

Authors

Feeds

RSS / Atom