Ferrite-FEM / FerriteGmsh.jl

MIT License
14 stars 7 forks source link

function barrier to speedup tofacesets #31

Closed KnutAM closed 1 year ago

KnutAM commented 1 year ago

Fixes https://github.com/Ferrite-FEM/Ferrite.jl/issues/770 (friday procrastination)

Test script master: 45.837502 seconds (758.80 M allocations: 58.793 GiB, 11.57% gc time) Test script PR: 1.159389 seconds (313.52 k allocations: 20.954 MiB, 1.54% gc time)

Test script ```julia using Gmsh using FerriteGmsh function setup_grid(hR, Z, r) gmsh.initialize() gmsh.model.add("mesh") gmsh.model.occ.addBox( -0.5, -0.5, 0.0-hR, 1., 1., Z, 1) gmsh.model.occ.addCone( 0., 0., 0.0-hR, 0.,0.,hR, r,0., 2) gmsh.model.occ.cut([(3,1)], [(3,2)], 3) gmsh.model.occ.synchronize() gmsh.model.addPhysicalGroup(3, [3], -1, "sample") gmsh.model.addPhysicalGroup(2, [1], -1, "leftX") gmsh.model.addPhysicalGroup(2, [2], -1, "leftY") gmsh.model.addPhysicalGroup(2, [3], -1, "topZ") gmsh.model.addPhysicalGroup(2, [4], -1, "rightY") gmsh.model.addPhysicalGroup(2, [5,7], -1, "bottomZ") gmsh.model.addPhysicalGroup(2, [6], -1, "rightX") gmsh.model.mesh.setSizeCallback((dim, tag, x, y, z, lc) -> 0.07) gmsh.model.mesh.generate(3) gmsh.write("mesh.msh") gmsh.finalize() grid = togrid("mesh.msh") return grid end @time setup_grid(1, 2, 0.4) ```
koehlerson commented 1 year ago

Cool thanks!

termi-official commented 1 year ago

Good catch and thanks Knut! Can't believe that the soluation is that simple.