99 EPSConvergedReason reason;
110 #ifdef __PARALLEL_MODE 113 MPI_Comm comm = PETSC_COMM_SELF;
115 ierr = EPSCreate(comm, &
eps);
126 ierr = EPSSetProblemType(
eps, EPS_GHEP);
128 ierr = EPSGetST(
eps, & st);
130 ierr = STSetType(st, STSINVERT);
132 ierr = STSetMatStructure(st, SAME_NONZERO_PATTERN);
134 ierr = EPSSetTolerances(
eps, ( PetscReal ) rtol, PETSC_DECIDE);
136 ierr = EPSSetDimensions(
eps, ( PetscInt ) nroot, PETSC_DECIDE, PETSC_DECIDE);
138 ierr = EPSSetWhichEigenpairs(
eps, EPS_SMALLEST_MAGNITUDE);
145 ierr = EPSSetFromOptions(
eps);
152 ierr = EPSSolve(
eps);
155 ierr = EPSGetConvergedReason(
eps, & reason);
157 ierr = EPSGetIterationNumber(
eps, & nite);
159 OOFEM_LOG_INFO(
"SLEPcSolver::solve EPSConvergedReason: %d, number of iterations: %d\n", reason, nite);
161 ierr = EPSGetConverged(
eps, & nconv);
165 OOFEM_LOG_INFO(
"SLEPcSolver :: solveYourselfAt: Convergence reached for RTOL=%20.15f", rtol);
169 ierr = MatGetVecs(*
B->
giveMtrx(), PETSC_NULL, & Vr);
174 for (
int i = 0; i < nconv && i < nroot; i++ ) {
175 ierr = EPSGetEigenpair(
eps, nconv - i - 1, & kr, PETSC_NULL, Vr, PETSC_NULL);
179 _eigv.
at(i + 1) = kr;
183 for (
int j = 0; j < size; j++ ) {
184 _r.
at(j + 1, i + 1) = Vr_loc.
at(j + 1);
188 ierr = VecDestroy(& Vr);
bool epsInit
Flag if context initialized.
#define NM_Success
Numerical method exited with success.
EPS eps
Eigenvalue solver context.
Base class for all matrices stored in sparse format.
int giveDomainIndex() const
SLEPcSolver(Domain *d, EngngModel *m)
double & at(int i)
Coefficient access function.
unsigned long NM_Status
Mask defining NumMetod Status; which can be asked after finishing computation by Numerical Method...
REGISTER_GeneralizedEigenValueSolver(InverseIteration, GES_InverseIt)
int giveNumberOfRows() const
Returns number of rows of receiver.
#define OOFEM_LOG_INFO(...)
virtual ParallelContext * giveParallelContext(int n)
Returns the parallel context corresponding to given domain (n) and unknown type Default implementatio...
double at(int i, int j) const
Coefficient access function.
MPI_Comm giveParallelComm()
Returns the communication object of reciever.
virtual NM_Status solve(SparseMtrx &a, SparseMtrx &b, FloatArray &v, FloatMatrix &x, double rtol, int nroot)
Solves the given sparse generalized eigen value system of equations .
Initializes the variable VERBOSE, in order to get a few intermediate messages on screen: beginning an...
Class representing vector of real numbers.
Implementation of matrix containing floating point numbers.
void resize(int rows, int cols)
Checks size of receiver towards requested bounds.
Class implementing single timer, providing wall clock and user time capabilities. ...
int giveNumberOfColumns() const
Returns number of columns of receiver.
Abstract base class representing the "problem" under consideration.
the oofem namespace is to define a context or scope in which all oofem names are defined.
int scatterG2L(Vec src, FloatArray &dest) const
Scatters global vector to natural one.
This base class is an abstraction for all numerical methods solving sparse linear system of equations...
EngngModel * engngModel
Pointer to engineering model.
This class provides an sparse matrix interface to PETSc Matrices.
double getUtime()
Returns total user time elapsed in seconds.
void resize(int s)
Resizes receiver towards requested size.