def load_model(self, rules=None, ignore=None, single_group=-1):
        """Loads the current deck into an OpenMDAO component.

        Args
        ----
        rules : dict of lists of strings, optional
             An optional dictionary of rules can be passed if the component has a
             hierarchy of variable trees for its input variables. If no rules dictionary
             is passed, ``load_model`` will attempt to find each namelist variable in the
             top level of the model hierarchy.

        ignore : list of strings, optional
             List of variable names that can safely be ignored.

        single_group : integer, optional
             Group id number to use for processing one single namelist group. Useful
             if extra processing is needed or if multiple groups have the same name.

        Returns
        -------
        tuple
             Returns a tuple containing the following values:
             (empty_groups, unlisted_groups, unlinked_vars).

             These need to be examined after calling ``load_model`` to make sure you
             loaded every variable into your model.

             empty_groups : ordereddict( integer : string )
                  Names and ID number of groups that don't have cards. This includes
                  strings found at the top level that aren't comments; these need to
                  be processed by your wrapper to determine how the information fits
                  into your component's variable hierarchy.

             unlisted_groups : ordereddict( integer : string )
                  This dictionary includes the names and ID number of groups that have
                  variables that couldn't be loaded because the group wasn't mentioned
                  in the rules dictionary.

             unlinked_vars : list
                  List of all variable names that weren't found in the component.
        """

        # We support loading a model before setup so that we can interact with it.
        if hasattr(self.comp.params, 'keys'):
            params = self.comp.params
        else:
            params = self.comp._init_params_dict

        # See Pylint W0102 for why we do this
        if not ignore:
            ignore = []

        if not self.groups:
            msg = "Input file must be read with parse_file before " \
                  "load_model can be executed."
            raise RuntimeError(msg)

        if single_group > -1:
            use_group = iteritems({single_group : self.groups[single_group]})
        else:
            use_group = enumerate(self.groups)

        empty_groups = OrderedDict()
        unlisted_groups = OrderedDict()
        unlinked_vars = []
        used_groups = []
        for i, group_name in use_group:

            # Report all groups with no cards
            if len(self.cards[i]) == 0:
                empty_groups[i] = group_name
                continue

            # If a group_name appears twice, we really don't know where to
            # stick the variables, and there are potential data overwrite
            # issues. Those cases have to be handled individually.
            if group_name in used_groups:
                unlisted_groups[i] = group_name
                continue
            else:
                used_groups.append(group_name)

            # Process the cards in this group
            for card in self.cards[i]:

                name = card.name
                value = card.value
                found = False

                if rules:

                    # If the group isn't in the rules dict, we can't handle
                    # it now. A separate function call will be required.
                    try:
                        containers = rules[group_name]
                    except __HOLE__:
                        unlisted_groups[i] = group_name
                        break

                    for container in containers:
                        # Note: FORTRAN is case-insensitive, OpenMDAO is not
                        varpath1 = "%s:%s" % (container, name)
                        varpath2 = "%s:%s" % (container, name.lower())

                        for item in [varpath1, varpath2]:
                            if item in params:
                                found = True
                                varpath = item
                                break

                else:
                    for item in [name, name.lower()]:
                        if item in params:
                            found = True
                            varpath = item
                            break

                if not found:
                    if name not in ignore and name.lower() not in ignore:
                        unlinked_vars.append(name)

                else:

                    # 1D arrays must become ndarrays
                    target = params[varpath]

                    # Variables that are passed by array are arrays.
                    # Everythign else is an object.
                    if isinstance(target, ndarray) and \
                       isinstance(value, (float, int)):
                        value = array([value])

                    if hasattr(self.comp.params, 'keys'):
                        params[varpath] = value
                    else:
                        params[varpath]['val'] = value

        return empty_groups, unlisted_groups, unlinked_vars
dataset/ETHPy150Open OpenMDAO/OpenMDAO/openmdao/util/namelist_util.py/Namelist.load_model