assist/command/mkmodel.py
def _ssa_model(arg, params):
    """Helper function for an ssa model. """
    nspecs = arg.nspecs
    nreacs = arg.nreacs

    prop = ['prop[0] = 0;']
    for num in range(1, nreacs):
        prop.append('        prop[%d] = 0;' % num)
    params['prop'] = '\n'.join(prop)

    params['z'] = 'for(unsigned int i=0; i < z.size(1); ++i) z[i] = 0;'
    if arg.z:
        params['z'] += '\n'
        sfmt = '%%%dd' % len(str(nspecs-1))
        rfmt = '%%%dd' % len(str(nreacs-1))
        if arg.z == 'row':
            for reac in range(0, nreacs):
                tmp = ' '*6
                for spec in range(0, nspecs):
                    tmp += ('  z(%s, %s) =  0;' % (sfmt, rfmt)) % (spec, reac)
                params['z'] += '%s\n' % tmp
        else:
            for spec in range(0, nspecs):
                tmp = ' '*6
                for reac in range(0, nreacs):
                    tmp += ('  z(%s, %s) =  0;' % (sfmt, rfmt)) % (spec, reac)
                params['z'] += '%s\n' % tmp
Helper function for an ssa model. 
Helper function for an ssa model.
Helper function for an ssa model .
def _ssa_model(arg, params):
    nspecs = arg.nspecs
    nreacs = arg.nreacs
    prop = ['prop[0] = 0;']
    for num in range(1, nreacs):
        prop.append('        prop[%d] = 0;' % num)
    params['prop'] = '\n'.join(prop)
    params['z'] = 'for(unsigned int i=0; i < z.size(1); ++i) z[i] = 0;'
    if arg.z:
        params['z'] += '\n'
        sfmt = '%%%dd' % len(str(nspecs-1))
        rfmt = '%%%dd' % len(str(nreacs-1))
        if arg.z == 'row':
            for reac in range(0, nreacs):
                tmp = ' '*6
                for spec in range(0, nspecs):
                    tmp += ('  z(%s, %s) =  0;' % (sfmt, rfmt)) % (spec, reac)
                params['z'] += '%s\n' % tmp
        else:
            for spec in range(0, nspecs):
                tmp = ' '*6
                for reac in range(0, nreacs):
                    tmp += ('  z(%s, %s) =  0;' % (sfmt, rfmt)) % (spec, reac)
                params['z'] += '%s\n' % tmp
def _ssa_model ( arg , params ) : nspecs = arg . nspecs nreacs = arg . nreacs prop = [ 'prop[0] = 0;' ] for num in range ( 1 , nreacs ) : prop . append ( '        prop[%d] = 0;' % num ) params [ 'prop' ] = '\n' . join ( prop ) params [ 'z' ] = 'for(unsigned int i=0; i < z.size(1); ++i) z[i] = 0;' if arg . z : params [ 'z' ] += '\n' sfmt = '%%%dd' % len ( str ( nspecs - 1 ) ) rfmt = '%%%dd' % len ( str ( nreacs - 1 ) ) if arg . z == 'row' : for reac in range ( 0 , nreacs ) : tmp = ' ' * 6 for spec in range ( 0 , nspecs ) : tmp += ( '  z(%s, %s) =  0;' % ( sfmt , rfmt ) ) % ( spec , reac ) params [ 'z' ] += '%s\n' % tmp else : for spec in range ( 0 , nspecs ) : tmp = ' ' * 6 for reac in range ( 0 , nreacs ) : tmp += ( '  z(%s, %s) =  0;' % ( sfmt , rfmt ) ) % ( spec , reac ) params [ 'z' ] += '%s\n' % tmp
Helper function for an ssa model.
Helper function for an ssa model .
"""Helper function for an ssa model. """
arg
params