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;
}
// 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);
// 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