PDE meshing (generateMesh) failing after solid operations

11 visualizzazioni (ultimi 30 giorni)
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 Commenti
Pablo J. Rosado Junquera
Pablo J. Rosado Junquera il 5 Set 2021
Modificato: Pablo J. Rosado Junquera il 5 Set 2021
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!

Accedi per commentare.

Risposta accettata

Pablo J. Rosado Junquera
Pablo J. Rosado Junquera il 7 Set 2020
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 Commento
C
C il 29 Mar 2021
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.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by