43 TEUCHOS_TEST_FOR_EXCEPTION(
44 precFactory_ == Teuchos::null, std::runtime_error,
45 "ERROR: Teko::IterativePreconditionerFactory::buildPreconditionerOperator requires that a "
46 <<
"preconditioner factory has been set. Currently it is null!");
50 if (invP == Teuchos::null)
51 invP = Teko::buildInverse(*precFactory_, lo);
53 Teko::rebuildInverse(*precFactory_, lo, invP);
59 LinearOp I = Thyra::identity(lo->range(),
"I");
60 LinearOp AiP = multiply(lo, invP.getConst(),
"AiP");
61 LinearOp correction = add(I, scale(-1.0, AiP));
64 for (
unsigned int i = 0; i < correctionNum_; i++)
65 resMap = add(I, multiply(resMap, correction));
68 return multiply(invP.getConst(), resMap);
75 const Teuchos::ParameterList& settings) {
77 if (settings.isParameter(
"Iteration Count"))
78 correctionNum_ = settings.get<
int>(
"Iteration Count");
80 TEUCHOS_TEST_FOR_EXCEPTION(
81 not settings.isParameter(
"Preconditioner Type"), std::runtime_error,
82 "Parameter \"Preconditioner Type\" is required by a Teko::IterativePreconditionerFactory");
86 std::string precName = settings.get<std::string>(
"Preconditioner Type");
89 precFactory_ = il->getInverseFactory(precName);
90 TEUCHOS_TEST_FOR_EXCEPTION(
91 precFactory_ == Teuchos::null, std::runtime_error,
92 "ERROR: \"Preconditioner Type\" = " << precName <<
" could not be found");