I am working with a 0th order DG L2 FES on a 2D mesh. I have created a gridfunction and projected a scalar field onto it.
I am trying to group elements together based on the value of the scalar field in each element, and later output that grouping back into a different gridfunction (same FES) to visualize the results.
I know that the mesh will provide me with all of the faces (which for a 2D are the elements) using mesh.faces
. I naively assumed that gfu.vec[face.nr] would store the value associated with a given face.
Testing this, I found that this isn’t true. Using:
gfu = GridFunction(fes)
for face in mesh.faces:
gfu.vec[face.nr] = face.nr
I then export to vtk and compare the verticies of the element which has a specific value of face.nr and the vertex coordinates given by vertex.point for the verticies in face.verticies.
So, is there a built-in way to get this mapping so that I can read/write a value from gfu.vec given a face (a MeshNode)?
Alex