28 #include <lifev/core/algorithm/EigenSolver.hpp> 30 #ifdef HAVE_TRILINOS_ANASAZI 35 #include <Teuchos_RefCountPtrDecl.hpp> 36 #include <Teuchos_RCPBoostSharedPtrConversions.hpp> 45 EigenSolver::EigenSolver (std::shared_ptr<solver_Type>
const matrix, Epetra_BlockMap
const& block_map,
long unsigned int numvec) :
46 M_eigenVectors (
new Epetra_MultiVector (block_map, numvec) ),
47 MyProblem (
new Anasazi::BasicEigenproblem<data_Type, vector_Type, solver_Type> (Teuchos::rcp (matrix), M_eigenVectors) ),
59 EigenSolver::setDataFromGetPot (GetPot
const& data ,
const std::string& section)
61 int block_size = data ( (section +
"block_size").c_str(), 1);
62 int max_blocks = data ( (section +
"max_blocks").c_str(), 20);
63 int max_restarts = data ( (section +
"max_restarts").c_str(), 50);
64 double tol = data ( (section +
"tol").c_str(), 1e-8);
65 std::string which = data ( (section +
"which").c_str(),
"ML");
66 int nev = data ( (section +
"neval").c_str(), 10);
67 bool verbose = data ( (section +
"verbose").c_str(),
true);
70 int verbosity = Anasazi::Errors + Anasazi::Warnings;
73 verbosity += Anasazi::FinalSummary + Anasazi::TimingDetails;
75 #ifdef HAVE_LIFEV_DEBUG 76 bool debug = data ( (section +
"debug").c_str(),
true);
80 verbosity += Anasazi::Debug;
87 MyPL.set (
"Verbosity", verbosity );
88 MyPL.set (
"Block Size", block_size );
89 MyPL.set (
"Max Blocks", max_blocks );
90 MyPL.set (
"Max Restarts", max_restarts );
91 MyPL.set (
"Tol", tol );
95 MyProblem->setNEV (nev);
101 ::eigenvalues (std::vector<data_Type>& realPart, std::vector<data_Type>& imgPart)
103 Anasazi::Eigensolution<data_Type, vector_Type> sol = MyProblem->getSolution();
104 std::vector<Anasazi::Value<data_Type> > evals = sol.Evals;
105 for (UInt i = 0; i < evals.size(); ++i)
107 realPart.push_back (evals[i].realpart);
108 imgPart.push_back (evals[i].imagpart);
116 bool out = MyProblem->setProblem();
117 std::cout <<
"problem set: " << out << std::endl;
118 MySolver.reset (
new eigensolver_Type (MyProblem, MyPL) );
119 return MySolver->solve();