Hi,
I am trying to write a Matlab script that creates a dolfin xml file containing a function. I have successfully written a script to write an xml mesh file, but I am struggling with the function file (can't find any documentation on this, sorry for the question if I have missed it). To try to understand the contents of an xml function file, I created a simple file as follows, which just writes the constant 8.5 on a 2x2 square mesh (i.e. 3x3=9 nodes).
from dolfin import *
mesh = UnitSquareMesh(2,2)
V = FunctionSpace(mesh, "CG", 1)
f = Function(V)
c = Constant(8.5)
f.interpolate(c)
File('func.xml') << f
The output file func.xml is as follows:
<?xml version="1.0"?>
<dolfin xmlns:dolfin="http://fenicsproject.org">
<function_data size="9">
<dof index="0" value="8.5" cell_index="5" cell_dof_index="1" />
<dof index="1" value="8.5" cell_index="1" cell_dof_index="1" />
<dof index="2" value="8.5" cell_index="4" cell_dof_index="2" />
<dof index="3" value="8.5" cell_index="0" cell_dof_index="0" />
<dof index="4" value="8.5" cell_index="0" cell_dof_index="2" />
<dof index="5" value="8.5" cell_index="6" cell_dof_index="2" />
<dof index="6" value="8.5" cell_index="0" cell_dof_index="1" />
<dof index="7" value="8.5" cell_index="2" cell_dof_index="2" />
<dof index="8" value="8.5" cell_index="2" cell_dof_index="1" />
</function_data>
</dolfin>
I assume 'dof index' refers to the 9 nodes, 'value' is obvious, but I don't understand the meaning of 'cell_index' or 'cell_dof_index'. If I wanted to create func.xml from outside of fenics, how would I determine these values? I tried setting these all to zero, but that seems to cause problems when reading/plotting the function.
Thanks.