*/
PreconditionJacobi ();
+ /**
+ * A constructor intended to be used with SLEPc objects.
+ */
+ PreconditionJacobi (const MPI_Comm communicator,
+ const AdditionalData &additional_data = AdditionalData());
+
/**
* Constructor. Take the matrix which is used to form the preconditioner,
* Store a copy of the flags for this particular preconditioner.
*/
AdditionalData additional_data;
+
+ /**
+ * Initializes the preconditioner object without knowing a particular matrix.
+ * This function sets up appropriate parameters to the underlying PETSc object
+ * after it has been created.
+ */
+ void initialize();
};
/* ----------------- PreconditionJacobi -------------------- */
+ PreconditionJacobi::PreconditionJacobi (const MPI_Comm comm,
+ const AdditionalData &additional_data_)
+ {
+ additional_data = additional_data_;
+
+ int ierr = PCCreate(comm, &pc);
+ AssertThrow (ierr == 0, ExcPETScError(ierr));
+
+ initialize();
+ }
+
PreconditionJacobi::PreconditionJacobi ()
{}
initialize(matrix, additional_data);
}
+ void
+ PreconditionJacobi::initialize()
+ {
+ int ierr;
+ ierr = PCSetType (pc, const_cast<char *>(PCJACOBI));
+ AssertThrow (ierr == 0, ExcPETScError(ierr));
+
+ ierr = PCSetFromOptions (pc);
+ AssertThrow (ierr == 0, ExcPETScError(ierr));
+ }
void
PreconditionJacobi::initialize (const MatrixBase &matrix_,
additional_data = additional_data_;
create_pc();
+ initialize();
- int ierr;
- ierr = PCSetType (pc, const_cast<char *>(PCJACOBI));
- AssertThrow (ierr == 0, ExcPETScError(ierr));
-
- ierr = PCSetFromOptions (pc);
- AssertThrow (ierr == 0, ExcPETScError(ierr));
-
- ierr = PCSetUp (pc);
+ int ierr = PCSetUp (pc);
AssertThrow (ierr == 0, ExcPETScError(ierr));
}