示例#1
0
def copy(src, dest, name="", n=1, toGlobal=False, copyExtMsg=False):
    """Make copies of a moose object.

    Parameters
    ----------
    src : vec, element or str
        source object.
    dest : vec, element or str
        Destination object to copy into.
    name : str
        Name of the new object. If omitted, name of the original will be used.
    n : int
        Number of copies to make (default=1).
    toGlobal : bool
        Relevant for parallel environments only. If false, the copies will
        reside on local node, otherwise all nodes get the copies.
    copyExtMsg : bool
        If true, messages to/from external objects are also copied.

    Returns
    -------
    vec
        newly copied vec
    """
    if isinstance(src, str):
        src = _moose.element(src)
    if isinstance(dest, str):
        dest = _moose.element(dest)
    if not name:
        name = src.name
    return _moose.copy(src.id, dest, name, n, toGlobal, copyExtMsg)
示例#2
0
def proxify( reac, reacc, direction, pool, poolc ):
    reacc_elm = _moose.element( reacc )
    reac_elm = _moose.element( reac )
    # Preserve the rates which were set up for the x-compt reacn
    #_moose.showfield( reac )
    dupname = pool.name + '_xfer_' + _moose.element(poolc).name
    #print "#############", pool, dupname, poolc
    if _moose.exists( reacc + '/' + dupname ):
        duppool = _moose.element( reacc + '/' + dupname )
    else:
        # This also deals with cases where the duppool is buffered.
        duppool = _moose.copy(pool, reacc_elm, dupname )
    duppool.diffConst = 0   # diffusion only happens in original compt
    removeEnzFromPool( duppool )
    disconnectReactant( reac, pool, duppool )
    _moose.connect( reac, direction, duppool, 'reac' )
示例#3
0
def proxify(reac, reacc, direction, pool, poolc):
    reacc_elm = moose.element(reacc)
    reac_elm = moose.element(reac)
    # Preserve the rates which were set up for the x-compt reacn
    #_moose.showfield( reac )
    dupname = pool.name + '_xfer_' + moose.element(poolc).name
    #  print("#############", pool, dupname, poolc)
    if _moose.exists(reacc + '/' + dupname):
        duppool = moose.element(reacc + '/' + dupname)
    else:
        # This also deals with cases where the duppool is buffered.
        duppool = _moose.copy(pool, reacc_elm, dupname)
    duppool.diffConst = 0  # diffusion only happens in original compt
    removeEnzFromPool(duppool)
    disconnectReactant(reac, pool, duppool)
    moose.connect(reac, direction, duppool, 'reac')