Multi region 3dmesh

Hello everyone,

I wanna make a mesh with 3 different regions. The region label for two of them is well defined. I need to say for example: if the region is equal to 1 keep it as 1 ; if the region is equal to 2 keep it as 2 ; otherwise change the label region to 3. I know for a mesh with 2 regions we can use " a ? b : c is equal to b if the a is true, c otherwise. " operator.

May you help me how can I define it for 3 regions?


Hi !

You should check the documentation, there are quite a few examples there. E.g. check Mesh Generation for function change.

An elegant way includes a function regions(...) - I cannot find this function in documentation, but, essentially, it extracts the regions of the mesh a saves them in int[int] array. Here is a simple idea:

load "msh3"
mesh3 Th = cube(5,5,5);

int[int] regs = regions(Th);
cout << "region labels: " << regs << endl;

int[int] newRegs = [0,1];
regs = regions(Th);
cout << "new region labels: " << regs << endl;