Commit 1466c237 authored by Daniel Brown's avatar Daniel Brown

Cleanup of lens code to make way for KnmAutoConnectorWorkspace

parent d45c9782
......@@ -106,110 +106,4 @@ cdef class LensWorkspace(KnmAutoConnectorWorkspace):
if self.sym_abcd_Cy != NULL:
self.abcd_y[1][0] = cy_expr_eval(self.sym_abcd_Cy)
# cdef void initialise_knm_workspaces(self) nogil:
# cdef:
# NodeBeamParam q_p1i = self.sim.trace[self.P1i_id]
# NodeBeamParam q_p1o = self.sim.trace[self.P1o_id]
# NodeBeamParam q_p2i = self.sim.trace[self.P2i_id]
# NodeBeamParam q_p2o = self.sim.trace[self.P2o_id]
# # Beam parameters for matched propagation of inputs
# complex_t qx_p1o_matched_trns, qy_p1o_matched_trns
# complex_t qx_p2o_matched_trns, qy_p2o_matched_trns
# double lambda0 = self.sim.model_data.lambda0
# int maxtem = self.sim.model_data.maxtem
# # Transmission at port p1 -> p2
# qx_p2o_matched_trns = transform_q(self.abcd_x, q_p1i.qx, self.nr1, self.nr2)
# knm_ws_init(
# &self.K12_ws_x, qx_p2o_matched_trns, q_p2o.qx, 0, 0, self.nr2, lambda0, maxtem,
# )
# qy_p2o_matched_trns = transform_q(self.abcd_y, q_p1i.qy, self.nr1, self.nr2)
# knm_ws_init(
# &self.K12_ws_y, qy_p2o_matched_trns, q_p2o.qy, 0, 0, self.nr2, lambda0, maxtem,
# )
# # Transmission at port p2 -> p1
# qx_p1o_matched_trns = transform_q(self.abcd_x, q_p2i.qx, self.nr2, self.nr1)
# knm_ws_init(
# &self.K21_ws_x, qx_p1o_matched_trns, q_p1o.qx, 0, 0, self.nr1, lambda0, maxtem,
# )
# qy_p1o_matched_trns = transform_q(self.abcd_y, q_p2i.qy, self.nr2, self.nr1)
# knm_ws_init(
# &self.K21_ws_y, qy_p1o_matched_trns, q_p1o.qy, 0, 0, self.nr1, lambda0, maxtem,
# )
# cdef void free_knm_workspaces(self) nogil:
# knm_ws_free(&self.K12_ws_x)
# knm_ws_free(&self.K12_ws_y)
# knm_ws_free(&self.K21_ws_x)
# knm_ws_free(&self.K21_ws_y)
# cdef void flag_changing_knm_workspaces(self):
# cdef:
# NodeBeamParam q_p1i = self.sim.trace[self.P1i_id]
# NodeBeamParam q_p2i = self.sim.trace[self.P2i_id]
# bint is_changing = q_p1i.is_changing or q_p2i.is_changing
# # Transmission at port p1 -> p2
# self.K12_ws_x.is_mm_changing = is_changing
# self.K12_ws_y.is_mm_changing = is_changing
# if knm_ws_is_changing(&self.K12_ws_x) or knm_ws_is_changing(&self.K12_ws_y):
# LOGGER.info("%s.K12 is changing", self.owner.name)
# # Transmission at port p2 -> p1
# self.K21_ws_x.is_mm_changing = is_changing
# self.K21_ws_y.is_mm_changing = is_changing
# if knm_ws_is_changing(&self.K21_ws_x) or knm_ws_is_changing(&self.K21_ws_y):
# LOGGER.info("%s.K21 is changing", self.owner.name)
cdef void update_changing_knm_workspaces(self) nogil:
cdef:
NodeBeamParam q_p1i = self.sim.trace[self.P1i_id]
NodeBeamParam q_p1o = self.sim.trace[self.P1o_id]
NodeBeamParam q_p2i = self.sim.trace[self.P2i_id]
NodeBeamParam q_p2o = self.sim.trace[self.P2o_id]
complex_t qx_p1o_matched_trns, qy_p1o_matched_trns
complex_t qx_p2o_matched_trns, qy_p2o_matched_trns
if self.K12_ws_x.is_mm_changing:
qx_p2o_matched_trns = transform_q(self.abcd_x, q_p1i.qx, self.nr1, self.nr2)
knm_ws_recompute_mismatch(&self.K12_ws_x, qx_p2o_matched_trns, q_p2o.qx)
if self.K12_ws_y.is_mm_changing:
qy_p2o_matched_trns = transform_q(self.abcd_y, q_p1i.qy, self.nr1, self.nr2)
knm_ws_recompute_mismatch(&self.K12_ws_y, qy_p2o_matched_trns, q_p2o.qy)
if self.K21_ws_x.is_mm_changing:
qx_p1o_matched_trns = transform_q(self.abcd_x, q_p2i.qx, self.nr2, self.nr1)
knm_ws_recompute_mismatch(&self.K21_ws_x, qx_p1o_matched_trns, q_p1o.qx)
if self.K21_ws_y.is_mm_changing:
qy_p1o_matched_trns = transform_q(self.abcd_y, q_p2i.qy, self.nr2, self.nr1)
knm_ws_recompute_mismatch(&self.K21_ws_y, qy_p1o_matched_trns, q_p1o.qy)
cdef void compute_scattering_matrices(self):
# Transmission p1 -> p2
if knm_ws_is_changing(&self.K12_ws_x) or knm_ws_is_changing(&self.K12_ws_y):
compute_knm_matrix_bh(&self.K12_ws_x, &self.K12_ws_y, self.sim.model_data.homs_view, self.K12.data_view)
reverse_gouy_phases(self.K12.data_view, self.sim.model_data.homs_view, &self.K12_ws_x, &self.K12_ws_y, self.K12.data_view)
if self.sim.model_data.zero_K00:
zero_tem00_phase(self.K12.data_view, self.K12.data_view)
# Transmission p2 -> p1
if knm_ws_is_changing(&self.K21_ws_x) or knm_ws_is_changing(&self.K21_ws_y):
compute_knm_matrix_bh(&self.K21_ws_x, &self.K21_ws_y, self.sim.model_data.homs_view, self.K21.data_view)
reverse_gouy_phases(self.K21.data_view, self.sim.model_data.homs_view, &self.K21_ws_x, &self.K21_ws_y, self.K21.data_view)
if self.sim.model_data.zero_K00:
zero_tem00_phase(self.K21.data_view, self.K21.data_view)
# TODO (sjr) make c_lens_fill function?
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment