@@ -22,6 +22,8 @@ def get_mesh(
22
22
component : ComponentSpec ,
23
23
type : str ,
24
24
layer_stack : LayerStack ,
25
+ layer_physical_map : dict | None = None ,
26
+ layer_meshbool_map : dict | None = None ,
25
27
z : float | None = None ,
26
28
xsection_bounds = None ,
27
29
wafer_padding : float = 0.0 ,
@@ -35,6 +37,8 @@ def get_mesh(
35
37
component: component
36
38
type: one of "xy", "uz", or "3D". Determines the type of mesh to return.
37
39
layer_stack: LayerStack object containing layer information.
40
+ layer_physical_map: by default, physical are tagged with layername; this dict allows you to specify custom mappings.
41
+ layer_meshbool_map: by default, all polygons on layer_stack layers are meshed; this dict allows you set True of False to the meshing of given layers.
38
42
z: used to define z-slice for xy meshing.
39
43
xsection_bounds: used to define in-plane line for uz meshing.
40
44
wafer_padding: padding beyond bbox to add to WAFER layers.
@@ -73,6 +77,26 @@ def get_mesh(
73
77
else :
74
78
new_resolutions = None
75
79
80
+ # Default layer labels
81
+ if layer_physical_map is None :
82
+ layer_physical_map = {}
83
+ for layer_name in layer_stack .layers .keys ():
84
+ layer_physical_map [layer_name ] = layer_name
85
+ else :
86
+ for layer_name in layer_stack .layers .keys ():
87
+ if layer_name not in layer_physical_map .keys ():
88
+ layer_physical_map [layer_name ] = layer_name
89
+
90
+ # Default meshing flags (all True)
91
+ if layer_meshbool_map is None :
92
+ layer_meshbool_map = {}
93
+ for layer_name in layer_stack .layers .keys ():
94
+ layer_meshbool_map [layer_name ] = True
95
+ else :
96
+ for layer_name in layer_stack .layers .keys ():
97
+ if layer_name not in layer_physical_map .keys ():
98
+ layer_meshbool_map [layer_name ] = True
99
+
76
100
if type == "xy" :
77
101
if z is None :
78
102
raise ValueError (
@@ -85,6 +109,7 @@ def get_mesh(
85
109
layer_stack = layer_stack ,
86
110
default_characteristic_length = default_characteristic_length ,
87
111
resolutions = new_resolutions ,
112
+ layer_physical_map = layer_physical_map ,
88
113
** kwargs ,
89
114
)
90
115
elif type == "uz" :
@@ -100,6 +125,7 @@ def get_mesh(
100
125
layer_stack = layer_stack ,
101
126
default_characteristic_length = default_characteristic_length ,
102
127
resolutions = new_resolutions ,
128
+ layer_physical_map = layer_physical_map ,
103
129
** kwargs ,
104
130
)
105
131
elif type == "3D" :
@@ -108,6 +134,7 @@ def get_mesh(
108
134
layer_stack = layer_stack ,
109
135
default_characteristic_length = default_characteristic_length ,
110
136
resolutions = new_resolutions ,
137
+ layer_physical_map = layer_physical_map ,
111
138
** kwargs ,
112
139
)
113
140
else :
0 commit comments