The mesh (domain) is not extracted from the subdomain_data. This should
work:

   dxs = dx(domain=mesh, subdomain_data=cell_domains)
   a0 = c*dxs(0)
   dss = ds(domain=mesh, subdomain_data=exterior_facet_domains)
   a1 = c*dss(0)

Note that I prefer the notation dx(subdomain_data=markers) instead of the
old dx[markers].
It can also be used inline:

   a0 = c*dx(0, domain=mesh, subdomain_data=cell_domains)
   a1 = c*ds(0, domain=mesh, subdomain_data=exterior_facet_domains)

Martin



On 22 May 2014 12:53, Garth N. Wells <[email protected]> wrote:

> I'm trying to switch some code to the new syntax for associating domains
> with measures, but I'm having trouble with the below code from the unit
> tests in test/unit/fem/python/Assembler.py:
>
>    # Mark mesh functions
>    D = mesh.topology().dim()
>    cell_domains = MeshFunction("size_t", mesh, D)
>    exterior_facet_domains = MeshFunction("size_t", mesh, D - 1)
>    cell_domains.set_all(1)
>    exterior_facet_domains.set_all(1)
>    my_domain.mark(cell_domains, 0)
>    my_boundary.mark(exterior_facet_domains, 0)
>
>    # Define forms
>    c = Constant(1.0)
>
>    dxs = dx[cell_domains]
>    a0 = c*dxs(0)
>    dss = ds[exterior_facet_domains]
>    a1 = c*dss(0)
>
>    # Old syntax
>    self.assertAlmostEqual(assemble(a0, mesh=mesh), 0.25)
>    self.assertAlmostEqual(assemble(a1, mesh=mesh), 1.0)
>
>    # New syntax that I expected to work, but I get a DOLFIN error
>    self.assertAlmostEqual(assemble(a0), 0.25)
>    self.assertAlmostEqual(assemble(a1), 1.0)
>
> I expected the last two lines to work, but I get the error:
>
>    assert form.domains(), "Expecting a completed form with domains at this
> point."
> AssertionError: Expecting a completed form with domains at this point.
>
> Garth
>
> _______________________________________________
> fenics mailing list
> [email protected]
> http://fenicsproject.org/mailman/listinfo/fenics
>
_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics

Reply via email to