Hi,
I have built an external cube mesh file using gmsh and dolfin-convert. There are two subdomains with labels 1 and 2 that make up the volume of the cube.
I have succesfully imported all relevant information using the following three lines.
mesh = Mesh("cube.xml")
subdomains = MeshFunction("size_t", mesh, "cube_physical_region.xml")
boundaries = MeshFunction("size_t", mesh, "cube_facet_region.xml")
I am unsure of how to manipulate the subdomains (I plan on defining poisson equation source terms on them). E.g. Instead of
V = FunctionSpace(mesh,'Lagrange',1)
func = project(1.0,V)
I would like to define func1 and func2 on subdomains 1 and 2.
Thanks
Edit: The manual suggests the following lines
V = FunctionSpace(mesh,'Lagrange',1)
func = Function(V)
func_values = [0,1.0,2.0]
for cell_no in range(len(subdomains.array())):
subdomain_no = subdomains.array()[cell_no]
func.vector()[cell_no] = func_values[subdomain_no]
but I get an error message saying the index cell_no is out of range.