47 #include "Teko_ProbingPreconditionerFactory.hpp"
49 #ifdef Teko_ENABLE_Isorropia
51 #include "Teko_EpetraOperatorWrapper.hpp"
53 #include "Thyra_get_Epetra_Operator.hpp"
54 #include "Thyra_EpetraLinearOp.hpp"
55 #include "Epetra_CrsMatrix.h"
58 using Teuchos::rcp_dynamic_cast;
59 using Teuchos::rcpFromRef;
67 ProbingPreconditionerFactory::ProbingPreconditionerFactory()
69 prober = rcp(
new Isorropia::Epetra::Prober);
72 LinearOp ProbingPreconditionerFactory::buildPreconditionerOperator(LinearOp & lo,PreconditionerState & state)
const
81 RCP<Epetra_CrsMatrix> retOp = prober->probe(*epetraLo);
82 Teko::LinearOp probedOp = Thyra::epetraLinearOp(retOp);
87 void ProbingPreconditionerFactory::initializeFromParameterList(
const Teuchos::ParameterList & pl)
89 RCP<const InverseLibrary> invLib = getInverseLibrary();
91 const std::string inverse_type =
"Inverse Type";
92 const std::string probing_graph_operator =
"Probing Graph Operator";
93 const std::string probing_graph =
"Probing Graph";
94 const std::string user_graph =
"User Will Set Probing Graph";
97 std::string invStr =
"Amesos";
98 if(pl.isParameter(inverse_type))
99 invStr = pl.get<std::string>(inverse_type);
101 if(pl.isParameter(probing_graph_operator))
102 setGraphOperator(pl.get<Teko::LinearOp>(probing_graph_operator));
103 else if(pl.isParameter(probing_graph))
104 setGraph(pl.get<RCP<const Epetra_CrsGraph> >(probing_graph));
105 else if(pl.isParameter(user_graph) && pl.get<
bool>(
"User Will Set Probing Graph")){
109 Teuchos::RCP<Teko::RequestHandler> rh = getRequestHandler();
110 rh->preRequest<RCP<const Epetra_CrsGraph> >(Teko::RequestMesg(
"Probing Graph"));
111 setGraph(rh->request<RCP<const Epetra_CrsGraph> >(Teko::RequestMesg(
"Probing Graph")));
114 setInverseFactory(invLib->getInverseFactory(invStr));
117 void ProbingPreconditionerFactory::setGraphOperator(
const Teko::LinearOp & graphOp)
119 RCP<const Epetra_CrsMatrix> crsMatrix = rcp_dynamic_cast<
const Epetra_CrsMatrix>(Thyra::get_Epetra_Operator(*graphOp));
120 setGraph(Teuchos::rcpFromRef(crsMatrix->Graph()));
123 void ProbingPreconditionerFactory::setGraph(
const Teuchos::RCP<const Epetra_CrsGraph> & graph)
125 prober->setGraph(graph);
128 void ProbingPreconditionerFactory::setProberList(
const Teuchos::ParameterList & list)
130 prober->setList(list);
Implements the Epetra_Operator interface with a Thyra LinearOperator. This enables the use of absrtac...
InverseLinearOp buildInverse(const InverseFactory &factory, const LinearOp &A)
Build an inverse operator using a factory and a linear operator.