Skip to content

Commit fc7e961

Browse files
committed
Break SolidModel schematic tests into more granular test items
1 parent d468972 commit fc7e961

File tree

3 files changed

+117
-3
lines changed

3 files changed

+117
-3
lines changed

test/build/test.log

Whitespace-only changes.

test/fragmentless.jl

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
2+
function fragmentless(cs, postrender_ops, zmap)
3+
sm = SolidModel("test"; overwrite=true)
4+
render!(sm, cs; zmap, postrender_ops)
5+
# SolidModels._synchronize!(sm)
6+
# SolidModels.gmsh.fltk.run()
7+
8+
# Extract the surface loops, and the associated tags for each volume
9+
# TODO: Need correct treatment of when these are vectors, i.e. separate volumes
10+
# making up one group.
11+
ext1_tag = SolidModels.dimtags(sm["ext1", 3])[1][2]
12+
ext2_tag = SolidModels.dimtags(sm["ext2", 3])[1][2]
13+
ext3_tag = SolidModels.dimtags(sm["ext3", 3])[1][2]
14+
ext1_shell, ext1_shell_tags = SolidModels.gmsh.model.occ.get_surface_loops(ext1_tag)
15+
ext2_shell, ext2_shell_tags = SolidModels.gmsh.model.occ.get_surface_loops(ext2_tag)
16+
ext3_shell, ext3_shell_tags = SolidModels.gmsh.model.occ.get_surface_loops(ext3_tag)
17+
18+
# Loop tags give the coarse scale topology, i.e. which volumes are holes in
19+
# which. Now can cut the pattern from the chip surface for each.
20+
21+
# In the shell loops remove the chip face tags
22+
chip_l1_tags = getindex.(SolidModels.dimtags(sm[:chip_l1, 2]), 2)
23+
chip_l2_tags = getindex.(SolidModels.dimtags(sm[:chip_l2, 2]), 2)
24+
filter!.(x -> x chip_l1_tags, ext1_shell_tags)
25+
filter!.(x -> x chip_l2_tags, ext2_shell_tags)
26+
filter!.(x -> x chip_l1_tags, ext3_shell_tags)
27+
filter!.(x -> x chip_l2_tags, ext3_shell_tags)
28+
29+
# ext1_shell_tags
30+
# ext2_shell_tags
31+
# ext3_shell_tags
32+
33+
# Add in the pattern and metal tags
34+
SolidModels._synchronize!(sm)
35+
SolidModels.gmsh.fltk.run()
36+
@show SolidModels.intersect_geom!(sm, :chip_l1, :pattern_l1, 2, 2)
37+
pattern_l1_bdr_dimtags = SolidModels.gmsh.model.get_boundary(
38+
SolidModels.dimtags(sm[:pattern_l1, 2]),
39+
false,
40+
false,
41+
true
42+
)
43+
SolidModels.gmsh.model.occ.embed
44+
sm["metal_l1"] =
45+
SolidModels.difference_geom!(sm, :chip_l1, :pattern_l1, 2, 2, remove_object=true)
46+
sm["metal_l2"] =
47+
SolidModels.difference_geom!(sm, :chip_l2, :pattern_l2, 2, 2, remove_object=true)
48+
49+
SolidModels._synchronize!(sm)
50+
SolidModels.gmsh.fltk.run()
51+
# TODO: Fragment is still removing things, despite meshing at the end. Figure
52+
# out which entities are being hung on to.
53+
54+
metal_l1_tags = getindex.(SolidModels.dimtags(sm[:metal_l1, 2]), 2)
55+
metal_l2_tags = getindex.(SolidModels.dimtags(sm[:metal_l2, 2]), 2)
56+
pattern_l1_tags = getindex.(SolidModels.dimtags(sm[:pattern_l1, 2]), 2)
57+
pattern_l2_tags = getindex.(SolidModels.dimtags(sm[:pattern_l2, 2]), 2)
58+
59+
# Add the tag to outer shell first, as can use inner shell to identify set
60+
if length(intersect(ext1_shell_tags[1], ext3_shell_tags[2])) ==
61+
length(ext3_shell_tags[2])
62+
append!(ext3_shell_tags[2], vcat(metal_l1_tags, pattern_l1_tags))
63+
elseif length(intersect(ext1_shell_tags[1], ext3_shell_tags[3])) ==
64+
length(ext3_shell_tags[3])
65+
append!(ext3_shell_tags[3], vcat(metal_l1_tags, pattern_l1_tags))
66+
end
67+
if length(intersect(ext2_shell_tags[1], ext3_shell_tags[2])) ==
68+
length(ext3_shell_tags[2])
69+
append!(ext3_shell_tags[2], vcat(metal_l2_tags, pattern_l2_tags))
70+
elseif length(intersect(ext2_shell_tags[1], ext3_shell_tags[3])) ==
71+
length(ext3_shell_tags[3])
72+
append!(ext3_shell_tags[3], vcat(metal_l2_tags, pattern_l2_tags))
73+
end
74+
75+
append!(ext1_shell_tags[1], vcat(metal_l1_tags, pattern_l1_tags))
76+
append!(ext2_shell_tags[1], vcat(metal_l2_tags, pattern_l2_tags))
77+
78+
# Remove the volumes non recursively.
79+
SolidModels._synchronize!(sm)
80+
SolidModels.remove_group!(sm["ext1", 3], recursive=false, remove_entities=true)
81+
SolidModels.remove_group!(sm["ext2", 3], recursive=false, remove_entities=true)
82+
SolidModels.remove_group!(sm["ext3", 3], recursive=false, remove_entities=true)
83+
84+
# Add new volumes back in based on the shell loops
85+
ext1_shell = SolidModels.gmsh.model.occ.add_surface_loop(ext1_shell_tags[1])
86+
ext2_shell = SolidModels.gmsh.model.occ.add_surface_loop(ext2_shell_tags[1])
87+
88+
ext1_vtag = SolidModels.gmsh.model.occ.add_volume([ext1_shell])
89+
ext2_vtag = SolidModels.gmsh.model.occ.add_volume([ext2_shell])
90+
ext3_vtag =
91+
SolidModels.gmsh.model.occ.add_volume([ext3_shell[1], ext1_shell, ext2_shell])
92+
93+
SolidModels._synchronize!(sm)
94+
return sm
95+
end

