Hello,
I recently have tried feconv that @henkel suggested and it worked! Thanks to him!
I wanted to import in freefem a mesh of a 2d square with a slit from COMSOL.
Firstly, you need to choose .mphtxt and check all the 4 first v’s on the export menu, that is:
- domain elements
- boundary elements
- vertex elements
- geometric entity information
But then all I had to do was to write in cmd (though installing feconv is a bit hard):
cd <go to a place where feconv is>feconv -ff <yourfile.mphtxt> <newfile.msh>
-ff is for when .msh file appears, you choose for freefem. You could also write -gm for gmsh.- And then you just read it in freefem:
mesh Th = readmesh("newfile.msh");
plot(Th, wait=1);
P.S. At least that’s what I had come to, through trying and failing.
P.S.S. If you need to deal with labels, I just printed them out with cout << labels(Th)<< endl; and it’s just numbers. I deformed the square by the numbers one by one until I finally discovered every sides’ labels.
P.S.S.S. If you read somewhere that for importing 2d-mesh you need to remove z-axis from your file because freefem can’t read because of it, don’t trust them. Freefem reads 2d meshes just fine with readmesh().