Consider the exmaple below. In the first case there is a zero at the interface instead of 1 or 2. The second case works.
It looks like the between function already accounts for DOLFIN_EPS but this does not make subdomain marking robust enough. Why do I have to define mesh dependent epsilons for my regions to overlap correctly in this case? It seems to me both regions are defined correctly plus minus DOLFIN_EPS.
from dolfin import *
mesh = UnitIntervalMesh(101)
def region1(x,on_boundary):
return between(x[0],(0.0,0.5))
def region2(x, on_boundary):
return between(x[0],(0.5,1.0))
r1 = AutoSubDomain(region1)
r2 = AutoSubDomain(region2)
f = CellFunction('size_t',mesh)
r1.mark(f,1)
r2.mark(f,2)
print f.array() #missing a cell here
hmin = mesh.hmin()
def region1(x,on_boundary):
return between(x[0],(0.0,0.5+hmin))
def region2(x, on_boundary):
return between(x[0],(0.5,1.0))
r1 = AutoSubDomain(region1)
r2 = AutoSubDomain(region2)
f = CellFunction('size_t',mesh)
r1.mark(f,1)
r2.mark(f,2)
print f.array() #all cells are marked