time_self_eval)) print('Direct target evaluation took: {:0.1f}'.format( time_target_eval)) else: # by FMMLIB2D, if available try: import pyfmmlib2d source = np.row_stack([px, py]) target = np.row_stack([rx, ry]) dumb_targ = np.row_stack( [np.array([0.6, 0.6]), np.array([0.5, 0.5])]) st = time.time() out = pyfmmlib2d.RFMM(source, dumb_targ, charge=tau, compute_target_potential=True, precision=reference_precision) tform = time.time() - st print('FMMLIB generation took: {:0.1f}'.format( tform * 1000)) print('...Points/Second/Core (thousands) \033[1m', int(N_source / tform / cpu_num / 1000), '\033[0m ') st = time.time() out = pyfmmlib2d.RFMM(source, charge=tau, compute_source_potential=True, precision=reference_precision) self_reference_eval = -0.5 * out['source']['u'] / np.pi tt = time.time() - st - tform print('FMMLIB self only eval took: {:0.1f}'.format(tt *
# get reference solution reference = True if N_total <= 50000: # by Direct Sum st = time.time() reference_eval = np.zeros(N_total, dtype=float) Kernel_Self_Apply(px, py, tau, reference_eval) time_direct_eval = (time.time() - st) * 1000 print('\nDirect evaluation took: {:0.1f}'.format(time_direct_eval)) # by FMMLIB2D, if available try: source = np.row_stack([px, py]) st = time.time() if problem == 'Laplace': out = pyfmmlib2d.RFMM(source, charge=tau, compute_source_potential=True) reference_eval = -out['source']['u'] / (2 * np.pi) elif problem == 'Modified Helmholtz': out = pyfmmlib2d.HFMM(source, charge=tau, compute_source_potential=True, helmholtz_parameter=1j * helmholtz_k) reference_eval = out['source']['u'] * 2 * np.pi elif problem == 'Biharmonic': out = pyfmmlib2d.BFMM(source, charge=tau.astype(complex), compute_source_velocity=True) else: raise Exception('No FMMLIB function provided.') et = time.time()
print('Direct target evaluation took: {:0.1f}'.format( time_target_eval)) else: # by FMMLIB2D, if available try: import pyfmmlib2d source = np.row_stack([px, py]) target = np.row_stack([rx, ry]) dumb_targ = np.row_stack( [np.array([0.6, 0.6]), np.array([0.5, 0.5])]) st = time.time() out = pyfmmlib2d.RFMM(source, dumb_targ, charge=slp, dipstr=dlp, dipvec=dipvec, compute_target_potential=True, precision=reference_precision) tform = time.time() - st print('FMMLIB generation took: {:0.1f}'.format( tform * 1000)) print('...Points/Second/Core (thousands) \033[1m', int(N_source / tform / cpu_num / 1000), '\033[0m ') st = time.time() out = pyfmmlib2d.RFMM(source, charge=slp, dipstr=dlp, dipvec=dipvec, compute_source_potential=True, precision=reference_precision)
time_self_eval = (time.time() - st)*1000 st = time.time() target_reference_eval = np.zeros(N_target, dtype=complex) KA(px, py, rx, ry, tau, out=target_reference_eval) time_target_eval = (time.time() - st)*1000 print('\nDirect self evaluation took: {:0.1f}'.format(time_self_eval)) print('Direct target evaluation took: {:0.1f}'.format(time_target_eval)) else: # by FMMLIB2D, if available try: import pyfmmlib2d source = np.row_stack([px, py]) target = np.row_stack([rx, ry]) dumb_targ = np.row_stack([np.array([0.6, 0.6]), np.array([0.5, 0.5])]) st = time.time() out = pyfmmlib2d.RFMM(source, dumb_targ, charge=tau, compute_target_potential=True) tform = time.time() - st print('FMMLIB generation took: {:0.1f}'.format(tform*1000)) print('...Points/Second/Core (thousands) \033[1m', int(N_source/tform/cpu_num/1000), '\033[0m ') st = time.time() out = pyfmmlib2d.RFMM(source, charge=tau, compute_source_potential=True) self_reference_eval = -0.5*out['source']['u']/np.pi tt = time.time() - st - tform print('FMMLIB self only eval took: {:0.1f}'.format(tt*1000)) print('...Points/Second/Core (thousands) \033[1m', int(N_source/tt/cpu_num/1000), '\033[0m ') st = time.time() out = pyfmmlib2d.RFMM(source, target, charge=tau, compute_target_potential=True) target_reference_eval = -0.5*out['target']['u']/np.pi tt = time.time() - st - tform print('FMMLIB target only eval took: {:0.1f}'.format(tt*1000)) print('...Points/Second/Core (thousands) \033[1m', int(N_target/tt/cpu_num/1000), '\033[0m ')