Skip to content

Commit 199aeb8

Browse files
committed
unifying
1 parent 26e68b8 commit 199aeb8

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

tidy3d/plugins/smatrix/component_modelers/modal.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,3 +373,9 @@ def get_max_mode_indices(matrix_elements: tuple[str, int]) -> int:
373373
max_mode_index_in = get_max_mode_indices(self.matrix_indices_source)
374374

375375
return max_mode_index_out, max_mode_index_in
376+
377+
def task_name_from_index(self, matrix_index: MatrixIndex) -> str:
378+
"""Compute task name for a given (port_name, mode_index) without constructing simulations."""
379+
port_name, mode_index = matrix_index
380+
port = self.get_port_by_name(port_name=port_name)
381+
return self.get_task_name(port=port, mode_index=mode_index)

tidy3d/plugins/smatrix/component_modelers/terminal.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,11 @@ def get_radiation_monitor_by_name(self, monitor_name: str) -> DirectivityMonitor
877877
return monitor
878878
raise Tidy3dKeyError(f"No radiation monitor named '{monitor_name}'.")
879879

880+
def task_name_from_index(self, source_index: NetworkIndex) -> str:
881+
"""Compute task name for a given network index without constructing simulations."""
882+
port, mode_index = self.network_dict[source_index]
883+
return self.get_task_name(port=port, mode_index=mode_index)
884+
880885
def _extrude_port_structures(self, sim: Simulation) -> Simulation:
881886
"""
882887
Extrude structures intersecting a port plane when a wave port lies on a structure boundary.

0 commit comments

Comments
 (0)