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"
112 using Teuchos::rcp_const_cast;
113 using Teuchos::rcp_dynamic_cast;
122 }
catch (std::exception& e) {
123 RCP<Teuchos::FancyOStream> out = Teko::getOutputStream();
125 *out <<
"Teko: \"buildInverse\" could not construct the inverse operator using ";
126 *out <<
"\"" << factory.
toString() <<
"\"" << std::endl;
128 *out <<
"*** THROWN EXCEPTION ***\n";
129 *out << e.what() << std::endl;
130 *out <<
"************************\n";
150 const LinearOp& precOp) {
151 Teko_DEBUG_SCOPE(
"buildInverse(factory,A,precOp)", 10);
155 }
catch (std::exception& e) {
156 RCP<Teuchos::FancyOStream> out = Teko::getOutputStream();
158 *out <<
"Teko: \"buildInverse\" could not construct the inverse operator using ";
159 *out <<
"\"" << factory.
toString() <<
"\"" << std::endl;
161 *out <<
"*** THROWN EXCEPTION ***\n";
162 *out << e.what() << std::endl;
163 *out <<
"************************\n";
178 }
catch (std::exception& e) {
179 RCP<Teuchos::FancyOStream> out = Teko::getOutputStream();
181 *out <<
"Teko: \"rebuildInverse\" could not construct the inverse operator using ";
182 *out <<
"\"" << factory.
toString() <<
"\"" << std::endl;
184 *out <<
"*** THROWN EXCEPTION ***\n";
185 *out << e.what() << std::endl;
186 *out <<
"************************\n";
208 InverseLinearOp& invA) {
212 }
catch (std::exception& e) {
213 RCP<Teuchos::FancyOStream> out = Teko::getOutputStream();
215 *out <<
"Teko: \"rebuildInverse\" could not construct the inverse operator using ";
216 *out <<
"\"" << factory.
toString() <<
"\"" << std::endl;
218 *out <<
"*** THROWN EXCEPTION ***\n";
219 *out << e.what() << std::endl;
220 *out <<
"************************\n";
238 const std::string& type) {
239 RCP<Teuchos::ParameterList> myList = rcp(
new Teuchos::ParameterList(list));
241 Stratimikos::DefaultLinearSolverBuilder strat;
242 addToStratimikosBuilder(rcpFromRef(strat));
243 strat.setParameterList(myList);
247 RCP<Thyra::PreconditionerFactoryBase<double> > precFact =
248 strat.createPreconditioningStrategy(type);
251 return rcp(
new PreconditionerInverseFactory(precFact, Teuchos::null));
252 }
catch (
const Teuchos::Exceptions::InvalidParameterValue& exp) {
257 RCP<Thyra::LinearOpWithSolveFactoryBase<double> > solveFact =
258 strat.createLinearSolveStrategy(type);
261 return rcp(
new SolveInverseFactory(solveFact));
262 }
catch (
const Teuchos::Exceptions::InvalidParameterValue& exp) {
265 return Teuchos::null;
278 Stratimikos::DefaultLinearSolverBuilder strat;
281 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)