diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/petsc_confmetric_solver.c | 16 | ||||
-rw-r--r-- | 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" |