47 #include "Teko_SolveInverseFactory.hpp"
50 #include "Thyra_DefaultLinearOpSource.hpp"
51 #include "Thyra_DefaultInverseLinearOp.hpp"
52 #include "Thyra_DefaultPreconditioner.hpp"
55 #include "Stratimikos_DefaultLinearSolverBuilder.hpp"
59 #include "Teko_BlockPreconditionerFactory.hpp"
60 #include "Teko_Preconditioner.hpp"
61 #include "Teko_PreconditionerLinearOp.hpp"
64 using Teuchos::rcp_const_cast;
65 using Teuchos::rcp_dynamic_cast;
79 SolveInverseFactory::SolveInverseFactory(
const Teuchos::RCP<Thyra::LinearOpWithSolveFactoryBase<double> > & lowsFactory)
80 : lowsFactory_(lowsFactory)
84 SolveInverseFactory::SolveInverseFactory(
const SolveInverseFactory & siFactory)
85 : lowsFactory_(siFactory.lowsFactory_)
97 InverseLinearOp SolveInverseFactory::buildInverse(
const LinearOp & linearOp)
const
99 Teko_DEBUG_SCOPE(
"SolveInverseFactory::buildInverse(linearOp)",10);
102 Teuchos::RCP<Thyra::LinearOpWithSolveBase<double> > invLOWS = lowsFactory_->createOp();
103 lowsFactory_->initializeOp(Thyra::defaultLinearOpSource(linearOp),&*invLOWS,Thyra::SUPPORT_SOLVE_FORWARD_ONLY);
105 return Thyra::nonconstInverse<double>(invLOWS);
120 InverseLinearOp SolveInverseFactory::buildInverse(
const LinearOp & linearOp,
const LinearOp & precOp)
const
122 Teko_DEBUG_SCOPE(
"SolveInverseFactory::buildInverse(linearOp,precOp)",10);
125 Teuchos::RCP<Thyra::LinearOpWithSolveBase<double> > invLOWS = lowsFactory_->createOp();
126 lowsFactory_->initializePreconditionedOp(Thyra::defaultLinearOpSource(linearOp),
127 Thyra::unspecifiedPrec(precOp),
128 &*invLOWS,Thyra::SUPPORT_SOLVE_FORWARD_ONLY);
130 return Thyra::nonconstInverse<double>(invLOWS);
144 void SolveInverseFactory::rebuildInverse(
const LinearOp & source,InverseLinearOp & dest)
const
146 RCP<Thyra::DefaultInverseLinearOp<double> > invDest = rcp_dynamic_cast<Thyra::DefaultInverseLinearOp<double> >(dest);
147 RCP<Thyra::LinearOpWithSolveBase<double> > lows = invDest->getNonconstLows();
152 lowsFactory_->initializeOp(Thyra::defaultLinearOpSource(source),&*lows);
167 void SolveInverseFactory::rebuildInverse(
const LinearOp & source,
const LinearOp & precOp,InverseLinearOp & dest)
const
169 RCP<Thyra::DefaultInverseLinearOp<double> > invDest = rcp_dynamic_cast<Thyra::DefaultInverseLinearOp<double> >(dest);
170 RCP<Thyra::LinearOpWithSolveBase<double> > lows = invDest->getNonconstLows();
173 lowsFactory_->initializePreconditionedOp(Thyra::defaultLinearOpSource(source),
174 Thyra::unspecifiedPrec(precOp),
175 &*lows,Thyra::SUPPORT_SOLVE_FORWARD_ONLY);
186 Teuchos::RCP<const Teuchos::ParameterList> SolveInverseFactory::getParameterList()
const
188 return lowsFactory_->getParameterList();