46 #include "Teuchos_Assert.hpp" 47 #ifdef HAVE_STOKHOS_ML 48 #include "ml_include.h" 49 #include "ml_MultiLevelPreconditioner.h" 56 #ifdef HAVE_STOKHOS_ML 58 if (
precParams->isType<std::string>(
"default values")) {
59 Teuchos::ParameterList ml_defaults;
60 ML_Epetra::SetDefaults(
precParams->get<std::string>(
"default values"),
62 precParams->setParametersNotAlreadySet(ml_defaults);
67 Teuchos::RCP<Epetra_Operator>
69 compute(
const Teuchos::RCP<Epetra_Operator>& op,
bool compute_prec) {
70 #ifdef HAVE_STOKHOS_ML 71 Teuchos::RCP<Epetra_RowMatrix> mat =
73 Teuchos::RCP<ML_Epetra::MultiLevelPreconditioner> ml_prec =
74 Teuchos::rcp(
new ML_Epetra::MultiLevelPreconditioner(*mat, *precParams,
79 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
80 "Stokhos::MLPreconditionerFactory is available " <<
81 "only with configured with ML support!");
83 #endif // HAVE_STOKHOS_ML 89 const Teuchos::RCP<Epetra_Operator>& prec_op) {
90 #ifdef HAVE_STOKHOS_ML 92 Teuchos::RCP<Epetra_CrsMatrix> mat =
94 Teuchos::RCP<ML_Epetra::MultiLevelPreconditioner> ml_prec =
95 Teuchos::rcp_dynamic_cast<ML_Epetra::MultiLevelPreconditioner>(prec_op);
101 non_const_prec_crs_mat = *mat;
104 ml_prec->ComputePreconditioner();
106 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
107 "Stokhos::MLPreconditionerFactory is available " <<
108 "only with configured with ML support!");
109 #endif // HAVE_STOKHOS_ML virtual Teuchos::RCP< Epetra_Operator > compute(const Teuchos::RCP< Epetra_Operator > &op, bool compute_prec=true)
Compute preconditioner.
MLPreconditionerFactory(const Teuchos::RCP< Teuchos::ParameterList > &p)
Constructor.
Teuchos::RCP< Teuchos::ParameterList > precParams
Preconditioner parameters.
virtual void recompute(const Teuchos::RCP< Epetra_Operator > &op, const Teuchos::RCP< Epetra_Operator > &prec)
Recompute preconditioner operator for a new matrix.