Conversation
8f6011e to
65502ac
Compare
65502ac to
926925d
Compare
connorjward
left a comment
There was a problem hiding this comment.
In #5001 (comment) I've figured out a much nicer way to do this. I'm not sure if we should be adding this very unintuitive API if a better solution exists with only a tiny amount more work.
Even after parsing, we need to implement a mechanism to traverse the expression tree. I don't agree that the amount of work is tiny. I suggest we keep this PR to support the same format used by |
7804ba6 to
95b1219
Compare
I disagree that we should be adding a known-to-be-confusing interface to a new a feature just because it's what's already been done. The logic really is very simple. You need: def myrecursion(expr):
if isinstance(expr, str | int):
return dm.getLabel(label_name, expr)
lexpr, op, rexpr = expr
liset = myrecursion(lexpr)
riset = myrecursion(rexpr)
if op == "&":
return ISIntersect(liset, riset)
else:
assert op == "|"
return ISUnion(liset, riset) |
Intuitively, many users would try to pass a list of subdomains, as they already do for DirichletBC. I think we should support this |
I am very happy with the API for a union. It's the intersection behaviour that I don't like. |
|
I am not the overlord however and this is subjective. If you can get agreement from other members of the team I will happily concede. |
cb24fa8 to
df1eb17
Compare
Enhances the valid values for
subdomain_idforSubmesh, so it matches closely the behaivor of the DirichletBC's subdomain kwarg. This spares users from relabeling the mesh themselves.Submesh(mesh, ..., subdomain_id=[1, 2])takes the union of subdomains 1 and 2 (this works for codim-0 and codim-1)Submesh(mesh, ..., subdomain_id=[(1, 2)])takes the intersection of subdomains 1 and 2 (this works for codim-0 and codim-1)Fixes #5001