[Feature request]: Keep physical numbers even when entity numbers are changed
Especially when working with quite complex scripted geometries with the OpenCASCADE kernel, the following feature would be very, very helpful:
Boolean operations and the Coherence command necessarily renumber some entities. It would be great, if upfront assigned physical numbers would be kept, even if the entity numbers are changed.
This feature would make the life much easier, as it allows to define physical groups on the fly during the construction of the geometry. It would be possible to apply a single Coherence command at the end of a complex script without the necessity to figure out all the new entity numbers for the definition of the physical groups.
Here is a very simple example:
SetFactory("OpenCASCADE");
Rectangle(1) = {-0, -0, -0, 1, 0.5, 0}; // Lower rectangle
Rectangle(2) = {0.5, 0.5, 0, 1, 0.5, 0}; // Upper rectangle
// The bottom line of the upper rectangle should be assigned to a physical group:
L() = Boundary{ Surface{2}; };
Physical Curve("BottomOfUpperRectangle", 1) = {L(0)};
// As both rectangles are touching each other, we apply the Coherecne command
Coherence;
// But as Coherence renumbers the lines, the assignment of the physical group
// is not correct anymore...
Extension: If some upfront physical assigned numbers collide, because the entities overlap, the higher physical number should be kept for the overlap region.
This allows a concept similar to several commercial tools (e.g. Ansys), where overlaps of different bodies are allowed. The materials have a defined priority. In the overlap region, the material with the higher priority is used.
To be honest, I have absolutely no clue if it is a huge work to implement those powerful features, but it would be for sure very beneficial :-)
Please let me know, what you think.
Thanks and best wishes, Michael