-
Notifications
You must be signed in to change notification settings - Fork 100
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
Bug fixed restrict(::AbstractArray,::TriangulationPortion)
for portions of BoundaryTriangulation(s)
#267
Bug fixed restrict(::AbstractArray,::TriangulationPortion)
for portions of BoundaryTriangulation(s)
#267
Conversation
TriangulationPortion(s) of BoundaryTriangulation(s)
Codecov Report
@@ Coverage Diff @@
## master #267 +/- ##
=======================================
Coverage 89.00% 89.00%
=======================================
Files 147 147
Lines 9646 9646
=======================================
Hits 8585 8585
Misses 1061 1061
Continue to review full report at Codecov.
|
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.
@amartinhuertas thanks for reporting! I am sure that this was difficult to spot...
In any case, I think that this simpler fix is enough:
function restrict(f::AbstractArray,trian::TriangulationPortion)
reindex(restrict(f,trian.oldtrian),trian)
end
Can you check if it works?
I tested it. It did not work (see output below). Hard to say from this output why it did not work. You can try to reproduce the current error in your machine if u like. I pushed your proposed fix in the branch underlying this PR. What's the rationale behind your proposed fix? (I do not fully understand it)
|
Wow this is very strange... the tests in travis are passing. In any case, I have found a "little" error in the fix I proposed. @amartinhuertas can you try if the following works ? function restrict(f::AbstractArray,trian::TriangulationPortion)
reindex(restrict(f,trian.oldtrian),trian.cell_to_oldcell)
end It also would be nice to find a test that only works with this last fix (if it ends up to be correct) and not with the previous one. |
Try with a case in which |
Great! Now it works. But I still do not understand the rationale behind your modified proposal. Can u please elaborate a little bit on it? Once I understand, then I can proceed with selecting a judicious test. Thanks! |
Sure! It is important to note that we have 3 different sets of cells:
Let's call function restrict(bgcell_to_f::AbstractArray,trian::TriangulationPortion)
oldcell_to_f = restrict(bgcell_to_f,trian.oldtrian)
cell_to_f = reindex(oldcell_to_f,trian.cell_to_oldcell)
return cell_to_f
end Written in this way, the code is self reveling. Another important thing to understand: oldcell_to_bgcell = get_cell_id(oldtrian)
cell_to_bgcell = get_cell_id(trian) That is, indices in |
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.
The tests are passing. However, I would wait to have the new test we were commenting so that we do not have a regression in this part.
Thanks for the explanation! Now I got the point. Your modification is clearly the way to go. Let me complement your explanation with two extra points that I think are true and helped me to understand the whole picture (can you please explicitly confirm/check that they are true?):
|
Done in 829bdb0! However, I have been trying to design a more clever test, without success. In particular, a test that spots the BUG that gives name to this PR: TriangulationPortion of BoundaryTriangulation. See the code I wrote so far below. The BUG was that the type of
|
@amartinhuertas can you solve the conflict? |
Correct. Be also aware that Dc in the discrete model can be smaller than Dp in general.
I think that in Gridap these are the two cases, however the number can increase since the code is extensible. E.g., in GridapEmbedded there are other cases. |
…trict_array_triangulation_portion_boundary_function
Yes, done. |
I think I will merge the PR even though this is not fixed since we need these devs in GridapDistributed ASAP. We can keep track of the pending test in an issue. |
Ok. Agreed. Can u create the issue? |
May the BUG also affect to GridapEmbedded? Have you think about that? |
Hi @fverdugo,
when working with
GridapDistributed.jl
, I figured out that the (current) implementation ofrestrict(::AbstractArray,::TriangulationPortion)
, available here is wrong whenever it is fed up with a portion of a triangulation that extendsBoundaryTriangulation
(or a portion of a portion ofBoundaryTriangulation
, a portion of a portion of a portion ofBoundaryTriangulation
, etc.). The current patch fixes the implementation ofrestrict
in such cases. It also immediately fixesrestrict(::AbstractArray,::TriangulationPortion)
for portions ofSkeletonTriangulation
s, as these rely on portions ofBoundaryTriangulation's
. I tested that this fix works withGridapDistributed.jl
, but I did not find a way to extend the current tests inGridap.jl
in order to test this feature. Any idea?@amartinhuertas