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

adressing the entities and get the value

0 votes

I have defined the mesh and MeshFunction with "model.xml" and "model_physical_region.xml" data, so it's like:

mesh = Mesh("model.xml")
subdomains = MeshFunction("size_t", mesh, "model_physical_region.xml")

and my "model_physical_region.xml" data looks like:

<?xml version="1.0" encoding="UTF-8"?>
<dolfin xmlns:dolfin="http://fenicsproject.org">
  <mesh_function type="uint" dim="3" size="8">
    <entity index="0" value="1"/>
    <entity index="1" value="1"/>
    <entity index="2" value="2"/>
    <entity index="3" value="2"/>
    <entity index="4" value="3"/>
    <entity index="5" value="3"/>
    <entity index="6" value="4"/>
    <entity index="7" value="4"/>
  </mesh_function>
</dolfin>

I know how to get the entities' indices if I use the code like:

for cell in cells(subdomains.mesh()):
    print cell.index()

but I don't know how to parallel get the entities' values("1", "2", "3", "4") in the "model_physical_region.xml" data. I'll be appreciated to get the answer.

asked Oct 4, 2013 by kickccat FEniCS Novice (200 points)

1 Answer

0 votes
 
Best answer

Try:

for cell in cells(mesh):
    print subdomain[cell]
answered Oct 7, 2013 by johanhake FEniCS Expert (22,480 points)
selected Oct 7, 2013 by johanhake

Thanks, johanhake. That's solved my problem.

...