class SimulationSpace(optplan.SimulationSpaceBase): """Defines a simulation space. A simulation space contains information regarding the permittivity distributions but not the fields, i.e. no information regarding sources and wavelengths. Attributes: name: Name to identify the simulation space. Must be unique. eps_fg: Foreground permittivity. eps_bg: Background permittivity. mesh: Meshing information. This describes how the simulation region should be meshed. sim_region: Rectangular prism simulation domain. selection_matrix_type: The type of selection matrix to form. This is subject to change. """ type = schema_utils.polymorphic_model_type("simulation_space") eps_fg = types.PolyModelType(EpsilonSpec) eps_bg = types.PolyModelType(EpsilonSpec) mesh = types.PolyModelType(MESH_TYPES) sim_region = types.ModelType(optplan.Box3d) boundary_conditions = types.ListType( types.PolyModelType(BOUNDARY_CONDITION_TYPES), min_size=6, max_size=6) pml_thickness = types.ListType(types.IntType(), min_size=6, max_size=6) selection_matrix_type = types.StringType( default=SelectionMatrixType.DIRECT.value, choices=tuple(select_type.value for select_type in SelectionMatrixType), )
class DiffEpsilon(optplan.Function): """Defines a function that finds the L1 norm between two permittivities. Specifially, the function is defined as `sum(|epsilon - epsilon_ref|)`. Attributes: type: Must be "function.diff_epsilon". epsilon: Permittivity. epsilon_ref: Base permittivity to compare to. """ type = schema_utils.polymorphic_model_type("function.diff_epsilon") epsilon = optplan.ReferenceType(optplan.Function) epsilon_ref = types.PolyModelType(EpsilonSpec)
class Material(schema_utils.Model): """Defines a material. A material can be defined either by a name (e.g. "silicon") or by refractive refractive index. Attributes: mat_name: Name of a material. This needs to be a material defined in `spins.material`. index: Refractive index value. """ mat_name = types.StringType() index = types.PolyModelType(optplan.ComplexNumber)
class Material(schema_utils.Model): """Defines a material. A material can be defined either by a name (e.g. "silicon") or by refractive refractive index. Attributes: mat_name: Name of a material. This needs to be a material defined in `spins.material`. mat_file: Path of CSV containing wavelength (microns),n,k columns. The format is the same as CSV's from refractiveindex.info. index: Refractive index value. """ mat_name = types.StringType() mat_file = types.StringType() index = types.PolyModelType(optplan.ComplexNumber)
class GdsMeshEps(EpsilonSpec): """Defines a permittivity distribution by a lits of meshes. The meshes are drawn in order of the list. Consequently, if meshes overlap, the mesh drawn later will take precedence. Attributes: gds: GDS file to use for `GdsMesh` types. background: Default background permittivity. mesh_list: List of meshes to draw. stack_normal: Direction considered the normal to the stack. """ type = schema_utils.polymorphic_model_type("gds_mesh") gds = types.StringType() background = types.ModelType(Material) mesh_list = types.ListType(types.PolyModelType(Mesh)) stack_normal = optplan.vec3d()