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

corrected some interface changes in petsc 3.7

parent 24b520f6
...@@ -327,7 +327,6 @@ namespace AMDiS ...@@ -327,7 +327,6 @@ namespace AMDiS
rtol, atol, maxIt); rtol, atol, maxIt);
} }
void createSolver(MPI::Intracomm comm, KSP &ksp, Mat m, std::string kspPrefix, int info) void createSolver(MPI::Intracomm comm, KSP &ksp, Mat m, std::string kspPrefix, int info)
{ {
KSPCreate(comm, &ksp); KSPCreate(comm, &ksp);
...@@ -341,9 +340,9 @@ namespace AMDiS ...@@ -341,9 +340,9 @@ namespace AMDiS
KSPSetOptionsPrefix(ksp, kspPrefix.c_str()); KSPSetOptionsPrefix(ksp, kspPrefix.c_str());
if (info >= 10) if (info >= 10)
KSPMonitorSet(ksp, KSPMonitorDefault, PETSC_NULL, PETSC_NULL); KSPMonitorSet(ksp, PETSC_MONITOR_CAST(KSPMonitorDefault), PETSC_NULL, PETSC_NULL);
else if (info >= 20) else if (info >= 20)
KSPMonitorSet(ksp, KSPMonitorTrueResidualNorm, PETSC_NULL, PETSC_NULL); KSPMonitorSet(ksp, PETSC_MONITOR_CAST(KSPMonitorTrueResidualNorm), PETSC_NULL, PETSC_NULL);
} }
} // end namespace petsc_helper } // end namespace petsc_helper
......
...@@ -31,6 +31,13 @@ ...@@ -31,6 +31,13 @@
#include <petsc.h> #include <petsc.h>
#include "AMDiS_fwd.h" #include "AMDiS_fwd.h"
#if (PETSC_VERSION_MINOR >= 7)
#define PETSC_MONITOR_CAST(...) \
(PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*))(__VA_ARGS__)
#else
#define PETSC_MONITOR_CAST(...) __VA_ARGS__
#endif
namespace AMDiS namespace AMDiS
{ {
namespace Parallel namespace Parallel
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "AMDiS_fwd.h" #include "AMDiS_fwd.h"
#include "parallel/ParallelCoarseSpaceSolver.h" #include "parallel/ParallelCoarseSpaceSolver.h"
#include "solver/PetscTypes.h"
namespace AMDiS namespace AMDiS
{ {
......
...@@ -91,9 +91,9 @@ namespace AMDiS { namespace Parallel { ...@@ -91,9 +91,9 @@ namespace AMDiS { namespace Parallel {
KSPSetOperators(ksp, getMatInterior(), getMatInterior(), SAME_NONZERO_PATTERN); KSPSetOperators(ksp, getMatInterior(), getMatInterior(), SAME_NONZERO_PATTERN);
#endif #endif
if (getInfo() >= 10) if (getInfo() >= 10)
KSPMonitorSet(ksp, KSPMonitorDefault, PETSC_NULL, PETSC_NULL); KSPMonitorSet(ksp, PETSC_MONITOR_CAST(KSPMonitorDefault), PETSC_NULL, PETSC_NULL);
else if (getInfo() >= 20) else if (getInfo() >= 20)
KSPMonitorSet(ksp, KSPMonitorTrueResidualNorm, PETSC_NULL, PETSC_NULL); KSPMonitorSet(ksp, PETSC_MONITOR_CAST(KSPMonitorTrueResidualNorm), PETSC_NULL, PETSC_NULL);
petsc_helper::setSolver(ksp, "ch_", KSPFGMRES, PCNONE, getRelative(), getTolerance(), getMaxIterations()); petsc_helper::setSolver(ksp, "ch_", KSPFGMRES, PCNONE, getRelative(), getTolerance(), getMaxIterations());
KSPSetFromOptions(ksp); KSPSetFromOptions(ksp);
......
...@@ -123,9 +123,9 @@ namespace AMDiS { namespace Parallel { ...@@ -123,9 +123,9 @@ namespace AMDiS { namespace Parallel {
KSPSetOperators(ksp, getMatInterior(), getMatInterior(), SAME_NONZERO_PATTERN); KSPSetOperators(ksp, getMatInterior(), getMatInterior(), SAME_NONZERO_PATTERN);
#endif #endif
if (getInfo() >= 10) if (getInfo() >= 10)
KSPMonitorSet(ksp, KSPMonitorDefault, PETSC_NULL, PETSC_NULL); KSPMonitorSet(ksp, PETSC_MONITOR_CAST(KSPMonitorDefault), PETSC_NULL, PETSC_NULL);
else if (getInfo() >= 20) else if (getInfo() >= 20)
KSPMonitorSet(ksp, KSPMonitorTrueResidualNorm, PETSC_NULL, PETSC_NULL); KSPMonitorSet(ksp, PETSC_MONITOR_CAST(KSPMonitorTrueResidualNorm), PETSC_NULL, PETSC_NULL);
petsc_helper::setSolver(ksp, "ch_", KSPFGMRES, PCNONE, getRelative(), getTolerance(), getMaxIterations()); petsc_helper::setSolver(ksp, "ch_", KSPFGMRES, PCNONE, getRelative(), getTolerance(), getMaxIterations());
if (useOldInitialGuess) if (useOldInitialGuess)
......
...@@ -1382,9 +1382,9 @@ namespace AMDiS { namespace Parallel { ...@@ -1382,9 +1382,9 @@ namespace AMDiS { namespace Parallel {
Parameters::get(name + "->feti->monitor", monitor); Parameters::get(name + "->feti->monitor", monitor);
if (monitor) { if (monitor) {
if (stokesMode) if (stokesMode)
KSPMonitorSet(ksp_feti, KSPMonitorFetiStokes, &fetiKspData, PETSC_NULL); KSPMonitorSet(ksp_feti, PETSC_MONITOR_CAST(KSPMonitorFetiStokes), &fetiKspData, PETSC_NULL);
else else
KSPMonitorSet(ksp_feti, KSPMonitorTrueResidualNorm, PETSC_NULL, PETSC_NULL); KSPMonitorSet(ksp_feti, PETSC_MONITOR_CAST(KSPMonitorTrueResidualNorm), PETSC_NULL, PETSC_NULL);
} }
......
...@@ -189,7 +189,7 @@ namespace AMDiS { namespace Parallel { ...@@ -189,7 +189,7 @@ namespace AMDiS { namespace Parallel {
#else #else
KSPSetOperators(ksp, getMatInterior(), getMatInterior(), SAME_NONZERO_PATTERN); KSPSetOperators(ksp, getMatInterior(), getMatInterior(), SAME_NONZERO_PATTERN);
#endif #endif
KSPMonitorSet(ksp, KSPMonitorTrueResidualNorm, PETSC_NULL, PETSC_NULL); KSPMonitorSet(ksp, PETSC_MONITOR_CAST(KSPMonitorTrueResidualNorm), PETSC_NULL, PETSC_NULL);
petsc_helper::setSolver(ksp, "ch_", KSPFGMRES, PCSHELL, getRelative(), getTolerance(), getMaxIterations()); petsc_helper::setSolver(ksp, "ch_", KSPFGMRES, PCSHELL, getRelative(), getTolerance(), getMaxIterations());
setConstantNullSpace(ksp, componentSpaces[0]->getMesh()->getDim() , true); setConstantNullSpace(ksp, componentSpaces[0]->getMesh()->getDim() , true);
} }
......
...@@ -123,9 +123,9 @@ namespace AMDiS { namespace Parallel { ...@@ -123,9 +123,9 @@ namespace AMDiS { namespace Parallel {
KSPSetOperators(ksp, getMatInterior(), getMatInterior(), SAME_NONZERO_PATTERN); KSPSetOperators(ksp, getMatInterior(), getMatInterior(), SAME_NONZERO_PATTERN);
#endif #endif
if (getInfo() >= 10) if (getInfo() >= 10)
KSPMonitorSet(ksp, KSPMonitorDefault, PETSC_NULL, PETSC_NULL); KSPMonitorSet(ksp, PETSC_MONITOR_CAST(KSPMonitorDefault), PETSC_NULL, PETSC_NULL);
else if (getInfo() >= 20) else if (getInfo() >= 20)
KSPMonitorSet(ksp, KSPMonitorTrueResidualNorm, PETSC_NULL, PETSC_NULL); KSPMonitorSet(ksp, PETSC_MONITOR_CAST(KSPMonitorTrueResidualNorm), PETSC_NULL, PETSC_NULL);
petsc_helper::setSolver(ksp, "ns_", KSPFGMRES, PCNONE, getRelative(), getTolerance(), getMaxIterations()); petsc_helper::setSolver(ksp, "ns_", KSPFGMRES, PCNONE, getRelative(), getTolerance(), getMaxIterations());
// Create null space information. // Create null space information.
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include <petsc.h> #include <petsc.h>
#include <petscmat.h> #include <petscmat.h>
#include <petscvec.h> #include <petscvec.h>
#include <options.h>
namespace AMDiS { namespace AMDiS {
...@@ -145,7 +144,7 @@ namespace AMDiS { ...@@ -145,7 +144,7 @@ namespace AMDiS {
void operator>>(const PetscVectorNested& dest, VecMap<SystemVector, Mapper>& rhs); void operator>>(const PetscVectorNested& dest, VecMap<SystemVector, Mapper>& rhs);
PetscErrorCode petsc_options_insert_string(const char in_str[]) inline PetscErrorCode petsc_options_insert_string(const char in_str[])
{ {
#if (PETSC_VERSION_MINOR >= 7) #if (PETSC_VERSION_MINOR >= 7)
return PetscOptionsInsertString(NULL, in_str); return PetscOptionsInsertString(NULL, in_str);
......
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