Rename domain_data, domain_id to subdomain_data, subdomain_id (ufl,ffc,dolfin)

Issue #275 resolved
Martin Sandve Alnæs created an issue

There is an unfortunate and nonintuitive naming clash between my new "Domain" class in ufl and the lazy naming of subdomain information using 'domain' in many places.

Of course the subdomain should not be mixed up with the domain, therefore the 'sub' part of the name, so I suggest we rename everywhere that's inconsistent.

A couple of renames to do in UFL which will affect dolfin as well:

  dx.domain_data() -> dx.subdomain_data()
  dx.domain_id() -> dx.subdomain_id()

In particular note that in many cases this confusing statement will hold:

  dx = dx(domain=mesh, domain_data=cellfunction)
  assert dx.domain().data() == mesh
  assert dx.domain_data() == cellfunction

while this would be more understandable:

  dx = dx(domain=mesh, subdomain_data=cellfunction)
  assert dx.domain().data() == mesh
  assert dx.subdomain_data() == cellfunction

Because previously, subdomain data has been attached to ufl.Measure using the syntax dx[cellfunction], I don't think renaming domain_data to subdomain_data will cause any trouble.

Comments (10)

  1. Martin Sandve Alnæs reporter

    And also there are other places in dolfin which use the name 'domain' where 'subdomain' would be more appropriate. I suggest renaming those as well, even if its only internal variable names, as it causes confusion.

  2. Martin Sandve Alnæs reporter

    And mesh.domains(), that's not right either. But I'd rather see we remove it than rename it, since we're not actually using the mesh.domains() in the assembler.

  3. Martin Sandve Alnæs reporter

    Nobody seems to care, which I guess mean people will probably keep calling subdomains 'domains', and this is a bit of work, so I'll just let it be for now.

  4. Martin Sandve Alnæs reporter

    My last comment here was not quite correct. I have renamed

    • domain_id -> subdomain_id
    • domain_data -> subdomain_data
    • domain_type -> integral_type

    in ufl/ffc/dolfin.

    However I won't touch e.g. mesh.domains() and misleading local variable names in dolfin python layer.

  5. Log in to comment