-
Notifications
You must be signed in to change notification settings - Fork 92
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
Add helper function bounding_box
#880
Conversation
Interesting problem - don't know why it is type unstable but could solve it if Tensors would support map Base.map(f, iters::T...) where {T<:AbstractTensor} = T(map(f, Tensors.get_data.(iters)...))
function compute_bounding_box(grid::AbstractGrid{dim}) where {dim}
T = get_coordinate_eltype(grid)
min_vertex = Vec{dim,T}(i->T(+Inf))
max_vertex = Vec{dim,T}(i->T(-Inf))
for node in getnodes(grid)
x = get_node_coordinate(node)
max_vertex = map(max, max_vertex, x)
min_vertex = map(min, min_vertex, x)
end
return min_vertex, max_vertex
end Somehow defining an output |
I asked on slack helpdesk, and got this reply:
|
Co-authored-by: Dennis Ogiermann <termi-official@users.noreply.github.com>
bouding_box
bouding_box
bounding_box
I think it can be nice to add some grid utils. In this PR I am adding
compute_bouding_box()
, which I have recently needed for some pre-processing stuff.Note. The current code is type unstable for some reason. Both
max_vertex
andmin_vertex
are bothCore.Box
. Anyone understands why?