RegionTrees.jl icon indicating copy to clipboard operation
RegionTrees.jl copied to clipboard

Type unstable allchildren()

Open lijas opened this issue 2 years ago • 0 comments

root = RegionTrees.Cell(SVector(0., 0), SVector(1., 1))
split!(root)
split!(root[1,1])

function run(root)
    for c in RegionTrees.allleaves(root)
        a = c.boundary.origin + c.boundary.widths
        #@show a
    end
end

@code_warntype run(root)

shows that c is ::Any .

A simple solution would be adding types in allleaves()

function allleaves(cell::RegionTrees.Cell{Data, N, T, L}) where {Data, N, T, L}
    Channel{RegionTrees.Cell{Data, N, T, L}}() do c
        for child in allcells(cell)
            if RegionTrees.isleaf(child)
                put!(c, child)
            end
        end
    end
end

lijas avatar May 02 '23 14:05 lijas