1# See the corresponding Python tutorial for detailed comments.
2
3import gmsh
4
5gmsh.initialize()
6
7gmsh.model.add("t16")
8
9gmsh.model.occ.addBox(0,0,0, 1,1,1, 1)
10gmsh.model.occ.addBox(0,0,0, 0.5,0.5,0.5, 2)
11gmsh.model.occ.cut([(3,1)], [(3,2)], 3)
12
13x = 0; y = 0.75; z = 0; r = 0.09
14
15holes = []
16for t in 1:5
17    global x, z
18    x += 0.166
19    z += 0.166
20    gmsh.model.occ.addSphere(x,y,z,r, 3 + t)
21    t = (3, 3 + t)
22    push!(holes, t)
23end
24
25ov = gmsh.model.occ.fragment([(3,3)], holes)
26gmsh.model.occ.synchronize()
27
28lcar1 = .1
29lcar2 = .0005
30lcar3 = .055
31
32ov = gmsh.model.getEntities(0);
33gmsh.model.mesh.setSize(ov, lcar1);
34
35ov = gmsh.model.getBoundary(holes, false, false, true);
36gmsh.model.mesh.setSize(ov, lcar3);
37
38eps = 1e-3
39ov = gmsh.model.getEntitiesInBoundingBox(0.5-eps, 0.5-eps, 0.5-eps,
40                                         0.5+eps, 0.5+eps, 0.5+eps, 0)
41gmsh.model.mesh.setSize(ov, lcar2)
42
43gmsh.model.mesh.generate(3)
44
45gmsh.write("t16.msh")
46
47if !("-nopopup" in ARGS)
48    gmsh.fltk.run()
49end
50
51gmsh.finalize()
52