Dear Frédéric Hecht,
sorry I think I did not describe the problem clearly.
I attach a new file (meshtest3.edp), where I simply added few lines to show the meshes before glueing:
ThG = buildBdMesh(ThG);
medit(“First_mesh”,Th33,wait=1);
medit(“Second_mesh”,ThLat3,wait=1);
medit(“Union”,ThG,wait=1);
meshS ThGS = ThG.Gamma;
medit(“Surface_mesh”,ThGS,wait=1);
mesh3 Thfinal = tetg(ThGS,switch=“pqaAAYYQ”);
As you can see, the two meshes do not share the same nodes at the boundary, so they actually are not “glued”. To solve the problem (in my case, elasticity), I need to fuse the two meshes together.
I thought to use tetg to accomplish this task, by giving the surface mesh as an input; however tetg requires to have the same nodes on the common edge shared by two surfaces.
To show this, I also tried tetg on a simpler geometry: your example “cylinder-with-tetgen.edp”.
I attached a slightly modified version, where the lateral surface of the cylinder is composed of two surfaces (the first, Thcarre1, between [0, pi] and the other, Thcarre2, between [pi, 2pi]).
cylinder-with-tetgen.edp (2.1 KB)
The code does not work because the two lateral surfaces have a different number of nodes on the length (see line 25 and 26: nx versus nx/2). However if I put the same number of nodes (e.g., nx) the code works fine.
To sum up, I need either to merge together two 3D meshes, or create a unique 3D mesh from the boundary of several 2D meshes, but I was not successful (see meshtest3.edp) and I have not idea how to do it.
Thanks a lot for your help
Riccardo
meshtest3.edp (5.9 KB)