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

How to use check_midpoint in a mesh function?

0 votes

I want to use a SubDomain to set the values in a edge function and, since the subdomain is a curve, I want to set check_midpoint to be false (so an edge is set if its vertices are on the curve, even if its midpoint is not on the curve). Looking at the documentation, I thought this would work:

from dolfin import *
from mshr import *
domain = Circle(Point(0, 0), 1) - Circle(Point(0, 0), .5)
mesh = generate_mesh(domain, 10)
mf = MeshFunction("size_t", mesh, 1)
mf.set_all(0)
class Outerboundary(SubDomain):
    def inside(self, x, on_boundary):
        return x[0]**2 + x[1]**2 > .999 and on_boundary
outerboundary = Outerboundary()
outerboundary.mark(mf, 1, check_midpoint=False)

but it gives the error message

TypeError: mark() got an unexpected keyword argument 'check_midpoint'

What's the correct way to set check_midpoint to False?

asked Apr 9, 2015 by dnarnold FEniCS User (2,360 points)
edited Apr 9, 2015 by dnarnold

1 Answer

+2 votes
 
Best answer

Hi, I work with curved boundaries as well. A quick look at some code -- which a colleague of mine wrote -- tells me that the following should work:

outerboundary.mark(mf, 1, False)
answered Apr 9, 2015 by Gregor Mitscha-Baude FEniCS User (2,280 points)
selected Apr 9, 2015 by dnarnold
...