This is an automated email from the git hooks/post-receive script. logari81 pushed a commit to branch master in repository getfem.
The following commit(s) were added to refs/heads/master by this push: new 264c7c5c Switch to reentrant qhull library interface (patch by Stefan Brüns) 264c7c5c is described below commit 264c7c5cef54b63ce199c4f245702625c2b8b03b Author: Konstantinos Poulios <logar...@gmail.com> AuthorDate: Wed Jan 18 23:59:45 2023 +0100 Switch to reentrant qhull library interface (patch by Stefan Brüns) --- configure.ac | 8 ++++---- src/bgeot_convex_ref.cc | 29 +++++++++-------------------- 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/configure.ac b/configure.ac index e9e18671..018bfd86 100644 --- a/configure.ac +++ b/configure.ac @@ -910,14 +910,14 @@ save_LIBS="$LIBS"; if test "x$useQHULL" = "xno"; then echo "Building with libqhull explicitly disabled"; else - AC_CHECK_LIB(qhull, qh_new_qhull, [QHULL_LIBS="-lqhull"], + AC_CHECK_LIB(qhull_r, qh_new_qhull, [QHULL_LIBS="-lqhull_r"], [ - AC_CHECK_LIB(qhullstatic, qh_new_qhull,[QHULL_LIBS="-lqhullstatic"],[QHULL_LIBS=""]) + AC_CHECK_LIB(qhullstatic_r, qh_new_qhull,[QHULL_LIBS="-lqhullstatic_r"],[QHULL_LIBS=""]) ]) - AC_CHECK_HEADERS(libqhull/qhull_a.h,[useQHULL="yes"], + AC_CHECK_HEADERS(libqhull_r/qhull_ra.h,[useQHULL="yes"], [ if test "x$useQHULL" = "xyes"; then - AC_MSG_ERROR([header files libqhull/qhull_a.h not found. Use --enable-qhull=no flag]); + AC_MSG_ERROR([header files libqhull_r/qhull_ra.h not found. Use --enable-qhull=no flag]); useQHULL="no" fi; ]) diff --git a/src/bgeot_convex_ref.cc b/src/bgeot_convex_ref.cc index 28e1776e..8047203c 100644 --- a/src/bgeot_convex_ref.cc +++ b/src/bgeot_convex_ref.cc @@ -30,7 +30,7 @@ namespace bgeot { // Interface with qhull // ****************************************************************** -# ifndef GETFEM_HAVE_LIBQHULL_QHULL_A_H +# if !defined(GETFEM_HAVE_LIBQHULL_R_QHULL_RA_H) void qhull_delaunay(const std::vector<base_node> &, gmm::dense_matrix<size_type>&) { GMM_ASSERT1(false, "Qhull header files not installed. " @@ -38,20 +38,7 @@ namespace bgeot { } # else - extern "C" { - // #ifdef _MSC_VER -# include <libqhull/qhull_a.h> - // #else - // # include <qhull/qhull.h> - // # include <qhull/mem.h> - // # include <qhull/qset.h> - // # include <qhull/geom.h> - // # include <qhull/merge.h> - // # include <qhull/poly.h> - // # include <qhull/io.h> - // # include <qhull/stat.h> - // #endif - } +# include <libqhull_r/qhull_ra.h> void qhull_delaunay(const std::vector<base_node> &pts, gmm::dense_matrix<size_type>& simplexes) { @@ -79,7 +66,9 @@ namespace bgeot { facetT *facet; /* set by FORALLfacets */ int curlong, totlong; /* memory remaining after qh_memfreeshort */ vertexT *vertex, **vertexp; - exitcode = qh_new_qhull (int(dim), int(pts.size()), &Pts[0], ismalloc, + qhT context = {}; + qhT* qh = &context; + exitcode = qh_new_qhull (qh, int(dim), int(pts.size()), &Pts[0], ismalloc, flags, outfile, errfile); if (!exitcode) { /* if no error */ size_type nbf=0; @@ -92,14 +81,14 @@ namespace bgeot { size_type s=0; FOREACHvertex_(facet->vertices) { assert(s < (unsigned)(dim+1)); - simplexes(s++,nbf) = qh_pointid(vertex->point); + simplexes(s++,nbf) = qh_pointid(qh, vertex->point); } nbf++; } } } - qh_freeqhull(!qh_ALL); - qh_memfreeshort (&curlong, &totlong); + qh_freeqhull(qh, !qh_ALL); + qh_memfreeshort(qh, &curlong, &totlong); if (curlong || totlong) cerr << "qhull internal warning (main): did not free " << totlong << " bytes of long memory (" << curlong << " pieces)\n"; @@ -132,7 +121,7 @@ namespace bgeot { m.add_simplex(n, ipts.begin()); } } else { -# ifdef GETFEM_HAVE_LIBQHULL_QHULL_A_H +# if defined(GETFEM_HAVE_LIBQHULL_R_QHULL_RA_H) gmm::dense_matrix<size_type> t; qhull_delaunay(cvr->points(), t); for (size_type nc = 0; nc < gmm::mat_ncols(t); ++nc) {