def generate(self):

        data = []
        data.append("%s\n" % self.title)
        for i, group_name in enumerate(self.groups):

            # Groups get a '&', freeform cards don't.
            if self.cards[i]:
                data.append("&%s\n" % group_name)
            else:
                data.append("%s\n" % group_name)

            for card in self.cards[i]:

                #avoid writing 'xxx:xxx:var'
                #write 'var' instead
                card_name = card.name.split(":")[-1]

                if card.is_comment:
                    line = "  %s\n" % (card.value)

                elif isinstance(card.value, bool):
                    fstring = "  %s = " + _boolfmt(card.value) + "\n"
                    line = fstring % (card_name, card.value)

                elif isinstance(card.value, int):
                    fstring = "  %s = " + _intfmt(card.value) + "\n"
                    line = fstring % (card_name, card.value)

                elif isinstance(card.value, float):
                    fstring = "  %s = " + _floatfmt(card.value) + "\n"
                    line =  fstring % (card_name, card.value)

                elif isinstance(card.value, str):
                    fstring = "  %s = " + _strfmt(card.value) + "\n"
                    line =  fstring % (card_name, card.value)

                # Lists are mainly supported for the Enum Array
                elif isinstance(card.value, list):
                    line = "  %s = " % (card_name)
                    sep = ""
                    for val in card.value:

                        # We can have integer, real, or string lists
                        if isinstance(val, bool):
                            fmt = _boolfmt
                        elif isinstance(val, (int, int32, int64)):
                            fmt = _intfmt
                        elif isinstance(val, (float, float32, float64)):
                            fmt = _floatfmt
                        else:
                            fmt = _strfmt

                        fstring = sep + fmt(val)
                        line += fstring % val
                        sep = self.delimiter

                    line += "\n"

                elif isinstance(card.value, (ndarray)):

                    # We can have integer, real, or string arrays
                    if card.value.dtype == bool:
                        fmt = _boolfmt
                    elif card.value.dtype in (int, int32, int64):
                        fmt = _intfmt
                    elif card.value.dtype in (float, float32, float64):
                        fmt = _floatfmt
                    else:
                        fmt = _strfmt

                    # We don't need to output 0D arrays
                    if len(card.value) == 0:
                        continue

                    elif len(card.value.shape) == 1:
                        line = "  %s = " % (card_name)
                        sep = ""
                        for val in card.value:
                            fstring = "%s" + fmt(val)
                            line += fstring % (sep, val)
                            sep = self.delimiter
                        line += "\n"

                    elif len(card.value.shape) == 2:

                        line = "  "
                        for row in range(0, card.value.shape[0]):
                            line += card_name + "(1," + str(row+1) + ") ="
                            for col in range(0, card.value.shape[1]):
                                val = card.value[row, col]
                                fstring = " " + fmt(val) + "%s"
                                line += fstring % (val, self.delimiter)
                            line += "\n"

                    else:
                        raise RuntimeError("Don't know how to handle array"
                                           " of %s dimensions"
                                           % len(card.value.shape))

                else:
                    raise RuntimeError("Error generating input file. Don't"
                                       " know how to handle data in variable"
                                       " %s in group %s." % (card_name,
                                                             group_name))

                data.append(line)

            # A group with no cards is treated like a free-form entity.
            if len(self.cards[i])>0:
                data.append("%s\n" % self.terminator)


        outfile = open(self.filename, 'w')
        outfile.writelines(data)
        outfile.close()
Generates the input file. This should be called after all cards
dataset/ETHPy150Open OpenMDAO/OpenMDAO/openmdao/util/namelist_util.py/Namelist.generate