fdtdx.gds_layer_stack#
- fdtdx.gds_layer_stack(gds_source, cell_name, layers, materials, simulation_volume, gds_center, flatten=True)[source]#
Build simulation objects from a GDS file according to a layer stack specification.
For each
GDSLayerSpec, polygons are extracted from the named GDS cell, optionally etched by other layers, converted to metres, and wrapped in aGDSLayerObject. Layers are always extruded along z (axis 2) — GDS encodes only x/y polygon geometry, so z is the only axis that can be inferred from the file. For non-z extrusion (e.g. cross-section simulations), constructGDSLayerObjectinstances directly with the desiredaxis. Two constraints are generated per object:A position constraint aligning the object’s bottom face (z) with the simulation volume’s bottom face offset by
spec.z_base.A size constraint matching the simulation volume’s extent in the x/y axes.
- Parameters:
gds_source (
str|Path|Library) – Path to a.gdsfile or an already-loadedgdstk.Library.cell_name (
str) – Name of the GDS cell to read polygons from.layers (
list[GDSLayerSpec]) – Ordered list ofGDSLayerSpecobjects.materials (
dict[str,Material]) – Materials dictionary forwarded to everyGDSLayerObject.simulation_volume (
SimulationVolume) – Used for size/position constraints.gds_center (
tuple[float,float]) – GDS coordinate (in metres) that maps to the x/y centre of the simulation volume.flatten (
bool) – Flatten sub-cell references before reading polygons. Defaults toTrue.
- Return type:
tuple[list[GDSLayerObject],list[Any]]- Returns:
(objects, constraints)- oneGDSLayerObjectand two constraints per layer spec.- Raises:
ValueError – If cell_name is not found in the library. If layers is empty