openmdao/core/group.py
def connect(self, src_name, tgt_name, src_indices=None, flat_src_indices=None):
        """
        Connect source src_name to target tgt_name in this namespace.

        Parameters
        ----------
        src_name : str
            name of the source variable to connect
        tgt_name : str or [str, ... ] or (str, ...)
            name of the target variable(s) to connect
        src_indices : int or list of ints or tuple of ints or int ndarray or Iterable or None
            The global indices of the source variable to transfer data from.
            The shapes of the target and src_indices must match, and form of the
            entries within is determined by the value of 'flat_src_indices'.
        flat_src_indices : bool
            If True, each entry of src_indices is assumed to be an index into the
            flattened source.  Otherwise it must be a tuple or list of size equal
            to the number of dimensions of the source.
        """
        # if src_indices argument is given, it should be valid
        if isinstance(src_indices, string_types):
            if isinstance(tgt_name, string_types):
                tgt_name = [tgt_name]
            tgt_name.append(src_indices)
            raise TypeError("src_indices must be an index array, did you mean"
                            " connect('%s', %s)?" % (src_name, tgt_name))

        if isinstance(src_indices, Iterable):
            src_indices = np.atleast_1d(src_indices)

        if isinstance(src_indices, np.ndarray):
            if not np.issubdtype(src_indices.dtype, np.integer):
                raise TypeError("src_indices must contain integers, but src_indices for "
                                "connection from '%s' to '%s' is %s." %
                                (src_name, tgt_name, src_indices.dtype.type))

        # if multiple targets are given, recursively connect to each
        if not isinstance(tgt_name, string_types) and isinstance(tgt_name, Iterable):
            for name in tgt_name:
                self.connect(src_name, name, src_indices, flat_src_indices=flat_src_indices)
            return

        # target should not already be connected
        for manual_connections in [self._manual_connections, self._static_manual_connections]:
            if tgt_name in manual_connections:
                srcname = manual_connections[tgt_name][0]
                raise RuntimeError("Input '%s' is already connected to '%s'." %
                                   (tgt_name, srcname))

        # source and target should not be in the same system
        if src_name.rsplit('.', 1)[0] == tgt_name.rsplit('.', 1)[0]:
            raise RuntimeError("Output and input are in the same System for " +
                               "connection from '%s' to '%s'." % (src_name, tgt_name))

        if self._static_mode:
            manual_connections = self._static_manual_connections
        else:
            manual_connections = self._manual_connections

        manual_connections[tgt_name] = (src_name, src_indices, flat_src_indices)

        Connect source src_name to target tgt_name in this namespace.

        Parameters
        ----------
        src_name : str
            name of the source variable to connect
        tgt_name : str or [str, ... ] or (str, ...)
            name of the target variable(s) to connect
        src_indices : int or list of ints or tuple of ints or int ndarray or Iterable or None
            The global indices of the source variable to transfer data from.
            The shapes of the target and src_indices must match, and form of the
            entries within is determined by the value of 'flat_src_indices'.
        flat_src_indices : bool
            If True, each entry of src_indices is assumed to be an index into the
            flattened source.  Otherwise it must be a tuple or list of size equal
            to the number of dimensions of the source.
        
Connect source src_name to target tgt_name in this namespace.
Parameters

