Note: this is documentation for an old release. View the latest documentation at docs.fenicsproject.org/dolfinx/v0.9.0/cpp/doxygen/d1/d9b/slepc_8h_source.html
DOLFINx 0.8.0
DOLFINx C++ interface
Loading...
Searching...
No Matches
slepc.h
1// Copyright (C) 2005-2018 Garth N. Wells
2//
3// This file is part of DOLFINx (https://www.fenicsproject.org)
4//
5// SPDX-License-Identifier: LGPL-3.0-or-later
6
7#pragma once
8
9#ifdef HAS_SLEPC
10
11#include "dolfinx/common/MPI.h"
12#include <memory>
13#include <petscmat.h>
14#include <petscvec.h>
15#include <slepceps.h>
16#include <string>
17
18namespace dolfinx::la
19{
20
24{
25public:
27 explicit SLEPcEigenSolver(MPI_Comm comm);
28
30 SLEPcEigenSolver(EPS eps, bool inc_ref_count);
31
32 // Delete copy constructor
33 SLEPcEigenSolver(const SLEPcEigenSolver&) = delete;
34
37
40
41 // Assignment operator (disabled)
42 SLEPcEigenSolver& operator=(const SLEPcEigenSolver&) = delete;
43
45 SLEPcEigenSolver& operator=(SLEPcEigenSolver&& solver);
46
49 void set_operators(const Mat A, const Mat B);
50
52 void solve();
53
56 void solve(std::int64_t n);
57
59 std::complex<PetscReal> get_eigenvalue(int i) const;
60
62 void get_eigenpair(PetscScalar& lr, PetscScalar& lc, Vec r, Vec c,
63 int i) const;
64
66 int get_iteration_number() const;
67
69 std::int64_t get_number_converged() const;
70
73 void set_options_prefix(std::string options_prefix);
74
77 std::string get_options_prefix() const;
78
80 void set_from_options() const;
81
83 EPS eps() const;
84
86 MPI_Comm comm() const;
87
88private:
89 // SLEPc solver pointer
90 EPS _eps;
91};
92} // namespace dolfinx::la
93#endif
This class provides an eigenvalue solver for PETSc matrices. It is a wrapper for the SLEPc eigenvalue...
Definition slepc.h:24
int get_iteration_number() const
Get the number of iterations used by the solver.
Definition slepc.cpp:191
std::int64_t get_number_converged() const
Get the number of converged eigenvalues.
Definition slepc.cpp:157
std::string get_options_prefix() const
Definition slepc.cpp:173
~SLEPcEigenSolver()
Destructor.
Definition slepc.cpp:43
std::complex< PetscReal > get_eigenvalue(int i) const
Get ith eigenvalue.
Definition slepc.cpp:112
void set_from_options() const
Set options from PETSc options database.
Definition slepc.cpp:183
MPI_Comm comm() const
Return MPI communicator.
Definition slepc.cpp:201
void set_operators(const Mat A, const Mat B)
Definition slepc.cpp:55
void set_options_prefix(std::string options_prefix)
Definition slepc.cpp:165
void solve()
Compute all eigenpairs of the matrix A (solve )
Definition slepc.cpp:61
SLEPcEigenSolver(MPI_Comm comm)
Create eigenvalue solver.
Definition slepc.cpp:21
EPS eps() const
Return SLEPc EPS pointer.
Definition slepc.cpp:199
void get_eigenpair(PetscScalar &lr, PetscScalar &lc, Vec r, Vec c, int i) const
Get ith eigenpair.
Definition slepc.cpp:139
Linear algebra interface.
Definition sparsitybuild.h:15