Skip to content

Conversation

@termi-official
Copy link
Member

This allows e.g. views to be used.

@codecov
Copy link

codecov bot commented Nov 24, 2025

Codecov Report

❌ Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.19%. Comparing base (65773c2) to head (1a52829).

Files with missing lines Patch % Lines
src/Dofs/DofHandler.jl 66.66% 1 Missing ⚠️
src/Grid/grid.jl 85.71% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1252   +/-   ##
=======================================
  Coverage   94.19%   94.19%           
=======================================
  Files          40       40           
  Lines        6662     6662           
=======================================
  Hits         6275     6275           
  Misses        387      387           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@KnutAM KnutAM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some quick comments due to slack-ping :)

Comment on lines +207 to 212
function celldofs!(global_dofs::AbstractVector{Int}, dh::DofHandler, i::Int)
@assert isclosed(dh)
@assert length(global_dofs) == ndofs_per_cell(dh, i)
unsafe_copyto!(global_dofs, 1, dh.cell_dofs, dh.cell_dofs_offset[i], length(global_dofs))
return global_dofs
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think allowing AbstractVector is not compatible with using unsafe_copyto! here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @fredrikekre I guess we need to variants here then? One on Vector with unsafe_copyto and one with just copyto. Is there a reason why this is not simply copyto!?

Comment on lines 588 to 591
node_ids = get_node_ids(cell)
@inbounds for i in 1:length(x)
x[i] = get_node_coordinate(grid, node_ids[i])
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1:length(x) should be used for AbstractVector (and the use of @inbounds here seems highly questionable, seems like out of bounds can occur by just passing a too long vector x, but that is unrelated).

Both could be fixed though with

Suggested change
node_ids = get_node_ids(cell)
@inbounds for i in 1:length(x)
x[i] = get_node_coordinate(grid, node_ids[i])
end
node_ids = get_node_ids(cell)
@boundscheck checkbounds(x, 1:length(node_ids))
@inbounds for (i, node_id) in enumerate(node_ids)
x[i] = get_node_coordinate(grid, node_id)
end

Comment on lines +612 to 615
function _cellnodes!(global_nodes::AbstractVector{Int}, cell::AbstractCell)
@assert length(global_nodes) == nnodes(cell)
@inbounds for i in 1:length(global_nodes)
global_nodes[i] = cell.nodes[i]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as getcoordinates! (needs @boundscheck checkbounds + enumerate) (and while at it, perhaps use get_node_ids?)

@termi-official termi-official marked this pull request as draft November 24, 2025 21:28
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

Successfully merging this pull request may close these issues.

3 participants