UFL measure set that is complement of a marked domain

Suppose that I have a mesh \Omega with a subdomain \Omega_B marked with the integer 1. It is common to perform integrations over that subdomain with the Measure object dx(1). Is there an elegant way to perform an integral on the complement set \Omega \setminus \Omega_B? The only thing I can think of is substracting the integrals as in (dx - dx(1), but I am not sure if this is going to work or if it is mathematically sound.

Ok, by the linearity of the integral operator, it should be possible to subtract integrals. What threw me off was that subtractions of Measure objects is not supported. One has to write the entire Form and then subtract them.

Simply use a mesh function where you set all other entries to 0 (or any integer not equal to 1) and use dx(integer). You can for instance do: mf.array()[mf.array()!=1] = 3

1 Like