24 #include "libmesh/petsc_vector.h" 25 #include "libmesh/enum_eigen_solver_type.h" 39 PetscErrorCode ierr=0;
43 ierr = EPSGetEigenvalue(eps(), i, &re, &im);
45 CHKERRABORT(this->comm().
get(), ierr);
47 return std::make_pair(re, im);
55 libMesh::NumericVector<Real> &eig_vec,
56 libMesh::NumericVector<Real> *eig_vec_im) {
60 #ifdef LIBMESH_USE_COMPLEX_NUMBERS 61 libmesh_assert(eig_vec_im == NULL);
63 if (this->eigen_problem_type() == libMesh::HEP ||
64 this->eigen_problem_type() == libMesh::GHEP)
65 libmesh_assert(eig_vec_im == NULL);
68 PetscErrorCode ierr=0;
73 libMesh::PetscVector<Real>
74 *v_re = libMesh::cast_ptr<libMesh::PetscVector<Real>*>(&eig_vec),
83 eig_vec_im = libMesh::libmesh_cast_ptr<libMesh::PetscVector<Real>*>(eig_vec_im);
87 ierr = EPSGetEigenpair(eps(), i, &kr, &ki, v_re->vec(), v_im->vec());
90 ierr = EPSGetEigenpair(eps(), i, &kr, &ki, v_re->vec(), PETSC_NULL);
92 CHKERRABORT(this->comm().
get(), ierr);
94 #ifdef LIBMESH_USE_COMPLEX_NUMBERS 95 re = PetscRealPart(kr);
96 im = PetscImaginaryPart(kr);
102 return std::make_pair(re, im);
virtual std::pair< Real, Real > get_eigenpair(unsigned int i, libMesh::NumericVector< Real > &eig_vec, libMesh::NumericVector< Real > *eig_vec_im=libmesh_nullptr)
This function returns the real and imaginary part of the ith eigenvalue and copies the respective eig...
This class inherits from libMesh::SlepcEigenSolver<Real> and implements a method for retriving the re...
virtual std::pair< Real, Real > get_eigenvalue(unsigned int i)
This function returns the real and imaginary part of the ith eigenvalues.
SlepcEigenSolver(const libMesh::Parallel::Communicator &comm_in)