Yixin-Hu / TetWild

Robust Tetrahedral Meshing in the Wild.
https://yixin-hu.github.io/tetwild.pdf
GNU General Public License v3.0
620 stars 98 forks source link

meshing anisotropically #84

Open cpuelz opened 3 years ago

cpuelz commented 3 years ago

Hi Yixin, I've got a model I am trying to mesh anisotropically. I have a msh file with a scalar-valued vertex field called "values" stored that is specifying my element sizes, along with the STL file that I want to mesh. I followed the example in the README, but the code goes through a bunch of passes, gets to the postprocessing stage, and then terminates with

[2021-08-13 18:57:27.767] [tetwild] [info] time = 2.51815s [2021-08-13 18:57:27.767] [tetwild] [debug] round: 0(32927) Abnormal program termination: function terminate() was called

Any suggestions? Happy to share my STL and msh file.

-- Charles

Yixin-Hu commented 3 years ago

Hi Charles,

Could you share the input and the command you used?

Thanks, Yixin

cpuelz commented 3 years ago

Hi Yixin,

I ran a command like

./TetWild --input input.stl --bg-mesh bg_mesh.msh.

I did some more investigating since my background mesh MSH file is in ASCII format and I was able to see that no mesh information was in that file... it was basically a "postprocessed view" file. I am using a libMesh GMSH read/write object to output the background mesh with the element sizes and I guess the mesh information was left out of the write command.

I then opened this postprocessed MSH file in GMSH and reexported it with the mesh information. With this workflow it seems to store both mesh info and the "values" field, but in ElementNodeData format. It seems like this is not currently supported with TetWild. Maybe it is possible to force GMSH to export the values field in NodeData format instead? I am not a heavy user of GMSH so I am not sure.

I can write a parser to try and convert this ElementNodeData to NodeData (which I think is what I need, correct?), or is it possible that ElementNodeData might be supported in the near future?

I am happy to share my input files as well... can I send them to you over email?

-- Charles

cpuelz commented 3 years ago

another way to ask my question is... what exactly is the MSH format required for the background mesh, and what things should be in that file? for example, if I open the background mesh in your example and reexport in ASCII format, the ASCII background mesh file does not work with TetWild. an error is thrown that $Entities is not supported.

Yixin-Hu commented 3 years ago

Hi Charles,

You can try to use pymesh (https://github.com/PyMesh/PyMesh/blob/main/src/IO/MshSaver.h) to read/write gmsh file. Here is a piece of sample code: https://github.com/Yixin-Hu/TetWild/blob/1c75f7d2acf910dba9f5bc6fa3d03d88b80a28f3/src/main.cpp#L54-L62 where save_elem_scalar_field save a value field for tetrahedra.

Hope this hepls, Yixin