From 3aadeddca637849eaaa30af2bf7dcf323b9eee30 Mon Sep 17 00:00:00 2001 From: schnetter Date: Wed, 5 May 2004 14:56:42 +0000 Subject: Make EllPETSc compile with PETSc 2.2.0. The new version has no SLES object any more; instead the KSP object is used, which was previously stored inside the SLES object. As is, EllPETSc does not work with PETSc 2.2.0. There is no testsuite for EllPETSc, so I don't know whether these changes cause trouble, or whether it was broken before. git-svn-id: http://svn.cactuscode.org/arrangements/CactusElliptic/EllPETSc/trunk@84 1d96b42b-98df-4a6a-9d84-1b24288d4588 --- src/petsc_confmetric_solver.c | 16 ++++++++++++++-- src/petsc_flat_solver.c | 16 ++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/petsc_confmetric_solver.c b/src/petsc_confmetric_solver.c index e2f7e0c..c4bfb5c 100644 --- a/src/petsc_confmetric_solver.c +++ b/src/petsc_confmetric_solver.c @@ -15,11 +15,23 @@ #include "cctk.h" #include "cctk_Parameters.h" +#include "petsc.h" #include "petscversion.h" #if PETSC_VERSION_MAJOR < 2 || (PETSC_VERSION_MAJOR == 2 && PETSC_VERSION_MINOR == 0) -#include "sles.h" +# include "sles.h" +#elif PETSC_VERSION_MAJOR == 2 && PETSC_VERSION_MINOR < 2 +# include "petscsles.h" #else -#include "petscsles.h" +# include "petscmat.h" +# include "petscksp.h" +# define SLES KSP +# define SLESCreate KSPCreate +# define SLESSetOperators KSPSetOperators +# define SLESGetKSP(a,b) ((*b)=a,0) +# define SLESGetPC KSPGetPC +# define SLESSetFromOptions KSPSetFromOptions +# define SLESSolve(a,b,c,d) (KSPSetRhs((a),(b)),KSPSetSolution((a),(c)),KSPSolve(a),KSPGetIterationNumber(a,d)) +# define SLESDestroy KSPDestroy #endif #include "ellpetsc.h" diff --git a/src/petsc_flat_solver.c b/src/petsc_flat_solver.c index e331e41..dc09aa3 100644 --- a/src/petsc_flat_solver.c +++ b/src/petsc_flat_solver.c @@ -14,11 +14,23 @@ #include "cctk_CommandLine.h" #include "cctk_Parameters.h" +#include "petsc.h" #include "petscversion.h" #if PETSC_VERSION_MAJOR < 2 || (PETSC_VERSION_MAJOR == 2 && PETSC_VERSION_MINOR == 0) -#include "sles.h" +# include "sles.h" +#elif PETSC_VERSION_MAJOR == 2 && PETSC_VERSION_MINOR < 2 +# include "petscsles.h" #else -#include "petscsles.h" +# include "petscmat.h" +# include "petscksp.h" +# define SLES KSP +# define SLESCreate KSPCreate +# define SLESSetOperators KSPSetOperators +# define SLESGetKSP(a,b) ((*b)=a,0) +# define SLESGetPC KSPGetPC +# define SLESSetFromOptions KSPSetFromOptions +# define SLESSolve(a,b,c,d) (KSPSetRhs((a),(b)),KSPSetSolution((a),(c)),KSPSolve(a),KSPGetIterationNumber(a,d)) +# define SLESDestroy KSPDestroy #endif #include "ellpetsc.h" -- cgit v1.2.3