options.py

OptionsDictionary class definition.

class openmdao.util.options.DeprecatedOptionsDictionary(opt)[source]

Bases: object

The fd_option dicts got renamed to deriv_options, and much of the basic functions have changed. This object will help the user convert to the new format.

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='', lock_on_setup=False)[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]

Gets a value from this OptionsDictionary.

Returns:

object

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

items()[source]
Returns:

iterator

Iterator returning the name and option for each option.

iteritems()[source]
locked = True
remove_option(name)[source]

Removes the named option. Does nothing if the option is not found.

Args:

name : str

Name of the option to remove.