@@ -542,27 +542,60 @@ def test_uniform_grid_dl_validation(dl, expect_exception):
542
542
run_time = 1e-12 ,
543
543
)
544
544
545
-
546
- def test_dl_min_from_smallest_feature ():
547
545
546
+ def test_dl_min_from_smallest_feature ():
548
547
structure = td .Structure (
549
- geometry = td .PolySlab (vertices = [[0 , 0 ], [2 , 0 ], [2 , 1 ], [1 , 1 ], [1 , 1.1 ], [2 , 1.1 ], [2 , 2 ], [1 , 2 ], [1 , 2.2 ], [0.7 , 2.2 ], [0.7 , 2 ], [0 , 2 ]], slab_bounds = [- 1 , 1 ], axis = 2 ),
548
+ geometry = td .PolySlab (
549
+ vertices = [
550
+ [0 , 0 ],
551
+ [2 , 0 ],
552
+ [2 , 1 ],
553
+ [1 , 1 ],
554
+ [1 , 1.1 ],
555
+ [2 , 1.1 ],
556
+ [2 , 2 ],
557
+ [1 , 2 ],
558
+ [1 , 2.2 ],
559
+ [0.7 , 2.2 ],
560
+ [0.7 , 2 ],
561
+ [0 , 2 ],
562
+ ],
563
+ slab_bounds = [- 1 , 1 ],
564
+ axis = 2 ,
565
+ ),
550
566
medium = td .PECMedium (),
551
567
)
552
568
553
569
# check expected dl_min
554
- layer_spec = td .LayerRefinementSpec (axis = 2 , size = (td .inf , td .inf , 2 ), corner_finder = td .CornerFinderSpec (dl_min_spec = td .SmallestFeatureSpec (convex_resolution = 10 , concave_resolution = 0 , mixed_resolution = 0 )))
570
+ layer_spec = td .LayerRefinementSpec (
571
+ axis = 2 ,
572
+ size = (td .inf , td .inf , 2 ),
573
+ corner_finder = td .CornerFinderSpec (
574
+ convex_resolution = 10 , concave_resolution = None , mixed_resolution = None
575
+ ),
576
+ )
555
577
dl_min = layer_spec ._dl_min_from_smallest_feature ([structure ])
556
- assert ( np .allclose (0.3 / 10 , dl_min ) )
578
+ assert np .allclose (0.3 / 10 , dl_min )
557
579
558
- layer_spec = td .LayerRefinementSpec (axis = 2 , size = (td .inf , td .inf , 2 ), corner_finder = td .CornerFinderSpec (dl_min_spec = td .SmallestFeatureSpec (convex_resolution = 0 , concave_resolution = 0 , mixed_resolution = 10 )))
580
+ layer_spec = td .LayerRefinementSpec (
581
+ axis = 2 ,
582
+ size = (td .inf , td .inf , 2 ),
583
+ corner_finder = td .CornerFinderSpec (
584
+ convex_resolution = None , concave_resolution = None , mixed_resolution = 10
585
+ ),
586
+ )
559
587
dl_min = layer_spec ._dl_min_from_smallest_feature ([structure ])
560
- assert ( np .allclose (0.2 / 10 , dl_min ) )
588
+ assert np .allclose (0.2 / 10 , dl_min )
561
589
562
- layer_spec = td .LayerRefinementSpec (axis = 2 , size = (td .inf , td .inf , 2 ), corner_finder = td .CornerFinderSpec (dl_min_spec = td .SmallestFeatureSpec (convex_resolution = 0 , concave_resolution = 10 , mixed_resolution = 0 )))
590
+ layer_spec = td .LayerRefinementSpec (
591
+ axis = 2 ,
592
+ size = (td .inf , td .inf , 2 ),
593
+ corner_finder = td .CornerFinderSpec (
594
+ convex_resolution = None , concave_resolution = 10 , mixed_resolution = None
595
+ ),
596
+ )
563
597
dl_min = layer_spec ._dl_min_from_smallest_feature ([structure ])
564
- assert (np .allclose (0.1 / 10 , dl_min ))
565
-
598
+ assert np .allclose (0.1 / 10 , dl_min )
566
599
567
600
# check grid is generated succesfully
568
601
sim = td .Simulation (
@@ -573,4 +606,3 @@ def test_dl_min_from_smallest_feature():
573
606
)
574
607
575
608
_ = sim .grid
576
-
0 commit comments