def __init__(self, eps: goos.Shape, source: goos.Function, solver: str, wavelengths: List[float], simulation_space: simspace.SimulationSpace, background: goos.material.Material, outputs: List[SimOutput]) -> None: # Determine the output flow types. output_flow_types = [out.Attributes.output_type for out in outputs] super().__init__([eps, source], flow_types=output_flow_types) # Internally setup a plan to handle the simulation. self._plan = goos.OptimizationPlan() self._sims = [] self._eps = eps with self._plan: for wlen in wavelengths: # TODO(logansu): Use a placeholder dummy for the shape to # reduce runtime and save memory. eps_rendered = render.RenderShape( self._eps, region=simulation_space.sim_region, mesh=simulation_space.mesh, background=background, wavelength=wlen) sim_result = SimulateNode( eps=eps_rendered, source=source, wavelength=wlen, simulation_space=simulation_space, solver=solver, outputs=outputs, ) self._sims.append(sim_result)
def fdfd_simulation(wavelength: float, eps: goos.Shape, background: goos.material.Material, simulation_space: simspace.SimulationSpace, return_eps: bool = False, **kwargs) -> SimulateNode: eps = render.RenderShape(eps, region=simulation_space.sim_region, mesh=simulation_space.mesh, background=background, wavelength=wavelength) sim = SimulateNode(eps=eps, wavelength=wavelength, simulation_space=simulation_space, **kwargs) if return_eps: return sim, eps else: return sim
def eig_simulation(wavelength: float, eps: goos.Shape, background: goos.material.Material, simulation_space: simspace.SimulationSpace, bloch_vector: List[float], get_eps: bool = False, **kwargs): eps = render.RenderShape( eps, region=simulation_space.sim_region, simulation_symmetry=simulation_space.reflection_symmetry, mesh=simulation_space.mesh, background=background, wavelength=wavelength) sim = SimulateEigNode(eps=eps, wavelength=wavelength, simulation_space=simulation_space, bloch_vector=bloch_vector, **kwargs) if get_eps: return sim, eps else: return sim