getfem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Getfem-commits] (no subject)


From: Yves Renard
Subject: [Getfem-commits] (no subject)
Date: Sun, 18 Jun 2017 11:28:27 -0400 (EDT)

branch: devel-yves
commit fe174112cf1e382d3b960c44f835d1e04052494a
Author: Yves Renard <address@hidden>
Date:   Sun Jun 18 17:27:57 2017 +0200

    small modifications for compatibility reasons
---
 configure.ac                         | 55 +++++++++++++++++++-----------------
 interface/src/matlab/gfm_common.c    | 12 +-------
 interface/tests/matlab/check_spmat.m |  2 +-
 src/getfem_plasticity.cc             | 20 ++++++-------
 tests/test_small_vector.cc           |  4 +--
 5 files changed, 42 insertions(+), 51 deletions(-)

diff --git a/configure.ac b/configure.ac
index 988e802..e030753 100644
--- a/configure.ac
+++ b/configure.ac
@@ -194,6 +194,7 @@ dnl option pic-only is not working: a libtool bug ...
 LT_INIT([pic-only disable-shared])
 AC_SUBST([LIBTOOL_DEPS])
 
+
 dnl -------------------------------BLAS----------------------------------
 
 dnl why I hate autoconf: if the code below is put into a separate file,
@@ -345,6 +346,26 @@ if test x$useblasinterface = xYES; then
   CPPFLAGS="$CPPFLAGS -DGMM_USES_BLAS_INTERFACE"
 fi
 
+dnl ------------------------------LAPACK TEST--------------------------------
+
+if test x"$acx_blas_ok" = xyes; then
+  if test x"$FC" = "x"; then
+    dgetrf=dgetrf_
+  else
+    AC_FC_FUNC(dgetrf)
+  fi;
+
+  AC_CHECK_LIB(lapack, dgetrf_, [acx_lapack_ok=yes; LAPACK_LIBS="-llapack "])
+
+  if test x"$acx_lapack_ok" = xyes; then
+     CPPFLAGS="$CPPFLAGS -DGMM_USES_LAPACK"
+     LIBS="$LAPACK_LIBS $LIBS"
+  fi
+fi
+
+dnl -----------------------------END OF LAPACK TEST--------------------------
+
+
 dnl ---------------------------OPENMP------------------------------
 useopenmp=0
 AC_ARG_ENABLE(openmp,
@@ -509,11 +530,15 @@ AC_ARG_ENABLE(qhull,
  [AS_HELP_STRING([--enable-qhull],[enable the use of the qhull library 
(required for generation of non regular meshes)])],
  [ if   test "x$enableval" = "xyes" ; then useQHULL="yes"; fi], 
[useQHULL="test"])
 QHULL_LIBS=""
+save_LIBS="$LIBS";
 
 if test "x$useQHULL" = "xno"; then
   echo "Building with libqhull explicitly disabled";
 else
-  AC_CHECK_LIB(qhull, qh_new_qhull)
+  AC_CHECK_LIB(qhull, qh_new_qhull, [QHULL_LIBS="-lqhull"],
+  [
+    AC_CHECK_LIB(qhullstatic, 
qh_new_qhull,[QHULL_LIBS="-lqhullstatic"],[QHULL_LIBS=""])
+  ])
   AC_CHECK_HEADERS(libqhull/qhull_a.h,[useQHULL="yes"],
   [
     if test "x$useQHULL" = "xyes"; then
@@ -521,13 +546,11 @@ else
       useQHULL="no"
     fi;
   ])
-  if test "x$useQHULL" = "xyes"; then
-    QHULL_LIBS="-lqhull"
-  fi;
   echo "Building with libqhull (use --enable-qhull=no to disable it)"
 fi;
 AM_CONDITIONAL(QHULL, test x$useQHULL = xyes)
 
+LIBS="$QHULL_LIBS $save_LIBS"
 AC_SUBST([QHULL_LIBS])
 echo "Configuration of qhull done"
 dnl -----------------------------END OF QHULL TEST---------------------------
@@ -690,26 +713,6 @@ AC_SUBST([METIS_LIBS])
 dnl ---------------------------END OF METIS--------------------------
 
 
-dnl ------------------------------LAPACK TEST--------------------------------
-
-if test x"$acx_blas_ok" = xyes; then
-  if test x"$FC" = "x"; then
-    dgetrf=dgetrf_
-  else
-    AC_FC_FUNC(dgetrf)
-  fi;
-
-  AC_CHECK_LIB(lapack, dgetrf_, [acx_lapack_ok=yes; LAPACK_LIBS="-llapack "])
-
-  if test x"$acx_lapack_ok" = xyes; then
-     CPPFLAGS="$CPPFLAGS -DGMM_USES_LAPACK"
-     LIBS="$LIBS $LAPACK_LIBS"
-  fi
-fi
-
-dnl -----------------------------END OF LAPACK TEST--------------------------
-
-
 AC_CHECK_HEADERS(sys/times.h,[],[SUPERLU_CPPFLAGS="$SUPERLU_CPPFLAGS 
-DNO_TIMER"])
 AC_CHECK_HEADERS(cxxabi.h)
 dnl ---------------------------- CHECK FOR __PRETTY_FUNCTION__ MACRO --------
@@ -869,8 +872,8 @@ if test "$usematlab" != NO; then
      if $(echo "" | $MEX 2>&1 | grep 'This is .*TeX'); then
          AC_MSG_ERROR([the mex binary which is in the PATH appears to be part 
of LaTeX, not matlab !! run ./configure MEX=/path/to/matlab/mex]);
      fi;
-     MATLAB_ROOT=`$MEX -v 2>&1 | grep "MATLAB " | awk '{print $4}'|sed -e 
'2,$d'`
-     MATLAB_INC_DIR=$MATLAB_ROOT/extern/include
+     MATLAB_ROOT=`$MEX -v 2>&1 | grep "MATLAB_" | awk '{print $4}'|sed -e 
'2,$d'`
+     Matlab_INC_DIR=$MATLAB_ROOT/extern/include
      echo "checking for matlab path... " $MATLAB_ROOT
      MATLAB_COM_EXT=`$MEX -v 2>&1 | grep "LDEXTENSION " | awk '{print $3}'`
      echo "checking for mex extension... " $MATLAB_COM_EXT
diff --git a/interface/src/matlab/gfm_common.c 
b/interface/src/matlab/gfm_common.c
index c807656..277dcb7 100644
--- a/interface/src/matlab/gfm_common.c
+++ b/interface/src/matlab/gfm_common.c
@@ -48,11 +48,9 @@ mxClassID2string(mxClassID id) {
 #endif
     case mxOPAQUE_CLASS: return "OPAQUE_CLASS";
     default:
-#if MATLAB_RELEASE >= 14
       if (id != (mxClassID)(-1))
        return "OBJECT";
-      else 
-#endif
+      else
        return "unknown class...did you use the correct mex version ?";
   }
 }
@@ -176,9 +174,7 @@ mxarray_to_gfi_array(const mxArray *mx, gfi_array *t)
     } break;
     case mxOBJECT_CLASS:
     case mxSTRUCT_CLASS: 
-#if MATLAB_RELEASE >= 14
     default: 
-#endif
       {
       mxArray *fid = mxGetField(mx, 0, "id");
       mxArray *fcid = mxGetField(mx, 0, "cid");
@@ -201,12 +197,6 @@ mxarray_to_gfi_array(const mxArray *mx, gfi_array *t)
         mexPrintf("matlab structures (except getfem object ids) not handled"); 
return 1; 
       }
     } break;
