QNANO
SLEPc_Solver.h
1 #ifndef QNANO_NEW_SLEPC_SOLVER_DEFINED_H_
2 #define QNANO_NEW_SLEPC_SOLVER_DEFINED_H_
3 
4 
5 #include <sys/time.h>
6 #include <slepceps.h>
7 #include "MPI/MPI_Communicator.h"
8 #include "MPI/Distribute_Block_MPI.h"
9 #include "tools/Sparse_Matrix_Generator.h"
10 #include "tools/Abstract_Solver.h"
11 
13 public:
14 
15  Sparse_Matrix_Generator *sparse_generator;
16 
17  Mat A;
18  EPS eps;
19  PetscInt DIM;
21  int mlocal, mstart;
22 
23  int MPI_rank, MPI_size;
24  struct timeval timestart, timeend;
25  bool was_set_up;
26 
27 
28  PetscErrorCode solve_ierr();
29  virtual void solve();
30 
31 
32  PetscErrorCode assemble_SetValue();
33  PetscErrorCode set_A_size_from_generator();
34  PetscErrorCode set_A_from_generator();
35 
36  PetscErrorCode destroy();
37  PetscErrorCode setup_ierr();
38  virtual void setup();
39  virtual bool should_print()const{
40  return MPI_rank==0;
41  }
42  virtual Distribute_Block_Local* new_Distribute_Block_Local(size_t totalsize)const{
43  return new Distribute_Block_MPI(MPI_COMM_WORLD,totalsize);
44  }
45  virtual Communicator* new_Communicator()const{
46  return new MPI_Communicator();
47  }
48 
49 
50 // virtual size_t get_local_EV_start()const;
51 // virtual size_t get_local_EV_blocksize()const;
52  virtual double get_eigenvalue(size_t i);
53  virtual void get_EV_local_part(size_t i, std::complex<double> *ptr);
54 // virtual std::complex<double> get_local_EV_coeff(size_t i, size_t j)const;
55 
56 
57 
59  : sparse_generator(sparse_gen), DIM(0), was_set_up(false){
60  }
61  ~SLEPc_Solver(){
62  if(was_set_up) destroy();
63  }
64 
65 };
66 
67 #endif
Definition: Abstract_Solver.h:8
Definition: Communicator.h:19
Definition: Distribute_Block_MPI.h:8
Definition: SLEPc_Solver.h:12
Definition: Sparse_Matrix_Generator.h:22
Definition: Distribute_Block_Local.h:15
Definition: MPI_Communicator.h:8
virtual Distribute_Block_Local * new_Distribute_Block_Local(size_t totalsize) const
Allocate new structure to parallelize data of size &#39;totalsize&#39;. May be a sequential Distrubute_Block_...
Definition: SLEPc_Solver.h:42