dolfin.compilemodules.subdomains.CompiledSubDomain(cppcode, mpi_comm=None, **kwargs)

Compile a C++ string expression into a SubDomain instance.

a string containing an expression in C++ syntax.

If the string contains a name, it is assumed to be a scalar variable name, and is added as a public member of the generated subdomain. All such members need a default initial value.

If the string contains a class name it is interpreted as a complete implementations of subclasses of SubDomain.

Examples of usage

left  = CompiledSubDomain("near(x[0], 0) && on_boundary")
right = CompiledSubDomain("near(x[1], 1) && on_boundary")
center = CompiledSubDomain("near(x[1], c)", c = 0.5)