|
| 1 | +import gmsh |
| 2 | +import assembly_mesh_plugin.plugin |
| 3 | +from tests.sample_assemblies import ( |
| 4 | + generate_nested_boxes, |
| 5 | + generate_simple_nested_boxes, |
| 6 | + generate_test_cross_section, |
| 7 | + generate_assembly, |
| 8 | +) |
| 9 | + |
| 10 | + |
| 11 | +def test_simple_assembly(): |
| 12 | + """ |
| 13 | + Tests to make sure that the most basic assembly works correctly with tagging. |
| 14 | + """ |
| 15 | + |
| 16 | + # Create the basic assembly |
| 17 | + assy = generate_simple_nested_boxes() |
| 18 | + |
| 19 | + # Create a mesh that has all the faces tagged as physical groups |
| 20 | + assy.saveToGmsh(mesh_path="tagged_mesh.msh") |
| 21 | + |
| 22 | + gmsh.initialize() |
| 23 | + |
| 24 | + gmsh.open("tagged_mesh.msh") |
| 25 | + |
| 26 | + # Check the solids for the correct tags |
| 27 | + physical_groups = gmsh.model.getPhysicalGroups(3) |
| 28 | + for group in physical_groups: |
| 29 | + # Get the name for the current volume |
| 30 | + cur_name = gmsh.model.getPhysicalName(3, group[1]) |
| 31 | + |
| 32 | + assert cur_name in ["shell", "insert"] |
| 33 | + |
| 34 | + # Check the surfaces for the correct tags |
| 35 | + physical_groups = gmsh.model.getPhysicalGroups(2) |
| 36 | + for group in physical_groups: |
| 37 | + # Get the name for this group |
| 38 | + cur_name = gmsh.model.getPhysicalName(2, group[1]) |
| 39 | + |
| 40 | + # Skip any groups that are not tagged explicitly |
| 41 | + if "_surface_" in cur_name: |
| 42 | + continue |
| 43 | + |
| 44 | + assert cur_name in ["shell_inner-right", "insert_outer-right", "in_contact"] |
0 commit comments