Open amartinhuertas opened 1 year ago
Hi @amartinhuertas , I agree it is a problem. I think I can explain the reasoning behind the current implementation.
All of this comes from the assumption that we can only deal with reference coordinates when changing between adapted meshes.
When the target domain is the reference domain, I can simply do the change. I believe the functions that do that also check if the triangulations are the same and optimizes accordingly.
When the target domain is the physical domain, we have to do the change in the reference space then convert to physical coordinates. If the input cellfield is in physical domain, that indeed involves all the steps you mention. From what I see, the function that does this (second one you posted) does not check if the triangulations are the same.
When I come back Ill have a look at this and see if we can make the whole implementation more compact/coherent. But I do think you have a point.
When I come back Ill have a look at this and see if we can make the whole implementation more compact/coherent. But I do think you have a point.
No hurries. Enjoy your holidays. We talk when you are back.
Related to PR #886
PR #886 solves the issue discussed here, but we believe there is still some room for improvement. More precisely, we believe some edge/weird cases can still be optimized (for instance when changing between TriangulationViews
). We will look at it in the future.
Hi @JordiManyer,
when I run the following MWE:
I obtain:
in the first call to
print_op_tree
, whilein the second.
You will see the sequence composition of the direct, inverse, and direct geometrical mappings. This is inefficient, as only a single composition with the direct mapping is enough, as you can see in the second case.
The first call to
change_domain
is triggered when you, e.g., substractcf
and a FE functionuh
. Namely, from the_to_common_domain(a::CellField...)
Gridap.jl function ... so it is a quite frequent case.In regards to why it happens, it is because the way
change_domain
is defined forAdaptedTriangulation
s:An immediate way around this, it to modify the definition of the first
change_domain
right above by:BUT ... is there something else I might be missing??? First, is the current implementation of
change_domain
forAdaptiveTriangulation
s reasonable, if yes why? Second, can it be that we are somehow assuming that the target and source triangulations have to be different for this method to be the way to go?