-#if MATLAB_RELEASE < 14
-    default: {
-      mexPrintf("unhandled class type : %s\n", 
mxClassID2string(mxGetClassID(mx)));
-      return 1;
-    } break;
-#endif
   }
   {
     mwSize *pm;
diff --git a/interface/tests/matlab/check_spmat.m 
b/interface/tests/matlab/check_spmat.m
index f7e340f..91d2e5b 100644
--- a/interface/tests/matlab/check_spmat.m
+++ b/interface/tests/matlab/check_spmat.m
@@ -168,7 +168,7 @@ function check_spmat(iverbose,idebug)
   A=gf_asm('laplacian',mim,mf,mf,ones(1,gf_mesh_fem_get(mf,'nbdof')));
   A=A+.1*speye(size(A,1));
   B=rand(gf_mesh_fem_get(mf,'nbdof'),1);
-  [L,U]=luinc(A,'0');
+  [L,U]=ilu(A);
   X1=gf_linsolve('cg',A,B);
   mm=gf_spmat('copy',inv(L));
   p=gf_precond('spmat',mm);
diff --git a/src/getfem_plasticity.cc b/src/getfem_plasticity.cc
index 0aca48b..2223793 100644
--- a/src/getfem_plasticity.cc
+++ b/src/getfem_plasticity.cc
@@ -1707,7 +1707,7 @@ namespace getfem {
       base_vector coeff_data;
       pfem pf_data;
       fem_interpolation_context ctx_data;
-      if (int(long(pmf_data))) {
+      if (pmf_data) {
         pf_data = pmf_data->fem_of_element(cv);
         size_type nbd_data = pf_data->nb_dof(cv);
         coeff_data.resize(nbd_data*3);
@@ -1749,7 +1749,7 @@ namespace getfem {
 
       for (size_type ii = 0; ii < nbd_sigma; ++ii) {
 
-        if (int(long(pmf_data))) {
+        if (pmf_data) {
           // interpolation of the data on sigma dof
           ctx_data.set_ii(ii);
           pf_data->interpolation(ctx_data, coeff_data, params, 3);
@@ -1853,7 +1853,7 @@ namespace getfem {
                                              
gmm::sub_interval(0,mf_sigma.nb_dof())),
                              Sigma_n);
 
-      if (int(long(pmf_data))) {
+      if (pmf_data) {
         gmm::resize(mu, pmf_data->nb_basic_dof());
         gmm::resize(lambda, pmf_data->nb_basic_dof());
         gmm::resize(threshold, pmf_data->nb_basic_dof());
@@ -1978,7 +1978,7 @@ namespace getfem {
      const mesh_im &mim,
      const mesh_fem &mf_u,
      const mesh_fem &mf_sigma,
-     const mesh_fem &mf_data,
+     const mesh_fem *pmf_data,
      const model_real_plain_vector &u_n,
      const model_real_plain_vector &u_np1,
      const model_real_plain_vector &sigma_n,
@@ -1991,16 +1991,14 @@ namespace getfem {
     GMM_ASSERT1(mf_u.get_qdim() == mf_u.linked_mesh().dim(),
                 "wrong qdim for the mesh_fem");
 
-    const mesh_fem *pmf_data = &mf_data;
-
-    elastoplasticity_nonlinear_term gradplast(mim, mf_u, mf_sigma, &mf_data,
+    elastoplasticity_nonlinear_term gradplast(mim, mf_u, mf_sigma, pmf_data,
                                               u_n, u_np1, sigma_n,
                                               threshold, lambda, mu,
                                               t_proj, GRADPROJ, false);
 
     generic_assembly assem;
 
-    if (int(long(pmf_data)))
+    if (pmf_data)
       assem.set("lambda=data$1(#3); mu=data$2(#3);"
                 
"t=comp(NonLin(#2).vGrad(#1).vGrad(#1).Base(#3))(i,j,:,:,:,:,:,:,i,j,:);"
                 "M(#1,#1)+=  
sym(t(k,l,:,l,k,:,m).mu(m)+t(k,l,:,k,l,:,m).mu(m)+t(k,k,:,l,l,:,m).lambda(m))");
@@ -2012,8 +2010,8 @@ namespace getfem {
     assem.push_mi(mim);
     assem.push_mf(mf_u);
     assem.push_mf(mf_sigma);
-    if (int(long(pmf_data)))
-      assem.push_mf(mf_data);
+    if (pmf_data)
+      assem.push_mf(*pmf_data);
     assem.push_data(lambda);
     assem.push_data(mu);
     assem.push_nonlinear_term(&gradplast);
@@ -2079,7 +2077,7 @@ namespace getfem {
       if (version & model::BUILD_MATRIX) {
         gmm::clear(matl[0]);
         asm_elastoplasticity_tangent_matrix
-          (matl[0], mim, mf_u, mf_sigma, *mf_data, u_n,
+          (matl[0], mim, mf_u, mf_sigma, mf_data, u_n,
            u_np1, sigma_n, lambda, mu, threshold, *t_proj, rg);
       }
 
diff --git a/tests/test_small_vector.cc b/tests/test_small_vector.cc
index c117a55..ccbbdc0 100644
--- a/tests/test_small_vector.cc
+++ b/tests/test_small_vector.cc
@@ -458,7 +458,7 @@ namespace getfem {
     typedef double *iterator;
     typedef const double * const_iterator;
     pointer p;
-    pointer base() const { return (double*)((unsigned long)p&(~7UL)); }
+    pointer base() const { return (double*)((size_type)p&(~7UL)); }
     reference operator[](size_type i) { return base()[i]; }
     const double& operator[](size_type i) const { return base()[i]; }
     micro_vec() : p(0) {}
@@ -491,7 +491,7 @@ namespace getfem {
       return *this;
     }
     ~micro_vec() { deallocate(); }
-    size_type size() const { return (unsigned long)p & 7UL; }
+    size_type size() const { return (size_type)(p) & 7UL; }
     micro_vec(const micro_vec& va, const micro_vec& vb) : p(alloc(va.size())) 
{ 
       /*double * restrict__ pb = base(), *pe = base()+size(), *pva = 
va.base(), *pvb = vb.base();
        for (; pb < pe;) *pb++=*pva+++*pvb++;*/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]