In the examples I've seen so far that deals with constructing subdomains out of a mesh, the subdomains could always be defined fairly simple like, for example:
class Omega0(SubDomain):
def inside(self, x, on_boundary):
return True if x[1] <= 0.5 else False
However, in my case, I just can't define inside in this way. My mesh is slightly more complex and I cringe at the thought of having to check the point against all of the subdomain's tetrahedron cell (by this method for example).
My mesh is constructed out of the geometry from another program, so I have the indices for the cells of the various subdomains. Assuming DOLFIN doesn't rearrange the cells and scramble the indices when I load my mesh, there should be some simple way of just marking these cells by their index in the loaded Mesh (or MeshFunction?) to their corresponding subdomain. However I can't seem to figure out how to do this.
As an example, say if have 5 cells in my mesh, and indices 0-2 is in subdomain A and indices 3-4 is in subdomain B.