Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type unstable allchildren() #43

Open
lijas opened this issue May 2, 2023 · 0 comments
Open

Type unstable allchildren() #43

lijas opened this issue May 2, 2023 · 0 comments

Comments

@lijas
Copy link

lijas commented May 2, 2023

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant