Skip to content

Commit e820311

Browse files
committed
Convenience property in mode solver to get number of cells, freqs, and modes
1 parent 259d1c4 commit e820311

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tidy3d/plugins/mode/mode_solver.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,14 @@ def _solver_grid(self) -> Grid:
153153

154154
return self.simulation._subgrid(span_inds=span_inds)
155155

156+
@cached_property
157+
def _num_cells_freqs_modes(self) -> Tuple[int, int, int]:
158+
"""Get the number of spatial points, number of freqs, and number of modes requested."""
159+
num_cells = np.prod(self._solver_grid.num_cells)
160+
num_modes = self.mode_spec.num_modes
161+
num_freqs = len(self.freqs)
162+
return num_cells, num_freqs, num_modes
163+
156164
def solve(self) -> ModeSolverData:
157165
""":class:`.ModeSolverData` containing the field and effective index data.
158166

0 commit comments

Comments
 (0)