def _add_gamma_multipliers(bem):
 bem['sigma'] = np.array([surf['sigma'] for surf in bem['surfs']])
 sigma = np.r_[(0.0, bem['sigma'])]
 bem['source_mult'] = (2.0 / (sigma[1:] + sigma[:(-1)]))
 bem['field_mult'] = (sigma[1:] - sigma[:(-1)])
 assert (len(bem['surfs']) == len(bem['field_mult']))
 bem['gamma'] = ((sigma[1:] - sigma[:(-1)])[np.newaxis, :] / (sigma[1:] + sigma[:(-1)])[:, np.newaxis])

def _add_gamma_multipliers ( bem ) : bem [ 'sigma' ] = np . array ( [ surf [ 'sigma' ] for surf in bem [ 'surfs' ] ] ) sigma = np . r_ [ ( 0.0 , bem [ 'sigma' ] ) ] bem [ 'source_mult' ] = ( 2.0 / ( sigma [ 1 : ] + sigma [ : ( - 1 ) ] ) ) bem [ 'field_mult' ] = ( sigma [ 1 : ] - sigma [ : ( - 1 ) ] ) assert ( len ( bem [ 'surfs' ] ) == len ( bem [ 'field_mult' ] ) ) bem [ 'gamma' ] = ( ( sigma [ 1 : ] - sigma [ : ( - 1 ) ] ) [ np . newaxis , : ] / ( sigma [ 1 : ] + sigma [ : ( - 1 ) ] ) [ : , np . newaxis ] )
helper to add gamma and multipliers in-place .