test/test_schematic_solidmodel.jl

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,14 @@
302302
end
303303
end
304304

305+
end
306+
307+
@testitem "Schematic + SolidModel + Paths and Bridges" setup = [CommonTestSetup] begin
308+
using .SchematicDrivenLayout
309+
310+
reset_uniquename!()
311+
BASE_NEGATIVE = SemanticMeta(:base_negative)
312+
305313
function test_bridge(; meander=false, bridges=false)
306314
# Helper to define an airbridge
307315
function low_overlap_bridge(
@@ -403,9 +411,9 @@
403411

404412
# Setup an optional "fine mesh" size field.
405413
refinement_style = OptionalStyle(
406-
MeshSized(1.0μm, 0.9),
414+
MeshSized(1.0μm, 0.8),
407415
:finemesh,
408-
false_style=MeshSized(10.0μm, 1.0),
416+
false_style=MeshSized(10.0μm, 0.9),
409417
default=false
410418
)
411419
sizing = [
@@ -509,6 +517,7 @@
509517
)
510518

511519
sm = SolidModel("test", overwrite=true)
520+
# SolidModels.set_gmsh_option("")
512521
render!(sm, floorplan, target)
513522

514523
@test SolidModels.hasgroup(sm, "substrates", 3)
@@ -590,6 +599,16 @@
590599
@test length(SolidModels.entitytags(sm["vacuum", 3])) == 3
591600
end
592601
end
602+
end
603+
604+
@testitem "Schematic + SolidModel + Overlap Path" setup = [CommonTestSetup] begin
605+
using .SchematicDrivenLayout
606+
import .SchematicDrivenLayout: AbstractComponent
607+
608+
reset_uniquename!()
609+
BASE_NEGATIVE = SemanticMeta(:base_negative)
610+
611+
using LinearAlgebra
593612

594613
function overlap_path(; path_style, turn_radius=50μm)
595614

@@ -679,7 +698,7 @@
679698
)
680699

681700
sm = SolidModel("test", overwrite=true)
682-
render!(sm, floorplan, sm_target)
701+
@test_nowarn render!(sm, floorplan, sm_target)
683702
return sm
684703
end
685704

0 commit comments

Comments
 (0)