Commit a1439087 authored by Praetorius, Simon's avatar Praetorius, Simon

Merge branch 'issue/new_petsc_version' into 'dev'

resolve problem after petsc version update

See merge request !24
parents 8aa43b17 697bb39b
......@@ -39,7 +39,8 @@ macro(target_enable_petsc _TARGET_ _SCOPE_)
$ENV{PETSC_ROOT}/lib/pkgconfig
/usr/lib/petsc/lib/pkgconfig
/usr/lib/petsc/linux-gnu-cxx-opt/lib/pkgconfig
/usr/lib/petsc/linux-gnu-c-opt/lib/pkgconfig)
/usr/lib/petsc/linux-gnu-c-opt/lib/pkgconfig
PATHS $ENV{PKG_CONFIG_PATH})
if (PETSC_PKG_CONFIG)
get_filename_component(PETSC_PKG_CONFIG_PATH "${PETSC_PKG_CONFIG}" PATH CACHE)
set(ENV{PKG_CONFIG_PATH} ${PETSC_PKG_CONFIG_PATH})
......
......@@ -284,7 +284,7 @@ namespace AMDiS
const char* kspPrefix,
KSPType kspType,
PCType pcType,
const MatSolverPackage matSolverPackage,
const petsc::MatSolverPackage_t matSolverPackage,
PetscReal rtol,
PetscReal atol,
PetscInt maxIt)
......@@ -300,7 +300,7 @@ namespace AMDiS
KSPGetPC(ksp, &pc);
PCSetType(pc, pcType);
if (matSolverPackage != PETSC_NULL)
PCFactorSetMatSolverPackage(pc, matSolverPackage);
petsc::pc_factor_set_mat_solver_package(pc, matSolverPackage);
PCSetFromOptions(pc);
#ifndef NDEBUG
......
......@@ -104,7 +104,7 @@ namespace AMDiS
const char* kspPrefix,
KSPType kspType,
PCType pcType,
const MatSolverPackage matSolverPackage,
const petsc::MatSolverPackage_t matSolverPackage,
PetscReal rtol = PETSC_DEFAULT,
PetscReal atol = PETSC_DEFAULT,
PetscInt maxIt = PETSC_DEFAULT);
......
......@@ -31,6 +31,7 @@
#include "parallel/MpiHelper.h"
#include "parallel/PetscSolverGlobalMatrix.h"
#include "io/VtkWriter.h"
#include "utility/PetscWrapper.h"
namespace AMDiS { namespace Parallel {
......@@ -1077,7 +1078,7 @@ namespace AMDiS { namespace Parallel {
PC pc_schur_primal;
KSPGetPC(ksp_schur_primal, &pc_schur_primal);
PCSetType(pc_schur_primal, PCLU);
PCFactorSetMatSolverPackage(pc_schur_primal, MATSOLVERMUMPS);
petsc::pc_factor_set_mat_solver_package(pc_schur_primal, MATSOLVERMUMPS);
KSPSetFromOptions(ksp_schur_primal);
......@@ -1588,10 +1589,10 @@ namespace AMDiS { namespace Parallel {
KSPGetPC(ksp_interior, &pc_interior);
if (isSymmetric) {
PCSetType(pc_interior, PCCHOLESKY);
PCFactorSetMatSolverPackage(pc_interior, MATSOLVERMUMPS);
petsc::pc_factor_set_mat_solver_package(pc_interior, MATSOLVERMUMPS);
} else {
PCSetType(pc_interior, PCLU);
PCFactorSetMatSolverPackage(pc_interior, MATSOLVERUMFPACK);
petsc::pc_factor_set_mat_solver_package(pc_interior, MATSOLVERUMFPACK);
}
KSPSetFromOptions(ksp_interior);
......
......@@ -26,6 +26,7 @@
#include "parallel/StdMpi.h"
#include "parallel/MpiHelper.h"
#include "solver/PetscTypes.h"
#include "utility/PetscWrapper.h"
using namespace std;
......@@ -336,13 +337,13 @@ namespace AMDiS { namespace Parallel {
KSPGetPC(kspInterior, &pcInterior);
if (isSymmetric) {
PCSetType(pcInterior, PCCHOLESKY);
PCFactorSetMatSolverPackage(pcInterior, MATSOLVERMUMPS);
petsc::pc_factor_set_mat_solver_package(pcInterior, MATSOLVERMUMPS);
} else {
PCSetType(pcInterior, PCLU);
if (localMatrix)
PCFactorSetMatSolverPackage(pcInterior, MATSOLVERUMFPACK);
petsc::pc_factor_set_mat_solver_package(pcInterior, MATSOLVERUMFPACK);
else
PCFactorSetMatSolverPackage(pcInterior, MATSOLVERMUMPS);
petsc::pc_factor_set_mat_solver_package(pcInterior, MATSOLVERMUMPS);
}
KSPSetFromOptions(kspInterior);
}
......@@ -469,7 +470,7 @@ namespace AMDiS { namespace Parallel {
MatNullSpaceDestroy(&matNullspace);
VecDestroy(&nullspaceBasis);
}
// delete allocated memory
delete basisVec;
......@@ -600,7 +601,7 @@ namespace AMDiS { namespace Parallel {
IS isrow, iscol;
interiorMap->createIndexSet(isrow, startRow, numberOfRows);
interiorMap->createIndexSet(iscol, startCol, numberOfCols);
MatGetSubMatrix(input, isrow, iscol, MAT_INITIAL_MATRIX, output);
petsc::mat_get_sub_matrix(input, isrow, iscol, MAT_INITIAL_MATRIX, output);
ISDestroy(&iscol);
ISDestroy(&isrow);
}
......
......@@ -102,6 +102,32 @@ namespace AMDiS
#endif
}
#if (PETSC_VERSION_MINOR >= 9)
using MatSolverPackage_t = MatSolverType;
inline PetscErrorCode pc_factor_set_mat_solver_package(PC pc, MatSolverType stype)
{
return PCFactorSetMatSolverType(pc, stype);
}
#else
using MatSolverPackage_t = MatSolverPackage;
inline PetscErrorCode pc_factor_set_mat_solver_package(PC pc, MatSolverPackage stype)
{
return PCFactorSetMatSolverPackage(pc, stype);
}
#endif
#if (PETSC_VERSION_MINOR >= 8)
inline PetscErrorCode mat_get_sub_matrix(Mat mat, IS isrow, IS iscol, MatReuse cll, Mat *newmat)
{
return MatCreateSubMatrix(mat, isrow, iscol, cll, newmat);
}
#else
inline PetscErrorCode mat_get_sub_matrix(Mat mat, IS isrow, IS iscol, MatReuse cll, Mat *newmat)
{
return MatGetSubMatrix(mat, isrow, iscol, cll, newmat);
}
#endif
} // end namespace petsc
} // end namespace AMDiS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment