# sfepy.base.conf module

Problem description file handling.

## Notes

Short syntax: key is suffixed with ‘__<number>’ to prevent collisions with long syntax keys -> both cases can be used in a single input.

class sfepy.base.conf.ProblemConf(define_dict, funmod=None, filename=None, required=None, other=None, verbose=True, override=None, setup=True)

  Problem configuration, corresponding to an input (problem description file). It validates the input using lists of required and other keywords that have to/can appear in the input. Default keyword lists can be obtained by sfepy.base.conf.get_standard_keywords().

  ProblemConf instance is used to construct a Problem instance via Problem.from_conf(conf).

  add_missing(conf)

    Add missing values from another problem configuration.

    Missing keys/values are added also to values that are dictionaries.

    Parameters:
      conf ProblemConf instance

        The other configuration.

  edit(key, newval)
  static from_dict(dict_, funmod, required=None, other=None, verbose=True, override=None, setup=True)
  static from_file(filename, required=None, other=None, verbose=True, define_args=None, override=None, setup=True)

    Loads the problem definition from a file.

    The filename can either contain plain definitions, or it can contain the define() function, in which case it will be called to return the input definitions.

    The job of the define() function is to return a dictionary of parameters. How the dictionary is constructed is not our business, but the usual way is to simply have a function define() along these lines in the input file:

        def define():
            options = {
                'save_eig_vectors' : None,
                'eigen_solver' : 'eigen1',
            }
            region_2 = {
                'name' : 'Surface',
                'select' : 'nodes of surface',
            }
            return locals()

    Optionally, the define() function can accept additional arguments that should be defined using the define_args tuple or dictionary.

  static from_file_and_options(filename, options, required=None, other=None, verbose=True, define_args=None, setup=True)

    Utility function, a wrapper around ProblemConf.from_file() with possible override taken from options.

  static from_module(module, required=None, other=None, verbose=True, override=None, setup=True)
  get_function(name)

    Get a function object given its name.

    It can be either in ProblemConf.funmod, or a ProblemConf attribute directly.

    Parameters:
      name str or function or None

        The function name or directly the function.

    Returns:
      fun function or None

        The required function, or None if name was None.

  get_item_by_name(key, item_name)

    Return item with name item_name in configuration group given by key.

  get_raw(key=None)
  setup(define_dict=None, funmod=None, filename=None, required=None, other=None)
  transform_input()
  transform_input_trivial()

    Trivial input transformations.

  update_conf(conf)

    Update configuration by values in another problem configuration.

    Values that are dictionaries are updated in-place by `dict.update()`.

    Parameters:
      conf ProblemConf instance

        The other configuration.

  validate(required=None, other=None)

sfepy.base.conf.dict_from_options(options)

  Return a dictionary that can be used to construct/override a ProblemConf instance based on options.

  See `--conf` and `--options` options of the `simple.py` script.

sfepy.base.conf.dict_from_string(string, allow_tuple=False, free_word=False)

  Parse string and return a dictionary that can be used to construct/override a ProblemConf instance.

sfepy.base.conf.get_standard_keywords()

sfepy.base.conf.transform_conditions(adict, prefix)

sfepy.base.conf.transform_dgebcs(adict)

sfepy.base.conf.transform_dgepbcs(adict)

sfepy.base.conf.transform_ebcs(adict)

sfepy.base.conf.transform_epbcs(adict, prefix='epbc')

sfepy.base.conf.transform_fields(adict)

sfepy.base.conf.transform_functions(adict)

sfepy.base.conf.transform_ics(adict)

sfepy.base.conf.transform_integrals(adict)

sfepy.base.conf.transform_lcbcs(adict)

sfepy.base.conf.transform_materials(adict)

sfepy.base.conf.transform_regions(adict)

sfepy.base.conf.transform_solvers(adict)

sfepy.base.conf.transform_to_i_struct_1(adict)

sfepy.base.conf.transform_to_struct_01(adict)

sfepy.base.conf.transform_to_struct_1(adict)

sfepy.base.conf.transform_to_struct_10(adict)

sfepy.base.conf.transform_variables(adict)

sfepy.base.conf.tuple_to_conf(name, vals, order)

  Convert a configuration tuple vals into a Struct named name, with attribute names given in and ordered by order.

  Items in order at indices outside the length of vals are ignored.