Compute the mapping from the physical coordinate system for a given element to the canonical reference element.
dim - the element dimension (1=EDGE, 2=QUAD/TRI, 3=HEX/TET)
nverts - the number of vertices in the physical element
coordinates - the coordinates of vertices in the physical element
xphy - the coordinates of physical point for which natural coordinates (in reference frame) are sought
natparam - the natural coordinates (in reference frame) corresponding to xphy
phi - the basis functions evaluated at the natural coordinates (natparam)
In addition to finding the inverse mapping evaluation through Newton iteration, the basis function at the parametric point is also evaluated optionally.