Eliminate iterations over lists (assume ndarray instead of list of ndarrays)

This commit is contained in:
Jan Petykiewicz 2019-07-09 20:20:05 -07:00
parent 557e748356
commit a8a5a69e1a

View File

@ -71,9 +71,7 @@ def maxwell_e(dt: float, dxes: dx_lists_t = None) -> functional_matrix:
curl_h_fun = curl_h(dxes) curl_h_fun = curl_h(dxes)
def me_fun(e: field_t, h: field_t, epsilon: field_t): def me_fun(e: field_t, h: field_t, epsilon: field_t):
ch = curl_h_fun(h) e += dt * curl_h_fun(h)/ epsilon
for ei, ci, epsi in zip(e, ch, epsilon):
ei += dt * ci / epsi
return e return e
return me_fun return me_fun
@ -83,9 +81,7 @@ def maxwell_h(dt: float, dxes: dx_lists_t = None) -> functional_matrix:
curl_e_fun = curl_e(dxes) curl_e_fun = curl_e(dxes)
def mh_fun(e: field_t, h: field_t): def mh_fun(e: field_t, h: field_t):
ce = curl_e_fun(e) h -= dt * curl_e_fun(e)
for hi, ci in zip(h, ce):
hi -= dt * ci
return h return h
return mh_fun return mh_fun