53 #ifdef HAVE_FEI_AZTECOO
59 #ifdef HAVE_FEI_AMESOS
63 #ifdef HAVE_FEI_EPETRA
70 use_lpm_epetrabasic_(false),
73 use_feiMatrixLocal_(false),
74 blockEntryMatrix_(false),
75 orderRowsWithLocalColsFirst_(false),
85 const char*
const* paramStrings)
87 std::vector<std::string> stdstrings;
103 bool blkGraph =
false;
104 bool blkMatrix =
false;
111 const fei::Param* param = parameterset.
get(
"Trilinos_Solver");
115 std::string::size_type ii = strval.find(
"Amesos");
116 if (ii != std::string::npos) {
119 ii = strval.find(
"Belos");
120 if (ii != std::string::npos) {
185 bool isSolutionVector,
197 std::vector<int> indices;
198 int err = 0, localSize;
201 localSize = indices.size();
206 indices.resize(localSize*2);
207 err = vecSpace->
getBlkIndices_Owned(localSize, &indices[0], &indices[localSize], localSize);
211 indices.resize(localSize);
216 throw std::runtime_error(
"error in vecSpace->getIndices_Owned");
223 Trilinos_Helpers::create_Epetra_BlockMap(vecSpace) :
224 Trilinos_Helpers::create_Epetra_Map(
comm_, indices);
230 isSolutionVector,
true));
232 catch(std::runtime_error& exc) {
234 << exc.what() <<
"', re-throwing..." <<
FEI_ENDL;
246 tmpvec, isSolutionVector));
259 bool isSolnVector =
false;
260 return(
createVector(vecSpace, isSolnVector, numVectors));
267 bool isSolnVector =
false;
268 return(
createVector(matrixGraph, isSolnVector, numVectors));
273 bool isSolutionVector,
289 std::vector<int> indices;
290 int err = 0, localSize;
294 localSize = indices.size();
298 indices.resize(localSize);
302 throw std::runtime_error(
"error in vecSpace->getIndices_Owned");
306 #ifdef HAVE_FEI_EPETRA
309 Trilinos_Helpers::create_Epetra_BlockMap(vecSpace) :
310 Trilinos_Helpers::create_Epetra_Map(
comm_, indices);
315 localSize, isSolutionVector,
true));
317 catch(std::runtime_error& exc) {
319 << exc.what() <<
"', re-throwing..." <<
FEI_ENDL;
323 fei::console_out() <<
"fei_Factory_Trilinos::createVector ERROR, HAVE_FEI_EPETRA not defined."
328 #ifdef HAVE_FEI_EPETRA
351 #ifdef HAVE_FEI_EPETRA
360 Trilinos_Helpers::create_from_LPM_EpetraBasic(matrixGraph,
376 fei::console_out() <<
"fei_Factory_Trilinos::createMatrix ERROR, HAVE_FEI_EPETRA "
387 std::string::size_type ii_amesos = std::string::npos;
388 std::string::size_type ii_belos = std::string::npos;
391 std::string sname(name);
392 ii_amesos = sname.find(
"Amesos");
393 ii_belos = sname.find(
"Belos");
396 if (
useAmesos_ || ii_amesos != std::string::npos) {
397 #ifdef HAVE_FEI_AMESOS
398 solver.
reset(
new Solver_Amesos);
401 fei::console_out() <<
"fei_Factory_Trilinos::createSolver: ERROR, Amesos not available (not enabled at compile-time?)"<<
FEI_ENDL;
405 if (
useBelos_ || ii_belos != std::string::npos) {
406 #ifdef HAVE_FEI_BELOS
407 solver.
reset(
new Solver_Belos);
410 fei::console_out() <<
"fei_Factory_Trilinos::createSolver: ERROR, Belos not available (not enabled at compile-time?)"<<
FEI_ENDL;
414 #ifdef HAVE_FEI_AZTECOO
415 solver.
reset(
new Solver_AztecOO);
418 fei::console_out() <<
"fei_Factory_Trilinos::createSolver: ERROR, AztecOO not "
430 bool need_to_create_lpm =
false;
433 need_to_create_lpm =
true;
436 if (replace_if_already_created) {
437 need_to_create_lpm =
true;
440 if (need_to_create_lpm) {
441 #ifdef HAVE_FEI_EPETRA
447 fei::console_out() <<
"fei_Factory_Trilinos::create_LinProbMgr ERROR, HAVE_FEI_EPETRA"
void char_ptrs_to_strings(int numStrings, const char *const *charstrings, std::vector< std::string > &stdstrings)
int getBlkIndices_Owned(int lenBlkIndices, int *globalBlkIndices, int *blkSizes, int &numBlkIndices)
ParamType getType() const
Factory_Trilinos(MPI_Comm comm)
virtual int getGlobalNumSlaveConstraints() const =0
bool orderRowsWithLocalColsFirst_
const Param * get(const char *name) const
virtual void parameters(const fei::ParameterSet ¶mset)
virtual ~Factory_Trilinos()
virtual fei::SharedPtr< fei::Reducer > getReducer()=0
int getBoolParamValue(const char *name, bool ¶mValue) const
fei::SharedPtr< fei::Matrix > createMatrix(fei::SharedPtr< fei::MatrixGraph > matrixGraph)
fei::SharedPtr< fei::Solver > createSolver(const char *name=0)
virtual fei::SharedPtr< fei::VectorSpace > getRowSpace()=0
virtual int parameters(int numParams, const char *const *paramStrings)
virtual const Epetra_BlockMap & Map() const =0
virtual fei::SharedPtr< fei::MatrixGraph > createMatrixGraph(fei::SharedPtr< fei::VectorSpace > rowSpace, fei::SharedPtr< fei::VectorSpace > columnSpace, const char *name)
void create_LinProbMgr(bool replace_if_already_created=false)
fei::SharedPtr< fei::Reducer > reducer_
fei::SharedPtr< fei::Vector > createVector(fei::SharedPtr< fei::VectorSpace > vecSpace, int numVectors=1)
int getIndices_Owned(std::vector< int > &globalIndices) const
std::ostream & console_out()
void parse_strings(std::vector< std::string > &stdstrings, const char *separator_string, fei::ParameterSet ¶mset)
fei::SharedPtr< fei::LinearProblemManager > lpm_epetrabasic_
const std::string & getStringValue() const
int getNumBlkIndices_Owned() const
std::vector< int > & getLocalReducedEqns()
virtual void setRowDistribution(const std::vector< int > &ownedGlobalRows)=0
static fei::SharedPtr< fei::Matrix > create_Matrix_Local(fei::SharedPtr< fei::MatrixGraph > matrixGraph, bool blockEntry)
bool use_lpm_epetrabasic_
fei::SharedPtr< fei::MatrixGraph > createMatrixGraph(fei::SharedPtr< fei::VectorSpace > rowSpace, fei::SharedPtr< fei::VectorSpace > colSpace, const char *name)
int getNumIndices_Owned() const
int getIntParamValue(const char *name, int ¶mValue) const