92 #include "Teko_InverseFactory.hpp"
95 #include "Thyra_DefaultLinearOpSource.hpp"
96 #include "Thyra_DefaultInverseLinearOp.hpp"
97 #include "Thyra_DefaultPreconditioner.hpp"
100 #include "Stratimikos_DefaultLinearSolverBuilder.hpp"
104 #include "Teko_BlockPreconditionerFactory.hpp"
105 #include "Teko_Preconditioner.hpp"
106 #include "Teko_PreconditionerLinearOp.hpp"
107 #include "Teko_SolveInverseFactory.hpp"
108 #include "Teko_PreconditionerInverseFactory.hpp"
111 using Teuchos::rcp_const_cast;
112 using Teuchos::rcp_dynamic_cast;
124 catch(std::exception & e) {
125 RCP<Teuchos::FancyOStream> out = Teko::getOutputStream();
127 *out <<
"Teko: \"buildInverse\" could not construct the inverse operator using ";
128 *out <<
"\"" << factory.
toString() <<
"\"" << std::endl;
130 *out <<
"*** THROWN EXCEPTION ***\n";
131 *out << e.what() << std::endl;
132 *out <<
"************************\n";
153 Teko_DEBUG_SCOPE(
"buildInverse(factory,A,precOp)",10);
158 catch(std::exception & e) {
159 RCP<Teuchos::FancyOStream> out = Teko::getOutputStream();
161 *out <<
"Teko: \"buildInverse\" could not construct the inverse operator using ";
162 *out <<
"\"" << factory.
toString() <<
"\"" << std::endl;
164 *out <<
"*** THROWN EXCEPTION ***\n";
165 *out << e.what() << std::endl;
166 *out <<
"************************\n";
183 catch(std::exception & e) {
184 RCP<Teuchos::FancyOStream> out = Teko::getOutputStream();
186 *out <<
"Teko: \"rebuildInverse\" could not construct the inverse operator using ";
187 *out <<
"\"" << factory.
toString() <<
"\"" << std::endl;
189 *out <<
"*** THROWN EXCEPTION ***\n";
190 *out << e.what() << std::endl;
191 *out <<
"************************\n";
218 catch(std::exception & e) {
219 RCP<Teuchos::FancyOStream> out = Teko::getOutputStream();
221 *out <<
"Teko: \"rebuildInverse\" could not construct the inverse operator using ";
222 *out <<
"\"" << factory.
toString() <<
"\"" << std::endl;
224 *out <<
"*** THROWN EXCEPTION ***\n";
225 *out << e.what() << std::endl;
226 *out <<
"************************\n";
245 RCP<Teuchos::ParameterList> myList = rcp(
new Teuchos::ParameterList(list));
247 Stratimikos::DefaultLinearSolverBuilder strat;
248 addToStratimikosBuilder(rcpFromRef(strat));
249 strat.setParameterList(myList);
253 RCP<Thyra::PreconditionerFactoryBase<double> > precFact = strat.createPreconditioningStrategy(type);
256 return rcp(
new PreconditionerInverseFactory(precFact,Teuchos::null));
258 catch(
const Teuchos::Exceptions::InvalidParameterValue & exp) { }
262 RCP<Thyra::LinearOpWithSolveFactoryBase<double> > solveFact = strat.createLinearSolveStrategy(type);
265 return rcp(
new SolveInverseFactory(solveFact));
267 catch(
const Teuchos::Exceptions::InvalidParameterValue & exp) { }
269 return Teuchos::null;;
282 Stratimikos::DefaultLinearSolverBuilder strat;
285 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)