I would like to create a GridFunction (e.g. a higher order Lagrange finite element function), but the “expression” is not explicitly given. I can only evaluate the “expression” at discrete points (with arbitrary coordinates).

For example, I would like to compute the closest point (in an array) to a given “grid point”. In principle, I would just find the coordinates of all the DoFs in my GridFunction, and evaluate my “expression” at those points.

However, as has been pointed out in many other posts, NGSolve uses hierarchical basis, so the explicit coordinates of those DoFs is not available. So how can I interpolate my expression into a higher order FE space?

In another post, Joachim said this:

“We can exchange data in integration points. For that, we dump our integration points, and you provide function values in these points.”

So, do I just get the integration points for my GridFunction, and evaluate my “expression” with those? If so, then how do I get the values of my “expression” back into the GridFunction?

-Shawn