wildmeshing / fTetWild

Fast Tetrahedral Meshing in the Wild
https://yixin-hu.github.io/ftetwild.pdf
Mozilla Public License 2.0
403 stars 80 forks source link

GMP dependency #55

Open cesss opened 1 year ago

cesss commented 1 year ago

Is GMP used only by Rational.h ? If affirmative, I believe it should be possible to remove the GMP dependency (which is LGPL) and use for example Boost.Multiprecision (which has Boost license).

Would Rational.h be the only file to modify, or more parts in the code would need to be rewritten?

Thanks!

Yixin-Hu commented 1 year ago

Hi,

Yes, gmp.h is only included in Rational.h. I think you can try to replace it with other multi-precision libraries as long as you overload the operators in Rational.h

nonbasketless commented 7 months ago

I want to share my experience detangling GMP. I'll spare you the why, if you're here you know ;)

First of all, the ONLY part of fTetWild that actually needs GMP as of this writing is floatTetWild::AMIPS_energy in LocalOperations.cpp. There are other references, but they're dead. Remove and/or comment out.

Comment out the block in floatTetWild::AMIPS_energy that uses triwild::Rational, replace it with return res;, just to make sure it builds/runs. Good? Remove that, proceed.

Copy the commented out block and replace triwild::Rational with your alternative of choice. I went with a new library: https://github.com/tuwien-cms/libxprec, highly recommend. Pretty easy.