Config#

class ansys.dpf.core.config.Config(operator_name=None, config=None, server=None, spec=None)#

Represents an operator’s configuration.

You can use configurations to choose how an operator will run. This is an advanced feature for deep customization. The different options can change the way loops are done. They can also change whether the operator needs to perform checks on the input.

Parameters:
  • operator_name (str, optional) – Name of the operator. The default is None.

  • config (str, optional) – Name of the configuration. The default is None.

  • server (str, optional) – Server with the channel connected to the remote or local instance. The default is None, in which case an attempt is made to use the global server.

Examples

Create an operator configuration, instantiate the operator and run it with the configuration.

>>> from ansys.dpf import core as dpf
>>> config_add = dpf.Config("add")
>>> config_add.set_work_by_index_option(True)
>>> op = dpf.operators.math.add(config=config_add)

Modify the copy of an operator’s configuration and set it as current config of the operator.

>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.math.add()
>>> config_add = op.config
>>> config_add.set_work_by_index_option(True)
>>> op.config = config_add

Overview#

set_config_option

Change the value of a configuration option.

config_option_value

Retrieve the value for a configuration option.

config_option_documentation

Retrieve the documentation for a configuration option.

config_option_accepted_types

Retrieve accepted types for a configuration option.

config_option_default_value

Retrieve the default value for a configuration option.

options

Retrieve a list of configuration options and their values.

available_config_options

Available configuration options for the operator.

__set_config_option__

Change the value of a configuration option.

__try_get_option__

Return option associated with a given config name.

__str__

Describe the entity.

__del__

Delete this instance of config.

Import detail#

from ansys.dpf.core.config import Config

Property detail#

property Config.options#

Retrieve a list of configuration options and their values.

Returns:

List of configuration options and their values.

Return type:

list

property Config.available_config_options#

Available configuration options for the operator.

Returns:

One or more available configuration options for the operator.

Return type:

list, str

Method detail#

Config.__set_config_option__(config_value, config_name)#

Change the value of a configuration option.

Parameters:
  • config_value (bool, int, float) – Value to give to a configuration option.

  • config_name (str) – Name of the configuration option.

Config.set_config_option(config_name, config_value)#

Change the value of a configuration option.

Parameters:
  • config_value (bool, int, float) – Value to give to a configuration option.

  • config_name (str) – Name of the configuration option.

Examples

Modify the copy of an operator’s configuration and set it as current config of the operator.

>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.math.add()
>>> config_add = op.config
>>> config_add.set_config_option(config_name="work_by_index", config_value=True)
>>> op.config = config_add
Config.config_option_value(config_name)#

Retrieve the value for a configuration option.

Parameters:

config_name (str) – Name of the configuration option.

Returns:

Value for the configuration option.

Return type:

str

Config.__try_get_option__(config_name)#

Return option associated with a given config name.

Parameters:

config_name (_type_) – Name of the configuration.

Returns:

Available configuration options supported by the Operator

Return type:

ConfigSpecification

Config.config_option_documentation(config_name)#

Retrieve the documentation for a configuration option.

Parameters:

config_name (str) – Name of the configuration option.

Returns:

Documentation for the configuration option.

Return type:

str

Config.config_option_accepted_types(config_name)#

Retrieve accepted types for a configuration option.

Parameters:

config_name (str) – Name of the configuration option.

Returns:

One or more accepted types for the configuration option.

Return type:

list, str

Config.config_option_default_value(config_name)#

Retrieve the default value for a configuration option.

Returns:

Default value for the configuration option.

Return type:

str

Config.__str__()#

Describe the entity.

Returns:

Description of the entity.

Return type:

str

Config.__del__()#

Delete this instance of config.