Skip to content
Snippets Groups Projects
Commit 0fd98e81 authored by Van Dung Nguyen's avatar Van Dung Nguyen
Browse files

eigenSolver add constructor passed by linearSystem

parent b23be431
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@ eigenSolver::eigenSolver(dofManager<double> *manager, std::string A,
{
if(A.size()){
_A = dynamic_cast<linearSystemPETSc<double>*>(manager->getLinearSystem(A));
if(!_A) Msg::Error("Could not find PETSc system '%s'", A.c_str());
if(!_A) Msg::Error("Could not find PETSc system '%s' ffffd", A.c_str());
}
if(B.size()){
_B = dynamic_cast<linearSystemPETSc<double>*>(manager->getLinearSystem(B));
......@@ -24,6 +24,8 @@ eigenSolver::eigenSolver(dofManager<double> *manager, std::string A,
}
}
eigenSolver::eigenSolver(linearSystemPETSc<double> *A,linearSystemPETSc<double> *B, bool hermitian) : _A(A), _B(B), _hermitian(hermitian){}
bool eigenSolver::solve(int numEigenValues, std::string which)
{
if(!_A) return false;
......@@ -53,8 +55,8 @@ bool eigenSolver::solve(int numEigenValues, std::string which)
// set some default options
_try(EPSSetDimensions(eps, numEigenValues, PETSC_DECIDE, PETSC_DECIDE));
_try(EPSSetTolerances(eps, 1.e-7, 20));//1.e-6 50
//_try(EPSSetType(eps, EPSKRYLOVSCHUR)); //default
//_try(EPSSetTolerances(eps, 1.e-7, 20));//1.e-6 50
_try(EPSSetType(eps, EPSKRYLOVSCHUR)); //default
_try(EPSSetType(eps, EPSARNOLDI));
//_try(EPSSetType(eps, EPSARPACK));
//_try(EPSSetType(eps, EPSPOWER));
......
......@@ -26,7 +26,8 @@ class eigenSolver{
void _try(int ierr) const { CHKERRABORT(PETSC_COMM_WORLD, ierr); }
public:
eigenSolver(dofManager<double> *manager, std::string A,
std::string B="", bool hermitian=false);
std::string B="", bool hermitian=true);
eigenSolver(linearSystemPETSc<double> *A,linearSystemPETSc<double>* B = NULL, bool hermitian=false);
bool solve(int numEigenValues=0, std::string which="");
int getNumEigenValues(){ return _eigenValues.size(); }
std::complex<double> getEigenValue(int num){ return _eigenValues[num]; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment