]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Make things compile with PETSc 2.2.1, which has changed interfaces again...
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 7 Oct 2004 15:38:24 +0000 (15:38 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 7 Oct 2004 15:38:24 +0000 (15:38 +0000)
git-svn-id: https://svn.dealii.org/trunk@9694 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/petsc_vector.h
deal.II/lac/source/petsc_matrix_base.cc
deal.II/lac/source/petsc_solver.cc

index 8870305da8ce149ee72da6525c7102ed1f5d1529..39de2f2789f0e086781d80a9fc337faf4089b27a 100644 (file)
@@ -257,10 +257,38 @@ namespace PETScWrappers
     int ierr = VecDestroy (vector);
     AssertThrow (ierr == 0, ExcPETScError(ierr));
 
-                                     // then do the gather operation
+                                     // then do the gather
+                                     // operation. <rant>petsc has changed its
+                                     // interface again, and replaced a single
+                                     // function call by several calls that
+                                     // are hard to understand. gets me all
+                                     // annoyed at their development
+                                     // model</rant>
+#if (PETSC_VERSION_MAJOR <= 2) && \
+    ((PETSC_VERSION_MINOR < 2) ||  \
+     ((PETSC_VERSION_MINOR == 2) && (PETSC_VERSION_SUBMINOR == 0)))
     ierr = VecConvertMPIToSeqAll (static_cast<const Vec &>(v),
                                   &vector);
     AssertThrow (ierr == 0, ExcPETScError(ierr));
+
+#else
+    
+    VecScatter ctx;
+
+    ierr = VecScatterCreateToAll (static_cast<const Vec &>(v), &ctx, &vector);
+    AssertThrow (ierr == 0, ExcPETScError(ierr));
+
+    ierr = VecScatterBegin (static_cast<const Vec &>(v), vector,
+                            INSERT_VALUES, SCATTER_FORWARD, ctx);
+    AssertThrow (ierr == 0, ExcPETScError(ierr));
+
+    ierr = VecScatterEnd (static_cast<const Vec &>(v), vector,
+                          INSERT_VALUES, SCATTER_FORWARD, ctx);
+    AssertThrow (ierr == 0, ExcPETScError(ierr));
+
+    ierr = VecScatterDestroy (ctx);
+    AssertThrow (ierr == 0, ExcPETScError(ierr));
+#endif
     
     return *this;
   }
index 0397a1e84851c78aca5262fca68c5534b179f418..e99ebf9ecf09b9c7fdd05f78a849235beb8c741c 100644 (file)
@@ -46,9 +46,9 @@ namespace PETScWrappers
 
                                        // get a representation of the present
                                        // row
-      int          ncols;
-      int         *colnums;
-      PetscScalar *values;
+      int                ncols;
+      const int         *colnums;
+      const PetscScalar *values;
 
       int ierr;
       ierr = MatGetRow(*matrix, this->a_row, &ncols, &colnums, &values);
index 949982d06f7f9cbb1d29d425aef72e58b4b5105b..1b77edbc13b4e6dbc2503d7283df59a8ae280a64 100644 (file)
@@ -168,7 +168,10 @@ namespace PETScWrappers
     
                                      // then do the real work: set up solver
                                      // internal data and solve the
-                                     // system.
+                                     // system. unfortunately, the call
+                                     // sequence is different between PETSc
+                                     // versions 2.2.0 and 2.2.1
+#  if (PETSC_VERSION_MINOR == 2) && (PETSC_VERSION_SUBMINOR == 0)
     ierr = KSPSetRhs(solver_data->ksp,b);
     AssertThrow (ierr == 0, ExcPETScError(ierr));
     ierr = KSPSetSolution(solver_data->ksp, x);
@@ -178,6 +181,13 @@ namespace PETScWrappers
     
     ierr = KSPSolve (solver_data->ksp);
     AssertThrow (ierr == 0, ExcPETScError(ierr));
+#  else
+    ierr = KSPSetUp (solver_data->ksp);
+    AssertThrow (ierr == 0, ExcPETScError(ierr));
+
+    ierr = KSPSolve (solver_data->ksp, b, x);
+    AssertThrow (ierr == 0, ExcPETScError(ierr));
+#  endif 
 
 #endif
                                      // destroy solver object

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.