|
5 | 5 | generate_simple_nested_boxes, |
6 | 6 | generate_test_cross_section, |
7 | 7 | generate_assembly, |
| 8 | + generate_subshape_assembly, |
8 | 9 | ) |
9 | 10 |
|
10 | 11 |
|
@@ -42,3 +43,39 @@ def test_simple_assembly(): |
42 | 43 | continue |
43 | 44 |
|
44 | 45 | assert cur_name in ["shell_inner-right", "insert_outer-right", "in_contact"] |
| 46 | + |
| 47 | + |
| 48 | +def test_subshape_assembly(): |
| 49 | + """ |
| 50 | + Tests whether subshapes in assemblies get exported to physical groups in the resulting mesh. |
| 51 | + """ |
| 52 | + |
| 53 | + # Generate a simple assembly with a subshape |
| 54 | + assy = generate_subshape_assembly() |
| 55 | + |
| 56 | + # Create a mesh that has all the faces tagged as physical groups |
| 57 | + assy.saveToGmsh(mesh_path="tagged_subshape_mesh.msh") |
| 58 | + |
| 59 | + gmsh.initialize() |
| 60 | + |
| 61 | + gmsh.open("tagged_subshape_mesh.msh") |
| 62 | + |
| 63 | + # Check the solids for the correct tags |
| 64 | + physical_groups = gmsh.model.getPhysicalGroups(3) |
| 65 | + for group in physical_groups: |
| 66 | + # Get the name for the current volume |
| 67 | + cur_name = gmsh.model.getPhysicalName(3, group[1]) |
| 68 | + |
| 69 | + assert cur_name in ["cube_1"] |
| 70 | + |
| 71 | + # Check the surfaces for the correct tags |
| 72 | + physical_groups = gmsh.model.getPhysicalGroups(2) |
| 73 | + for group in physical_groups: |
| 74 | + # Get the name for this group |
| 75 | + cur_name = gmsh.model.getPhysicalName(2, group[1]) |
| 76 | + |
| 77 | + # Skip any groups that are not tagged explicitly |
| 78 | + if "_surface_" in cur_name: |
| 79 | + continue |
| 80 | + |
| 81 | + assert cur_name in ["cube_1_cube_1_top_face"] |
0 commit comments