Physical tensorial properties by domain

Hi everybody,

I work on a thermoelastic problem but with general elasticity Cijkl. I have 3 domains, but also we could have more. And I wrote

fespace Ph(Th3,P0);

Ph[int] c(37);
for (i=1;i<=6;i++) {
for (j=1;j<=6;j++)
c[(i-1)6+j]=c1(i,j)(region==1)+c2(i,j)(region==2)+c3(i,j)(region==3);
}
where cI(i,j) have been given before as real[int,int].

after I use macro
macro C [[ c[1], c[2], c[3], c[4], c[5], c[6] ],
[ c[7], c[8], c[9], c[10], c[11], c[12] ],
[ c[13], c[14], c[15], c[16], c[17], c[18] ],
[ c[19], c[20], c[21], c[22], c[23], c[24] ],
[ c[25], c[26], c[27], c[28], c[29], c[30] ],
[ c[31], c[32], c[33], c[34], c[35], c[36] ]] // EOM

and then a varf as
varf vK(u,v)=int3d(Th3)( (C*epsilon(u))’ *epsilon(v)) etc ; where epsilon(u) describes strain usual parts.

Could you help me to find the right method to attribute physical properties to many domains (but tensor properties, not only nu or kappa or…) ?

Because I know that I could presumably use 3 varf with a mesh trunc for each domain but I hope a better solution.

I have posted it a few years ago, but I got no answer. Since I did it with another method (rather long), so I hope that today somebody could find the most elegant way to code it.

Best regards.