@staticmethod
    def specialize(args, gtl_map, loop_id):
        """Given ``args``, instances of some :class:`fusion.Arg` superclass,
        create and return specialized :class:`fusion.Arg` objects.

        :param args: either a single :class:`host.Arg` object or an iterator
                     (accepted: list, tuple) of :class:`host.Arg` objects.
        :gtl_map: a dict associating global maps' names to local maps' c_names.
        :param loop_id: indicates the position of the args` loop in the loop
                        chain
        """

        def convert(arg, gtl_map, loop_id):
            # Retrive local maps
            maps = as_tuple(arg.map, Map)
            c_local_maps = [None]*len(maps)
            for i, map in enumerate(maps):
                c_local_maps[i] = [None]*len(map)
                for j, m in enumerate(map):
                    c_local_maps[i][j] = gtl_map["%s%d_%d" % (m.name, i, j)]
            # Instantiate and initialize new, specialized Arg
            _arg = Arg(arg.data, arg.map, arg.idx, arg.access, arg._flatten)
            _arg._loop_position = loop_id
            _arg.position = arg.position
            _arg.indirect_position = arg.indirect_position
            _arg._c_local_maps = c_local_maps
            return _arg

        try:
            return [convert(arg, gtl_map, loop_id) for arg in args]
        except TypeError:
            return convert(args, gtl_map, loop_id)
dataset/ETHPy150Open OP2/PyOP2/pyop2/fusion.py/Arg.specialize/original