-
Notifications
You must be signed in to change notification settings - Fork 93
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
Extract boundary entities + getfaceedges helper #606
Extract boundary entities + getfaceedges helper #606
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I left some comments which we should discuss.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR is really taking shape! I think we are close to the finish line here. I have left some comments.
Also, you need to merge the master branch (updated over the last few days) to see the developer API docs which I refer to. Tell me if you run into trouble.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just few cosmetic suggestions
Codecov ReportPatch coverage:
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## master #606 +/- ##
==========================================
- Coverage 92.90% 92.85% -0.05%
==========================================
Files 30 30
Lines 4324 4378 +54
==========================================
+ Hits 4017 4065 +48
- Misses 307 313 +6
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the PR really looks great! Thanks for your work. I have a last minor thing to fix (i.e. test should always be inside testsets to not leak any information) and if the CI does not fail, then things are fine from my side.
cc @fredrikekre
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I totally missed that tests for 3D are missing in the PR. Did we just discuss it in the comments/slack? Anyway, can you provide the test coverage for 3D grids? (Prism, Tet, Hex) I think we really can need the helpers in this PR for a full automated consistency check of interpolation implementations. :)
I also have a quick question on one of the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some found something to improve an the API and performance. Feel free to skip the stuff in grid.jl
. However, I think there is some test missing (or lost during rebase?).
src/Grid/grid.jl
Outdated
function getinstances(grid::AbstractGrid, topology::ExclusiveTopology, entity::T, _ftype::Function, _indextype::Type) where T <: BoundaryIndex | ||
_set = Set{_indextype}() | ||
cells = getcells(grid) | ||
cell = cells[entity[1]] | ||
verts = _ftype(cell)[entity[2]] #_fparent returns global vertices ids of face/edge. _fentities transforms them to pairs for edges. | ||
for cell_idx in topology.vertex_to_cell[verts[1]] #∩([topology.vertex_to_cell[vert] for vert in verts]...) took couple seconds more in testing than topology.vertex_to_cell[verts[1]] | ||
entity_idx = findfirst(_x-> all( [x ∈ verts for x in _x]),_ftype(cells[cell_idx])) | ||
!isnothing(entity_idx)&& push!(_set, _indextype(cell_idx, entity_idx)) | ||
end | ||
return _set | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might be able to speed these functions up with code generators instead of passing the types and functions by hand. See e.g. https://github.com/Ferrite-FEM/Ferrite.jl/blob/master/src/Grid/grid.jl#L948-L961 . If it is too difficult to setup, then feel free to skip this comment. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (try 2) @fredrikekre
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 docstring typos
8d3009e
to
14284ce
Compare
I pushed some formatting changes and squashed. Also changed Thanks for the contribution, and sorry for the slow review! |
This patch adds `addboundaryfaceset!`, `addboundaryedgeset!`, `addboundaryvertexset!` for adding entities that are located on the boundary (defined as no cell neighbor). In addition, this adds internal functions for getting subentites from entities and various other helpers (`getfaceedges`, `getfacevertices`, `getedgevertices`, `getfaceinstances`, `getedgeinstances`, `getvertexinstances`, `filterfaces`, `filteredges`, `filtervertices`). Fixes Ferrite-FEM#595.
14284ce
to
b71f0d0
Compare
fixes #595 (
addboundaryfaceset!
,addboundaryedgeset!
,addboundaryvertexset!
) and adds helper functions to get face/edge edges/vertices (getfaceedges
,getfacevertices
,getedgevertices
).