
lc = 0.09;

Point(1) = {0, 0, 0, lc};
Point(2) = {.1, 0,  0, lc} ;
Point(3) = {.1, .3, 0, lc} ;
Point(4) = {0,  .3, 0, lc} ;

Line(1) = {1,2} ;
Line(2) = {3,2} ;
Line(3) = {3,4} ;
Line(4) = {4,1} ;

Line Loop(5) = {1,-2,3,4} ;

Plane Surface(6) = {5} ;
 
Transfinite Line{1} = 4;
Transfinite Line{2} = 4;
Transfinite Line{3} = 4;
Transfinite Line{4} = 4;

Transfinite Surface{6} = {1,2,3,4};

Recombine Surface{6};

// Do not extrude layers so you will just have a regular volume that can be made Transfinite...with some work....
// structure of array is: array[0] = top surf, array[1] = extrude volume, array[{2:N}] = lateral surfs
extrude_elements[] = Extrude {0.0, 0.0, 0.5} {Surface {6}; };

// Make top surface transfinite, do not recombine
top_surf = extrude_elements[0];
top_lines[] = Boundary {Surface{top_surf}; };
Transfinite Line {top_lines[]} = 4;
Transfinite Surface{top_surf};

// Make lateral surfaces transfinite and recombine
lateral_surfs[] = extrude_elements[{2:5}];
lateral_lines[] = Boundary{ Surface{lateral_surfs[]}; };  // Will be some repeated lines but that is okay
Transfinite Line {lateral_lines[]} = 4;
Transfinite Surface {lateral_surfs[] };
Recombine Surface {lateral_surfs[]};

// Finally, a Transfinite volume with the Quad To Tri option
Transfinite Volume { extrude_elements[1] };
TransfQuadTri { extrude_elements[1] };

// Note: this will form a layer of pyramid + TET elements IN VOLUME 1 to connect to volume 2

// Add a fully unstructured neighbour volume 2 that will be filled with TETs
Extrude {0.0, 0.0, 0.5} {Surface {28};}



