This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

adapt mesh function and refine mesh

0 votes

Hello,
i want to adapt a MeshFunction regarding an refined mesh.
I read my MeshFunction from a File
edge_numbers = dolfin.MeshFunction('uint',mesh,'dolfin_mesh/macro_mesh_func_edges.xml')
The file looks like:
<?xml version="1.0"?> <dolfin xmlns:dolfin="http://fenicsproject.org"> <mesh_function> <mesh_value_collection name="m" type="uint" dim="1" size="462"> <value cell_index="0" local_entity="0" value="19" /> <value cell_index="0" local_entity="1" value="0" /> ... </mesh_value_collection> </mesh_function> </dolfin>
and i also read my mesh from a file
mesh = dolfin.Mesh('dolfin_mesh/macro_dolfin.xml')
. Then i refine my mesh
ref_mesh = refine(mesh)
and adapt my mesh function
ref_edge_numbers = dolfin.adapt(edge_numbers,ref_mesh
and this results in an error
*** ------------------------------------------------------------------------- *** Error: Unable to adapt mesh function. *** Reason: Unable to extract information about parent mesh entites. *** Where: This error was encountered inside adapt.cpp. *** Process: 0 *** -------------------------------------------------------------------------
Can someone help me pls?

asked Feb 13, 2014 by maxb90 FEniCS Novice (770 points)

1 Answer

+1 vote

Hi, you should use

ref_mesh =adapt(mesh)

because in refine child-parent relations are not set.

answered Feb 13, 2014 by MiroK FEniCS Expert (80,920 points)
...