From ce40b0276813a9dfa3e4067a47458d1c33a6b707 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 5 Apr 2016 20:52:57 +0000
Subject: [PATCH] use find_package(HDF5) + fix build warnings

---
 CMakeLists.txt          | 10 ++++++----
 Common/onelab.h         |  3 +--
 Numeric/MetricBasis.cpp |  9 +++++----
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f65eae2487..8fbda3adb9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -825,8 +825,10 @@ if(ENABLE_FOURIER_MODEL)
 endif(ENABLE_FOURIER_MODEL)
 
 if(ENABLE_MED OR ENABLE_CGNS)
-  find_library(HDF5_LIB hdf5)
-  if(HDF5_LIB)
+  find_package(HDF5)
+  if(HDF5_FOUND)
+    set(HDF5_LIB "${HDF5_C_LIBRARIES}")
+    list(APPEND EXTERNAL_INCLUDES ${HDF5_INCLUDE_DIRS})
     if(ENABLE_MED)
       find_library(MED_LIB med)
       if(MED_LIB)
@@ -857,9 +859,9 @@ if(ENABLE_MED OR ENABLE_CGNS)
         endif(ZLIB_FOUND)
       endif(NOT HAVE_LIBZ)
     endif(MED_LIB OR CGNS_LIB)
-  else(HDF5_LIB)
+  else(HDF5_FOUND)
     message(STATUS "HDF5 not found")
-  endif(HDF5_LIB)
+  endif(HDF5_FOUND)
 endif(ENABLE_MED OR ENABLE_CGNS)
 
 if(HAVE_SOLVER)
diff --git a/Common/onelab.h b/Common/onelab.h
index f716017736..2c27558dc7 100644
--- a/Common/onelab.h
+++ b/Common/onelab.h
@@ -353,8 +353,7 @@ namespace onelab{
   };
 
   // The number class. Numbers are stored internally as double precision real
-  // numbers. All more complicated types (complex numbers, vectors, expressions,
-  // functions, etc.) are supposed to be exchanged as strings.
+  // numbers.
   class number : public parameter{
   private:
     std::vector<double> _values, _choices;
diff --git a/Numeric/MetricBasis.cpp b/Numeric/MetricBasis.cpp
index a7b26661a5..7e85f74850 100644
--- a/Numeric/MetricBasis.cpp
+++ b/Numeric/MetricBasis.cpp
@@ -23,6 +23,7 @@ double MetricBasis::_tol = 1e-3;
 //TODO Renommer fonctions plus explicitement (minmaxA,...) et rendre statique certaines fonctions
 
 namespace {
+  /*
   double cubicCardanoRoot(double p, double q)
   {
     // solve the equation t^3 + p*t + q = 0
@@ -47,7 +48,7 @@ namespace {
       return 2 * std::pow(module, 1/3.) * std::cos(ang/3);
     }
   }
-
+  */
   int nChoosek(int n, int k)
   {
     if (n < k || k < 0) {
@@ -688,7 +689,7 @@ bool MetricBasis::validateBezierForMetricAndJacobian()
 
     // Create 'numElem' elements more and more randomized
     for (int iel = 0; iel < numElem; ++iel) {
-      const double range = static_cast<double>(iel) / (numElem-1) / order;
+      //const double range = static_cast<double>(iel) / (numElem-1) / order;
       const double rangePrim = static_cast<double>(iel/2000) / ((numElem/2000)-1) / order; ////////
       const double rangeSub = static_cast<double>(iel%2000) / 1999 / order;                ////////
       if (!(iel%200)) Msg::Info("%g %g", rangePrim, rangeSub);
@@ -1977,7 +1978,7 @@ void MetricBasis::_computeBoundingCurve(const fullMatrix<double> &coeff,
   itP = _ineqP3.begin();
 
   // _ineqJ2 and _ineqP3 have the same size
-  int kk = 0;
+  //int kk = 0;
   while (itJ != _ineqJ2.end()) {// && kk++ < 2) {// FIXME making tests
     long double J2 = 0;
     for (unsigned int k = 0; k < itJ->second.size(); ++k) {
@@ -2313,7 +2314,7 @@ bool MetricBasis::_intersectionCurveLeftCorner(double beta, double c,
   }
 
   const double minK = K;
-  const double mina = a; //TODO remove (not needed)
+  //const double mina = a; //TODO remove (not needed)
 
   K = (beta*a*a + c)*a;
   if (K >= minK) return true;
-- 
GitLab