55 #include "Teko_InverseFactory.hpp"
58 #include "Thyra_DefaultLinearOpSource.hpp"
59 #include "Thyra_DefaultInverseLinearOp.hpp"
60 #include "Thyra_DefaultPreconditioner.hpp"
63 #include "Stratimikos_DefaultLinearSolverBuilder.hpp"
67 #include "Teko_BlockPreconditionerFactory.hpp"
68 #include "Teko_Preconditioner.hpp"
69 #include "Teko_PreconditionerLinearOp.hpp"
70 #include "Teko_SolveInverseFactory.hpp"
71 #include "Teko_PreconditionerInverseFactory.hpp"
75 using Teuchos::rcp_const_cast;
76 using Teuchos::rcp_dynamic_cast;
85 }
catch (std::exception& e) {
86 RCP<Teuchos::FancyOStream> out = Teko::getOutputStream();
88 *out <<
"Teko: \"buildInverse\" could not construct the inverse operator using ";
89 *out <<
"\"" << factory.
toString() <<
"\"" << std::endl;
91 *out <<
"*** THROWN EXCEPTION ***\n";
92 *out << e.what() << std::endl;
93 *out <<
"************************\n";
113 const LinearOp& precOp) {
114 Teko_DEBUG_SCOPE(
"buildInverse(factory,A,precOp)", 10);
118 }
catch (std::exception& e) {
119 RCP<Teuchos::FancyOStream> out = Teko::getOutputStream();
121 *out <<
"Teko: \"buildInverse\" could not construct the inverse operator using ";
122 *out <<
"\"" << factory.
toString() <<
"\"" << std::endl;
124 *out <<
"*** THROWN EXCEPTION ***\n";
125 *out << e.what() << std::endl;
126 *out <<
"************************\n";
141 }
catch (std::exception& e) {
142 RCP<Teuchos::FancyOStream> out = Teko::getOutputStream();
144 *out <<
"Teko: \"rebuildInverse\" could not construct the inverse operator using ";
145 *out <<
"\"" << factory.
toString() <<
"\"" << std::endl;
147 *out <<
"*** THROWN EXCEPTION ***\n";
148 *out << e.what() << std::endl;
149 *out <<
"************************\n";
171 InverseLinearOp& invA) {
175 }
catch (std::exception& e) {
176 RCP<Teuchos::FancyOStream> out = Teko::getOutputStream();
178 *out <<
"Teko: \"rebuildInverse\" could not construct the inverse operator using ";
179 *out <<
"\"" << factory.
toString() <<
"\"" << std::endl;
181 *out <<
"*** THROWN EXCEPTION ***\n";
182 *out << e.what() << std::endl;
183 *out <<
"************************\n";
201 const std::string& type) {
202 RCP<Teuchos::ParameterList> myList = rcp(
new Teuchos::ParameterList(list));
204 Stratimikos::DefaultLinearSolverBuilder strat;
205 addToStratimikosBuilder(rcpFromRef(strat));
206 strat.setParameterList(myList);
210 RCP<Thyra::PreconditionerFactoryBase<double> > precFact =
211 strat.createPreconditioningStrategy(type);
214 return rcp(
new PreconditionerInverseFactory(precFact, Teuchos::null));
215 }
catch (
const Teuchos::Exceptions::InvalidParameterValue& exp) {
220 RCP<Thyra::LinearOpWithSolveFactoryBase<double> > solveFact =
221 strat.createLinearSolveStrategy(type);
224 return rcp(
new SolveInverseFactory(solveFact));
225 }
catch (
const Teuchos::Exceptions::InvalidParameterValue& exp) {
228 return Teuchos::null;
241 Stratimikos::DefaultLinearSolverBuilder strat;
244 return strat.getValidParameters();
void rebuildInverse(const InverseFactory &factory, const LinearOp &A, InverseLinearOp &invA)
Abstract class for building an inverse operator.
virtual InverseLinearOp buildInverse(const LinearOp &linearOp) const =0
Build an inverse operator.
RCP< InverseFactory > invFactoryFromParamList(const Teuchos::ParameterList &list, const std::string &type)
Build an InverseFactory object from a ParameterList, as specified in Stratimikos. ...
virtual std::string toString() const =0
InverseLinearOp buildInverse(const InverseFactory &factory, const LinearOp &A, const LinearOp &precOp)
InverseLinearOp buildInverse(const InverseFactory &factory, const LinearOp &A)
Build an inverse operator using a factory and a linear operator.
Teuchos::RCP< const Teuchos::ParameterList > invFactoryValidParameters()
Get a valid parameter list for the inverse factory class.
virtual void rebuildInverse(const LinearOp &source, InverseLinearOp &dest) const =0
Pass in an already constructed inverse operator. Update the inverse operator based on the new source ...
void rebuildInverse(const InverseFactory &factory, const LinearOp &A, const LinearOp &precOp, InverseLinearOp &invA)