From a8a5a69e1a747250f33f01fd4eb048287c9a969f Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Tue, 9 Jul 2019 20:20:05 -0700 Subject: [PATCH] Eliminate iterations over lists (assume ndarray instead of list of ndarrays) --- fdfd_tools/fdtd.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/fdfd_tools/fdtd.py b/fdfd_tools/fdtd.py index 3687c82..f72c7a3 100644 --- a/fdfd_tools/fdtd.py +++ b/fdfd_tools/fdtd.py @@ -71,9 +71,7 @@ def maxwell_e(dt: float, dxes: dx_lists_t = None) -> functional_matrix: curl_h_fun = curl_h(dxes) def me_fun(e: field_t, h: field_t, epsilon: field_t): - ch = curl_h_fun(h) - for ei, ci, epsi in zip(e, ch, epsilon): - ei += dt * ci / epsi + e += dt * curl_h_fun(h)/ epsilon return e 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) def mh_fun(e: field_t, h: field_t): - ce = curl_e_fun(e) - for hi, ci in zip(h, ce): - hi -= dt * ci + h -= dt * curl_e_fun(e) return h return mh_fun