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(solver_data->ksp,b);
AssertThrow (ierr == 0, ExcPETScError(ierr));
ierr = KSPSetSolution(solver_data->ksp, x);
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