aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschnetter <schnetter@1d96b42b-98df-4a6a-9d84-1b24288d4588>2004-05-05 14:56:42 +0000
committerschnetter <schnetter@1d96b42b-98df-4a6a-9d84-1b24288d4588>2004-05-05 14:56:42 +0000
commit3aadeddca637849eaaa30af2bf7dcf323b9eee30 (patch)
tree7afa9aab7127d05c5ea496d2ed5cfc60292ddf58
parent2e975d34c51617899fc5278f19b467e7f257d7cd (diff)
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
-rw-r--r--src/petsc_confmetric_solver.c16
-rw-r--r--src/petsc_flat_solver.c16
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"