Skip to content

Commit

Permalink
Fix performance of tocellsets (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianpech committed Sep 4, 2024
1 parent f302aee commit 5f90c1b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/FerriteGmsh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ end

function tocellsets(dim::Int, global_elementtags::Vector{Int})
cellsets = Dict{String,Set{Int}}()
element_to_cell_mapping = Dict(zip(global_elementtags, eachindex(global_elementtags)))
physicalgroups = gmsh.model.getPhysicalGroups(dim)
for (_, physicaltag) in physicalgroups
gmshname = gmsh.model.getPhysicalName(dim, physicaltag)
Expand All @@ -159,7 +160,7 @@ function tocellsets(dim::Int, global_elementtags::Vector{Int})
_, elementtags, _= gmsh.model.mesh.getElements(dim, entity)
elementtags = reduce(vcat,elementtags) |> x-> convert(Vector{Int},x)
for ele in elementtags
push!(cellsetelements, findfirst(isequal(ele), global_elementtags))
push!(cellsetelements, element_to_cell_mapping[ele])
end
cellsets[name] = cellsetelements
end
Expand Down

0 comments on commit 5f90c1b

Please sign in to comment.