Note: this is documentation for an old release. View the latest documentation at docs.fenicsproject.org/v0.1.0/v0.9.0/cpp
DOLFINx  0.1.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
19 {
20 namespace la
21 {
22 class VectorSpaceBasis;
23 
26 
27 class SLEPcEigenSolver
28 {
29 public:
31  explicit SLEPcEigenSolver(MPI_Comm comm);
32 
34  SLEPcEigenSolver(EPS eps, bool inc_ref_count);
35 
36  // Delete copy constructor
37  SLEPcEigenSolver(const SLEPcEigenSolver&) = delete;
38 
40  SLEPcEigenSolver(SLEPcEigenSolver&& solver);
41 
43  ~SLEPcEigenSolver();
44 
45  // Assignment operator (disabled)
46  SLEPcEigenSolver& operator=(const SLEPcEigenSolver&) = delete;
47 
49  SLEPcEigenSolver& operator=(SLEPcEigenSolver&& solver);
50 
53  void set_operators(const Mat A, const Mat B);
54 
56  void solve();
57 
59  void solve(std::int64_t n);
60 
62  std::complex<PetscReal> get_eigenvalue(int i) const;
63 
65  void get_eigenpair(PetscScalar& lr, PetscScalar& lc, Vec r, Vec c,
66  int i) const;
67 
69  int get_iteration_number() const;
70 
72  std::int64_t get_number_converged() const;
73 
76  void set_options_prefix(std::string options_prefix);
77 
80  std::string get_options_prefix() const;
81 
83  void set_from_options() const;
84 
86  EPS eps() const;
87 
89  MPI_Comm mpi_comm() const;
90 
91 private:
92  // SLEPc solver pointer
93  EPS _eps;
94 };
95 } // namespace la
96 } // namespace dolfinx
97 #endif