From 7f3005d824ce72dcc917d7fa417b254d11f0506b Mon Sep 17 00:00:00 2001 From: Gauthier Becker <gauthierbecker@gmail.com> Date: Sun, 11 Dec 2016 21:23:18 +0000 Subject: [PATCH] Fix bugs in MElement::xyz2uvw and in dgShellPartDomain Fix PETSc deprecated warnings (since PETSc 3.6 / 3.7) Fix BCs containers and their groupOfElement destruction --> need c++11 (cm3) Update CMakeLists (cm3) to support c++11 Fix cm3 tests, and remove import scipy as unused (+ python3 support) Fix DLOPEN warning for msch project --- Geo/MElement.cpp | 6 +++--- Solver/linearSystemPETSc.h | 7 +++++++ Solver/linearSystemPETSc.hpp | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Geo/MElement.cpp b/Geo/MElement.cpp index ec9fc2202f..592c9c223f 100644 --- a/Geo/MElement.cpp +++ b/Geo/MElement.cpp @@ -780,9 +780,9 @@ void MElement::xyz2uvw(double xyz[3], double uvw[3]) const } const nodalBasis *nb = getFunctionSpace(); fullMatrix<double> refpnts = nb->getReferenceNodes(); - uvw[0] = refpnts(numNearer, 0); - uvw[1] = refpnts(numNearer, 1); - uvw[2] = refpnts(numNearer, 2); + for (int i=0; i < getDim(); i++){ + uvw[i] = refpnts(numNearer, i); + } } int iter = 1, maxiter = 20; diff --git a/Solver/linearSystemPETSc.h b/Solver/linearSystemPETSc.h index 19cc01ad7e..0575c5174e 100644 --- a/Solver/linearSystemPETSc.h +++ b/Solver/linearSystemPETSc.h @@ -76,6 +76,13 @@ typedef struct _p_KSP* KSP; # define KSPSetOperators(_ksp, _a, _b, OPT_PRECON) (KSPSetOperators(_ksp, _a, _b), KSPSetReusePreconditioner(_ksp,PetscBool(OPT_PRECON == SAME_PRECONDITIONER))) #endif +// Deprecated method PetscViewerSetFormat starts 3.7 the only instance we use +// can be replaced by PetscViewerPushFormat as we do not change the format of the same viewer +// in such a case PetscViewerPopFormat should be used and the following will not work +#if (PETSC_VERSION_MAJOR < 3 || (PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR < 7)) +#define PetscViewerPushFormat(viewer , format) PetscViewerSetFormat(viewer , format) +#endif + template <class scalar> class linearSystemPETSc : public linearSystem<scalar> { protected: diff --git a/Solver/linearSystemPETSc.hpp b/Solver/linearSystemPETSc.hpp index 289a0cbfbe..818e730ba5 100644 --- a/Solver/linearSystemPETSc.hpp +++ b/Solver/linearSystemPETSc.hpp @@ -413,7 +413,7 @@ void linearSystemPETSc<scalar>::printMatlab(const char *filename) const PetscViewer viewer; PetscViewerASCIIOpen(PETSC_COMM_WORLD, filename, &viewer); - PetscViewerSetFormat(viewer,PETSC_VIEWER_ASCII_MATLAB); + PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB); MatView(_a, viewer); PetscViewerDestroy(&viewer); return; -- GitLab