[FESpaceWithLinearConstraints] get_cell_isconstrained of empty portions
- Dominant language
- Julia
- Stars
- 879
- Forks
- 119
- Avg merge
- 6d 3h
- Merged PRs (30d)
- 4
Description
Hello, at the moment, any cell of a `FESpaceWithLinearConstraints` is constrained:
https://github.com/gridap/Gridap.jl/blob/7384190f13a8544163ab5a10e9d5add0a7360f95/src/FESpaces/FESpacesWithLinearConstraints.jl#L499-L503
IIRC, the current implementation of `FESpacesWithLinearConstraints` reorders the local DoFs, even if the cell has no constrained DoFs. For this reason, we always have to multiply by the constraint matrix (in case of no constrained DoFs in the cell, it's just a reordering of the cell).
Unfortunately, the `cell_isconstrained` of an _empty_ portion of the triangulation of a `FESpaceWithLinearConstraints` is a `Fill(true,0)` that leads to the code crashing, while attempting to multiply an empty local matrix by the local matrix of constraints.
https://github.com/gridap/Gridap.jl/blob/7384190f13a8544163ab5a10e9d5add0a7360f95/src/Arrays/CachedArrays.jl#L160-L163
In the [patch_for_cell_isc_empty_trians](https://github.com/gridap/Gridap.jl/tree/patch_for_cell_isc_empty_trians) I have implemented a possible fix.
https://github.com/gridap/Gridap.jl/blob/7384190f13a8544163ab5a10e9d5add0a7360f95/src/FESpaces/FESpacesWithLinearConstraints.jl#L505-L508
@JordiManyer: I've seen you've optimised `get_cell_isconstrained` in branch `constraints`. How does it handle the above degenerate case? Thanks a lot.
Contributor guide
Research direction
Start at get_cell_isconstrained in src/FESpaces/FESpacesWithLinearConstraints.jl and the empty-portion handling in src/Arrays/CachedArrays.jl. Compare the proposed behavior in the patch_for_cell_isc_empty_trians branch with the constraints branch, then verify that empty triangulation portions no longer crash during constraint-matrix multiplication while nonempty behavior is preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100