Actually, I want to 'manually' add data to the paraview
output files produced by dolfin
.
As I understand, the paraview files contain the mesh topology (the vertices and how they are connected to triangles or tetraeders) and the data at the vertices.
If I have an FEM space of, say, quadratic order, there are not only dofs
at the vertices but also at the edges.
How can I extract the dofs
associated with the mesh vertices? (Such that I can append them to a vtu
file that was written by dolfin
)
In other words, I need the the array filter_vertices
, in the pseudo-code below
import dolfin
N = 5
# setup the function space and write an example output
sqmesh = dolfin.UnitSquareMesh(N, N+1)
V = dolfin.FunctionSpace(sqmesh, 'CG', 2)
xyfunc = dolfin.Expression('x[0]+x[1]')
v = dolfin.interpolate(xyfunc, V)
vfile = dolfin.File('testit.pvd')
vfile << v
# so far so good
# now I want to append the data on my own...
vvec = v.vector().array()
... # do some operations with vvec
vvec_at_vertices = vvec[filter_vertices] # extract the dofs at the mesh vertices
... # append vvec_at_vertices to the "testit.pvd" file manually
PS.: I want to do this not getting back to dolfin
, e.g. via v.set_local(vvec)
. So I really need this filter_vertices
vector explicitly.