File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88## [ Unreleased]
99
1010### Added
11+ - Added priority attribute to ` TopologyDesignRegion ` to enable manual control of overlapping structures.
1112
1213### Changed
1314
Original file line number Diff line number Diff line change @@ -156,6 +156,19 @@ def test_region_inf_size():
156156 _ = region .to_structure (params_0_inf )
157157
158158
159+ def test_region_priority ():
160+ region = make_design_region ()
161+
162+ # Test default priority (None)
163+ structure_default = region .to_structure (region .params_zeros )
164+ assert structure_default .priority is None
165+
166+ # Test explicit priority value
167+ region = region .updated_copy (priority = 1 )
168+ structure = region .to_structure (region .params_zeros )
169+ assert structure .priority == 1
170+
171+
159172def post_process_fn (sim_data : td .SimulationData , ** kwargs ) -> float :
160173 """Define a post-processing function with extra kwargs (recommended)."""
161174 intensity = sim_data .get_intensity (MNT_NAME1 )
Original file line number Diff line number Diff line change @@ -179,6 +179,16 @@ class TopologyDesignRegion(DesignRegion):
179179 "Supplying ``False`` will completely leave out the override structure." ,
180180 )
181181
182+ priority : int = pd .Field (
183+ None ,
184+ title = "Priority" ,
185+ description = "Priority of the structure applied in structure overlapping region. "
186+ "The material property in the overlapping region is dictated by the structure "
187+ "of higher priority. For structures of equal priority, "
188+ "the structure added later to the structure list takes precedence. When `priority` is None, "
189+ "the value is automatically assigned based on `structure_priority_mode` in the `Simulation`." ,
190+ )
191+
182192 def _validate_eps_values (self ) -> None :
183193 """Validate the epsilon values by evaluating the transformations."""
184194 try :
@@ -329,7 +339,7 @@ def to_structure(self, params: anp.ndarray) -> td.Structure:
329339 eps_values = self .eps_values (params )
330340 eps_data_array = td .SpatialDataArray (eps_values , coords = coords )
331341 medium = td .CustomMedium (permittivity = eps_data_array )
332- return td .Structure (geometry = self .geometry , medium = medium )
342+ return td .Structure (geometry = self .geometry , medium = medium , priority = self . priority )
333343
334344 @property
335345 def _override_structure_dl (self ) -> float :
You can’t perform that action at this time.
0 commit comments