49 #ifndef SHYLU_DIRECTSOLVER_INTERFACE_DEF_HPP 50 #define SHYLU_DIRECTSOLVER_INTERFACE_DEF_HPP 52 #include "ShyLUCore_config.h" 55 #include <Teuchos_XMLParameterListHelpers.hpp> 60 template<
class Matrix,
class Vector>
64 template<
class Matrix,
class Vector>
71 template<
class Matrix,
class Vector>
75 template <
class Matrix,
class Vector>
87 template <
class Matrix,
class Vector>
91 cout <<
"**Error**: Amesos is only supported for Epetra Matrices \n";
102 Teuchos::ParameterList subList = pList->sublist(
"Amesos Input");
103 string solvertype = Teuchos::getParameter<string>(subList,
"Solver");
104 Teuchos::ParameterList subsubList = subList.sublist(solvertype +
" Input");
106 problem_amesos.SetOperator(A);
112 solver_amesos = Factory.Create(solvertype, problem_amesos);
113 assert (solver_amesos != 0);
114 solver_amesos->SetParameters(subsubList);
116 solver_amesos->SymbolicFactorization();
117 solver_amesos->NumericFactorization();
122 #ifdef HAVE_SHYLUCORE_AMESOS2 123 template <
class Matrix,
class Vector>
128 Teuchos::ParameterList subList = pList->sublist(
"Amesos2 Input");
129 string solvertype = Teuchos::getParameter<string>(subList,
"Solver");
130 Teuchos::ParameterList subsubList = subList.sublist(solvertype +
" Input");
131 solver_amesos2 = Amesos2::create<Matrix, Vector>
132 (solvertype, Teuchos::rcp(A,
false) );
133 solver_amesos2->symbolicFactorization().numericFactorization();
140 template <
class Matrix,
class Vector>
143 #ifdef HAVE_SHYLUCORE_AMESOS2 144 return factorAmesos2();
155 string solverpackage = Teuchos::getParameter<string>(*pList,
"Direct Solver Package");
157 if(solverpackage.compare(
"Amesos")==0)
159 returnvalue = factorAmesos();
161 else if(solverpackage.compare(
"Amesos2")==0)
163 #ifdef HAVE_SHYLUCORE_AMESOS2 164 returnvalue = factorAmesos2();
166 cout <<
"Amesos2 is not installed \n";
172 cout <<
"No Direct Solver Package Found";
182 template <
class Matrix,
class Vector>
186 cout <<
"**Error**: Amesos is only supported for Epetra Matrices \n";
194 Teuchos::ParameterList subList = pList->sublist(
"Amesos Input");
195 string solvertype = Teuchos::getParameter<string>(subList,
"Solver");
196 Teuchos::ParameterList subsubList = subList.sublist(solvertype +
" Input");
202 problem_amesos.SetRHS(x);
203 problem_amesos.SetLHS(b);
209 solver_amesos->Solve();
213 template <
class Matrix,
class Vector>
217 #ifdef HAVE_SHYLUCORE_AMESOS2 218 return solveAmesos2(b, x);
228 string solverpackage = Teuchos::getParameter<string>(*pList,
"Direct Solver Package");
230 if(solverpackage.compare(
"Amesos")==0)
232 returnvalue = solveAmesos(b,x);
234 else if(solverpackage.compare(
"Amesos2")==0)
236 #ifdef HAVE_SHYLUCORE_AMESOS2 237 returnvalue = solveAmesos2(b,x);
239 cout <<
"Amesos2 is not installed \n";
245 cout <<
"No Direct Solver Package Found";
249 #ifdef HAVE_SHYLUCORE_AMESOS2 250 template <
class Matrix,
class Vector>
255 Teuchos::ParameterList subList = pList->sublist(
"Amesos2 Input");
256 string solvertype = Teuchos::getParameter<string>(subList,
"Solver");
257 Teuchos::ParameterList subsubList = subList.sublist(solvertype +
" Input");
258 solver_amesos2->solve(x, b);
269 #endif // end header if DirectSolverInterface class templated on Epetra/Tpetra Matrix and Vector.
DirectSolverInterface()
Main constructor of class.
Eperta/Tpetra templated interface for call Amesos and Amesos2.