This can be a useful functionality. In my use case, I have a lot of source points generated separately from the mesh generation. These points are located on a surface, which may not exactly located on element sides when the surface is curved. For each source point, I need to put its contribution on a variable defined on the surface, which requires me to find a point on an element side that is closest to the source point. Currently, I am using a point locator to find an element side closes to the point and then call
const Point mapped_point = FEInterface::inverse_map(dim, elem_side, source_point);
to get the point on the reference element. The reference coordinates are probably outside of the reference element. But because the point is fairly close to the element, this inverse_map call is expected to be successful. I am thinking a quick sub-optimal way to fix mapped_point up so that it is inside the element. Tag @roystgnr because he mentioned he already had some code like this.
I made this a broader issue. For some special types of elements, like an edge, or a triangle, there exists algorithms to do this. But hopefully we can make this support general types of elements including high-order isoparametric elements.
This can be a useful functionality. In my use case, I have a lot of source points generated separately from the mesh generation. These points are located on a surface, which may not exactly located on element sides when the surface is curved. For each source point, I need to put its contribution on a variable defined on the surface, which requires me to find a point on an element side that is closest to the source point. Currently, I am using a point locator to find an element side closes to the point and then call
to get the point on the reference element. The reference coordinates are probably outside of the reference element. But because the point is fairly close to the element, this
inverse_mapcall is expected to be successful. I am thinking a quick sub-optimal way to fixmapped_pointup so that it is inside the element. Tag @roystgnr because he mentioned he already had some code like this.I made this a broader issue. For some special types of elements, like an edge, or a triangle, there exists algorithms to do this. But hopefully we can make this support general types of elements including high-order isoparametric elements.