]> 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:37:03 +0000 (15:37 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 7 Oct 2004 15:37:03 +0000 (15:37 +0000)
git-svn-id: https://svn.dealii.org/branches/Branch-5-0@9693 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 6b6168b9c33cf7fc5cc9721870c4b6fd3be3b313..f59c955c6b9121cbe69c7a55531fa34e35e53a73 100644 (file)
@@ -232,10 +232,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 6f6ae79eb47667d1d6db8454caa979c0ebfcccef..de15e68d7c81eb66193bf002d82cf516af77cfb9 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 03ed750a3000198dc62c0202096edebe553fd44b..3f55c541cac264872987c099b0cacad6fac7dda2 100644 (file)
@@ -159,7 +159,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(ksp,b);
     AssertThrow (ierr == 0, ExcPETScError(ierr));
     ierr = KSPSetSolution(ksp,x);
@@ -173,6 +176,13 @@ namespace PETScWrappers
                                      // and destroy the solver object
     ierr = KSPDestroy (ksp);
     AssertThrow (ierr == 0, ExcPETScError(ierr));
+#  else
+    ierr = KSPSetUp (ksp);
+    AssertThrow (ierr == 0, ExcPETScError(ierr));
+
+    ierr = KSPSolve (ksp, b, x);
+    AssertThrow (ierr == 0, ExcPETScError(ierr));
+#  endif 
 
 #endif
                                      // 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.