options.py

OptionsDictionary class definition.

class openmdao.util.options.OptionsDictionary(read_only=True)[source]

Bases: object

A dictionary for storing options for components/drivers/solvers. It is generally used like a standard Python dictionary, except that 1) you can only set or get keys that have been registered with add_option, and 2) type is enforced

Args:

read_only : bool

If this is True, these options should not be modified at run time, and should not be printed in the docs.

.

add_option(name, value, lower=None, upper=None, values=None, desc='')[source]

Adds an option to this options dictionary.

Args:

name : str

Name of the option.

value : object

Default value for this option. The type of this value will be enforced.

lower : float, optional

Lower bounds for a float value.

upper : float, optional

Upper bounds for a float value.

values : list, optional

List of all possible values for an enumeration option.

desc : str, optional

String containing documentation of this option.

get(name, default=None)[source]
Returns:

object

The value of the named option. If not found, returns the default value that was passed in.

get_desc(name)[source]
items()[source]
Returns:

iterator

Iterator returning the name and option for each option.

iteritems()[source]