From 5a68475d6638cfbd5876724590867eb24e386fc5 Mon Sep 17 00:00:00 2001 From: Joshua Tetzner Date: Tue, 23 Jun 2026 11:04:19 +0200 Subject: [PATCH] Type instability of AbstractMesh Restore type stability for SubMesh by storing the concrete supermesh type. --- src/submesh.jl | 4 ++-- src/weld.jl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/submesh.jl b/src/submesh.jl index 9b2e1b5..83b789a 100644 --- a/src/submesh.jl +++ b/src/submesh.jl @@ -41,8 +41,8 @@ function submesh(sm::Mesh, bm::Mesh) end -mutable struct SubMesh{U,D1,T} <: AbstractMesh{U,D1,T} - supermesh::AbstractMesh{U,D1,T} +mutable struct SubMesh{U,D1,T,S<:AbstractMesh{U,D1,T}} <: AbstractMesh{U,D1,T} + supermesh::S sub2sup::Vector{Int} sup2sub::Vector{Int} # cells::Vector{SVector{D1,Int}} diff --git a/src/weld.jl b/src/weld.jl index 84f1886..40113a4 100644 --- a/src/weld.jl +++ b/src/weld.jl @@ -190,7 +190,7 @@ function weld(G1::SComplex2D, G2::SComplex2D; seam) vcat(G1.faces, Faces2)) end -@generated function map_ids(c::SimplexGraph{N}, idmap) where {N,T} +@generated function map_ids(c::SimplexGraph{N}, idmap) where {N} xp = :(SimplexGraph()) for i in 1:N push!(xp.args, :(idmap[c[$i]]))