48 #ifdef HAVE_FEI_AMESOS
49 #ifdef HAVE_FEI_EPETRA
67 Solver_Amesos::Solver_Amesos()
70 amesos_factory_(new Amesos()),
72 epetra_linearproblem_(NULL)
78 Solver_Amesos::~Solver_Amesos()
80 delete amesos_solver_;
81 delete amesos_factory_;
82 delete epetra_linearproblem_;
89 if (paramlist_ == NULL) {
93 return( *paramlist_ );
100 int& iterationsTaken,
106 const char** paramStrings = NULL;
107 std::vector<std::string> stdstrings;
111 int err = solve(linearSystem, preconditioningMatrix, numParams, paramStrings,
112 iterationsTaken, status);
120 if (olevel >= 3 || param2 ==
"MATRIX_FILES" || param2 ==
"ALL") {
125 if (!param1.empty()) {
126 osstr << param1 <<
"/";
130 static int counter = 1;
131 osstr <<
"x_Amesos.vec.slv"<<counter++;
136 delete [] paramStrings;
145 const char*
const* solverParams,
146 int& iterationsTaken,
158 Trilinos_Helpers::get_Epetra_pointers(feiA, feix, feib,
161 if (opA == 0 || x == 0 || b == 0) {
163 <<
"fei container-objects."<<
FEI_ENDL;
167 if (epetra_linearproblem_ == NULL) {
172 epetra_linearproblem_->SetLHS(x);
173 epetra_linearproblem_->SetRHS(b);
176 numParams, solverParams);
178 if (amesos_solver_ == 0) {
179 amesos_solver_ = amesos_factory_->Create(param, *epetra_linearproblem_);
181 if (amesos_solver_ == 0) {
182 std::cerr <<
"Solver_Amesos::solve ERROR, couldn't create Amesos solver named "
183 << param <<
", amesos_factory::Create returned NULL." << std::endl;
189 static char amesosklu[] =
"Amesos_Klu";
190 if (amesos_solver_ == 0) {
191 amesos_solver_ = amesos_factory_->Create( amesosklu,
192 *epetra_linearproblem_);
194 if (amesos_solver_ == 0) {
195 std::cerr <<
"Solver_Amesos::solve ERROR, couldn't create Amesos solver named "
196 << amesosklu <<
", it's apparently not supported." << std::endl;
202 amesos_solver_->SetParameters(*paramlist_);
205 amesos_solver_->SymbolicFactorization();
206 amesos_solver_->NumericFactorization();
210 amesos_solver_->Solve();
217 int Solver_Amesos::parseParameters(
int numParams,
218 const char*
const* params)
224 #endif //HAVE_FEI_EPETRA
225 #endif //HAVE_FEI_AMESOS
void strings_to_char_ptrs(std::vector< std::string > &stdstrings, int &numStrings, const char **&charPtrs)
virtual int writeToFile(const char *filename, bool matrixMarketFormat=true)=0
virtual fei::SharedPtr< fei::Matrix > getMatrix()
void SetOperator(Epetra_RowMatrix *A)
void convert_ParameterSet_to_strings(const fei::ParameterSet *paramset, std::vector< std::string > ¶mStrings)
virtual void markState()=0
virtual fei::SharedPtr< fei::Vector > getRHS()
int getStringParamValue(const char *name, std::string ¶mValue) const
void copy_parameterset(const fei::ParameterSet ¶mset, Teuchos::ParameterList ¶mlist)
virtual bool changedSinceMark()=0
std::ostream & console_out()
#define FEI_OSTRINGSTREAM
const char * getParamValue(const char *key, int numParams, const char *const *paramStrings, char separator=' ')
virtual fei::SharedPtr< fei::Vector > getSolutionVector()
int getIntParamValue(const char *name, int ¶mValue) const