Note: this is documentation for an old release. View the latest documentation at docs.fenicsproject.org/v0.3.0/v0.9.0/cpp
DOLFINx  0.3.0
DOLFINx C++ interface
SLEPcEigenSolver.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 
18 namespace dolfinx::la
19 {
20 class VectorSpaceBasis;
21 
24 
25 class SLEPcEigenSolver
26 {
27 public:
29  explicit SLEPcEigenSolver(MPI_Comm comm);
30 
32  SLEPcEigenSolver(EPS eps, bool inc_ref_count);
33 
34  // Delete copy constructor
35  SLEPcEigenSolver(const SLEPcEigenSolver&) = delete;
36 
38  SLEPcEigenSolver(SLEPcEigenSolver&& solver);
39 
41  ~SLEPcEigenSolver();
42 
43  // Assignment operator (disabled)
44  SLEPcEigenSolver& operator=(const SLEPcEigenSolver&) = delete;
45 
47  SLEPcEigenSolver& operator=(SLEPcEigenSolver&& solver);
48 
51  void set_operators(const Mat A, const Mat B);
52 
54  void solve();
55 
57  void solve(std::int64_t n);
58 
60  std::complex<PetscReal> get_eigenvalue(int i) const;
61 
63  void get_eigenpair(PetscScalar& lr, PetscScalar& lc, Vec r, Vec c,
64  int i) const;
65 
67  int get_iteration_number() const;
68 
70  std::int64_t get_number_converged() const;
71 
74  void set_options_prefix(std::string options_prefix);
75 
78  std::string get_options_prefix() const;
79 
81  void set_from_options() const;
82 
84  EPS eps() const;
85 
87  MPI_Comm mpi_comm() const;
88 
89 private:
90  // SLEPc solver pointer
91  EPS _eps;
92 };
93 } // namespace dolfinx::la
94 #endif
Linear algebra interface.
Definition: sparsitybuild.h:13