PDE meshing (generateMesh) failing after solid operations

6 次查看(过去 30 天)
Hey there,
I'm trying to develop an algorithm to define, edit and solve finite elements problems using constructive solid geometry. The libs I'm using work well, but when it comes to generate the mesh, some complex geometries return the "Meshing failed for Hmax..." error whatever the Hmax, Hmin values are.
After some tests, It seems it is the very solid operation which makes the meshing fail, even if the operation is somehow "simplifying" the model, or if it leaves the model exactly the same way. An example:
Original model: Successful mesh generation
Modified (intersection with a cube to obtain a half): failed generation
How could I avoid this? For me, since the non-modified models are of the same complexity, it does not seem a "too complex geometry" problem.
Any workaround appreciated.
Thank you
  10 个评论
Pablo J. Rosado Junquera
编辑:Pablo J. Rosado Junquera 2021-9-5
Sure!
I used raw C++ functions compiled by MATLAB using the mex command. The function is called "mesh_boolean".
You will need:
  • Alecjacobson's gptoolbox .- It contains the MATLAB mesh_boolean function call you want to use. Also you can find useful documentation on how to compile the souce files.
  • libigl .- It contains the source files needed for you compilation (the actual mesh_boolean fuction writen in C++).
  • Eigen .- The classic linear algebra C++ lib. It is used by almost any other math - related library.
Theoretically, libigl just needs Eigen, although I used CGAL and Boost too (and their dependencies) because I think this function needs them specifically. Check the documentation carefully to be aware of the libs you need to use.
The last step would be to compile the libraries source files, and then compile the mesh_boolean function directly from MATLAB. In case you are not familiar with C++, to compile your libs:
  • Download Cmake .- It is a software which reads a txt input file called "Cmakelists" to arrange some compilation options and then generates a solution. (.sln). Let us say it saves us a headache due to the many libs we would need to include and configure to compile by ourselves.
  • Download Visual Studio .- It contains an easy-to-use compiler. Just open your previously generated .sln and BUILD your libs.
And you are done! Anyway, as I have already said, the gptoolbox documentation is pretty helpful and it is a good starting point.
Cheers!

请先登录,再进行评论。

采纳的回答

Pablo J. Rosado Junquera
I figured it out a coupe weeks ago. There is a script called tetgen.m, from the gptoolbox, which uses an external program, also called Tetgen, to generate the meshes.
  1 个评论
C
C 2021-3-29
Hi there, Could you please let me know how you used gptoolbox? Did you directly input the model geometry object? I can only see that tetgen() requires a triangle mesh and then triangle() requires a .poly or .node file.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Geometry and Mesh 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by