def _fwd_bem_ip_modify_solution(solution, ip_solution, ip_mult, n_tri):
 n_last = n_tri[(-1)]
 mult = ((1.0 + ip_mult) / ip_mult)
 logger.info('        Combining...')
 offsets = np.cumsum(np.concatenate(([0], n_tri)))
 for si in range(len(n_tri)):
  sub = solution[offsets[si]:offsets[(si + 1)], np.sum(n_tri[:(-1)]):]
  sub -= (2 * np.dot(sub, ip_solution))
 sub[(- n_last):, (- n_last):] += (mult * ip_solution)
 logger.info('        Scaling...')
 solution *= ip_mult
 return

def _fwd_bem_ip_modify_solution ( solution , ip_solution , ip_mult , n_tri ) : n_last = n_tri [ ( - 1 ) ] mult = ( ( 1.0 + ip_mult ) / ip_mult ) logger . info ( '        Combining...' ) offsets = np . cumsum ( np . concatenate ( ( [ 0 ] , n_tri ) ) ) for si in range ( len ( n_tri ) ) : sub = solution [ offsets [ si ] : offsets [ ( si + 1 ) ] , np . sum ( n_tri [ : ( - 1 ) ] ) : ] sub -= ( 2 * np . dot ( sub , ip_solution ) ) sub [ ( - n_last ) : , ( - n_last ) : ] += ( mult * ip_solution ) logger . info ( '        Scaling...' ) solution *= ip_mult return
modify the solution according to the ip approach .