How to get the interpolation points ? And elvaute interpolation value and derivatives on integration points?

I want to get interpolation points to construct a graph for ML computation, and the value/derivate of the interpolation function on integration points (such as Gaussian points), and integration weights to integrate residual over elements to get the loss function.

It corresponds to the following three questions. I am using dolfin rather than dolfinx.

  1. I use the following code to get the interpolation points of each cell. I am wondering if there is a global list of interpolation points and indices to them of each cell? And correspondingly, is there a global list of DOF and indices to them of each cell?
# Define a function space on the mesh
V = FunctionSpace(mesh, "Lagrange", 2)

# Get the finite element
element = V.element()

# Get the coordinates of the interpolation points
points = element.tabulate_dof_coordinates(Cell(mesh, 0))
# points = np.array([element.tabulate_dof_coordinates(cell) for cell in cells(mesh)])

# Print the coordinates
for i, point in enumerate(points):
    print("Interpolation point %d: %s" % (i, point))
  1. How to get the integration points of elements (cells), such as Gaussian points and weights?

  2. How to get the value of the interpolation function and its derivatives on integration points?

Note that V.tabulate_dof_coordinates() gives you all dof coordinates on your process. You can in turn use V.dofmap().cell_dofs(i)` to Get the indices for the ith cell.

You have already asked questions regarding this at: How to get Gaussian integration point directly on a mesh element/cell? - #2 by dokken

In legacy dolfin this is not straightforward, as you would have to evaluate the basis functions and then combine them to be the function at that point. See Properly calling evaluate basis derivatives all() function in python - #3 by Ryan_Vogt2

In DOLFINx, you have a larger variety of quadrature rules, as well as the possibility to evaluate function derivatives at any point in the cell (including interpolation points). See for instance Solving a time-dependent problem — FEniCS 22 tutorial