]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
SLES has been abandoned in petsc 2.2. Don't try to use it any more.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 19 Mar 2004 19:00:49 +0000 (19:00 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 19 Mar 2004 19:00:49 +0000 (19:00 +0000)
git-svn-id: https://svn.dealii.org/trunk@8832 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/source/petsc_solver.cc

index f2cc2fe9cc408854a749ae66032c3d3d472e83b0..086131ca1394ac020f4695d255bdd7bb1a215cd0 100644 (file)
@@ -47,29 +47,25 @@ namespace PETScWrappers
     int ierr;
 
                                      // first create a solver object
-    SLES sles;
-    ierr = SLESCreate (mpi_communicator, &sles);
+    KSP ksp;
+    ierr = KSPCreate (mpi_communicator, &ksp);
     AssertThrow (ierr == 0, ExcPETScError(ierr));
 
                                      // set the matrices involved. the
                                      // last argument is irrelevant here,
                                      // since we use the solver only once
                                      // anyway
-    ierr = SLESSetOperators (sles, A, preconditioner,
-                             SAME_PRECONDITIONER);
+    ierr = KSPSetOperators (ksp, A, preconditioner,
+                            SAME_PRECONDITIONER);
     AssertThrow (ierr == 0, ExcPETScError(ierr));
 
                                      // let derived classes set the solver
                                      // type, and the preconditioning object
                                      // set the type of preconditioner
-    KSP ksp;
-    ierr = SLESGetKSP (sles, &ksp);
-    AssertThrow (ierr == 0, ExcPETScError(ierr));
-
     set_solver_type (ksp);
     
     PC pc;
-    ierr = SLESGetPC (sles, &pc);
+    ierr = KSPGetPC (ksp, &pc);
     AssertThrow (ierr == 0, ExcPETScError(ierr));
 
     preconditioner.set_preconditioner_type (pc);
@@ -88,19 +84,19 @@ namespace PETScWrappers
     
                                      // then do the real work: set up solver
                                      // internal data and solve the
-                                     // system. this could be joined in one
-                                     // operation, but it is recommended this
-                                     // way to be able to separate statistic
-                                     // output if requested
-    int iterations = 0;
-    ierr = SLESSetUp (sles, b, x);
+                                     // system.
+    ierr = KSPSetRhs(ksp,b);
+    AssertThrow (ierr == 0, ExcPETScError(ierr));
+    ierr = KSPSetSolution(ksp,x);
+    AssertThrow (ierr == 0, ExcPETScError(ierr));
+    ierr = KSPSetUp (ksp);
     AssertThrow (ierr == 0, ExcPETScError(ierr));
     
-    ierr = SLESSolve (sles, b, x, &iterations);
+    ierr = KSPSolve (ksp);
     AssertThrow (ierr == 0, ExcPETScError(ierr));
 
                                      // and destroy the solver object
-    ierr = SLESDestroy (sles);
+    ierr = KSPDestroy (ksp);
     AssertThrow (ierr == 0, ExcPETScError(ierr));
 
                                      // in case of failure: throw

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.