src_name : str
name of the source variable to connect
tgt_name : str or [str, ... ] or (str, ...)
name of the target variable(s) to connect
src_indices : int or list of ints or tuple of ints or int ndarray or Iterable or None
The global indices of the source variable to transfer data from.
The shapes of the target and src_indices must match, and form of the
entries within is determined by the value of 'flat_src_indices'.
flat_src_indices : bool
If True, each entry of src_indices is assumed to be an index into the
flattened source.  Otherwise it must be a tuple or list of size equal
to the number of dimensions of the source.
Connect source src_name to target tgt_name in this namespace . Parameters src_name : str name of the source variable to connect tgt_name : str or [ str ... ] or ( str ... ) name of the target variable ( s ) to connect src_indices : int or list of ints or tuple of ints or int ndarray or Iterable or None The global indices of the source variable to transfer data from . The shapes of the target and src_indices must match and form of the entries within is determined by the value of ' flat_src_indices ' . flat_src_indices : bool If True each entry of src_indices is assumed to be an index into the flattened source . Otherwise it must be a tuple or list of size equal to the number of dimensions of the source .
def connect(self, src_name, tgt_name, src_indices=None, flat_src_indices=None):
        if isinstance(src_indices, string_types):
            if isinstance(tgt_name, string_types):
                tgt_name = [tgt_name]
            tgt_name.append(src_indices)
            raise TypeError("src_indices must be an index array, did you mean"
                            " connect('%s', %s)?" % (src_name, tgt_name))
        if isinstance(src_indices, Iterable):
            src_indices = np.atleast_1d(src_indices)
        if isinstance(src_indices, np.ndarray):
            if not np.issubdtype(src_indices.dtype, np.integer):
                raise TypeError("src_indices must contain integers, but src_indices for "
                                "connection from '%s' to '%s' is %s." %
                                (src_name, tgt_name, src_indices.dtype.type))
        if not isinstance(tgt_name, string_types) and isinstance(tgt_name, Iterable):
            for name in tgt_name:
                self.connect(src_name, name, src_indices, flat_src_indices=flat_src_indices)
            return
        for manual_connections in [self._manual_connections, self._static_manual_connections]:
            if tgt_name in manual_connections:
                srcname = manual_connections[tgt_name][0]
                raise RuntimeError("Input '%s' is already connected to '%s'." %
                                   (tgt_name, srcname))
        if src_name.rsplit('.', 1)[0] == tgt_name.rsplit('.', 1)[0]:
            raise RuntimeError("Output and input are in the same System for " +
                               "connection from '%s' to '%s'." % (src_name, tgt_name))
        if self._static_mode:
            manual_connections = self._static_manual_connections
        else:
            manual_connections = self._manual_connections
        manual_connections[tgt_name] = (src_name, src_indices, flat_src_indices)
def connect ( self , src_name , tgt_name , src_indices = None , flat_src_indices = None ) : if isinstance ( src_indices , string_types ) : if isinstance ( tgt_name , string_types ) : tgt_name = [ tgt_name ] tgt_name . append ( src_indices ) raise TypeError ( "src_indices must be an index array, did you mean" " connect('%s', %s)?" % ( src_name , tgt_name ) ) if isinstance ( src_indices , Iterable ) : src_indices = np . atleast_1d ( src_indices ) if isinstance ( src_indices , np . ndarray ) : if not np . issubdtype ( src_indices . dtype , np . integer ) : raise TypeError ( "src_indices must contain integers, but src_indices for " "connection from '%s' to '%s' is %s." % ( src_name , tgt_name , src_indices . dtype . type ) ) if not isinstance ( tgt_name , string_types ) and isinstance ( tgt_name , Iterable ) : for name in tgt_name : self . connect ( src_name , name , src_indices , flat_src_indices = flat_src_indices ) return for manual_connections in [ self . _manual_connections , self . _static_manual_connections ] : if tgt_name in manual_connections : srcname = manual_connections [ tgt_name ] [ 0 ] raise RuntimeError ( "Input '%s' is already connected to '%s'." % ( tgt_name , srcname ) ) if src_name . rsplit ( '.' , 1 ) [ 0 ] == tgt_name . rsplit ( '.' , 1 ) [ 0 ] : raise RuntimeError ( "Output and input are in the same System for " + "connection from '%s' to '%s'." % ( src_name , tgt_name ) ) if self . _static_mode : manual_connections = self . _static_manual_connections else : manual_connections = self . _manual_connections manual_connections [ tgt_name ] = ( src_name , src_indices , flat_src_indices )
Connect source src_name to target tgt_name in this namespace.
Connect source src_name to target tgt_name in this namespace .
"""
        Connect source src_name to target tgt_name in this namespace.

        Parameters
        ----------
        src_name : str
            name of the source variable to connect
        tgt_name : str or [str, ... ] or (str, ...)
            name of the target variable(s) to connect
        src_indices : int or list of ints or tuple of ints or int ndarray or Iterable or None
            The global indices of the source variable to transfer data from.
            The shapes of the target and src_indices must match, and form of the
            entries within is determined by the value of 'flat_src_indices'.
        flat_src_indices : bool
            If True, each entry of src_indices is assumed to be an index into the
            flattened source.  Otherwise it must be a tuple or list of size equal
            to the number of dimensions of the source.
        """ # if src_indices argument is given, it should be valid # if multiple targets are given, recursively connect to each # target should not already be connected # source and target should not be in the same system
self
src_name
tgt_name
src_indices
flat_src_indices