Bridge++  Ver. 2.0.2
aeigensolver.h
Go to the documentation of this file.
1 
14 #ifndef AEIGENSOLVER_INCLUDED
15 #define AEIGENSOLVER_INCLUDED
16 
17 #include "bridge_defs.h"
19 #include "Parameters/parameters.h"
20 #include "complexTraits.h"
21 #include "lib/IO/bridgeIO.h"
22 using Bridge::vout;
23 
24 #ifdef USE_FACTORY
25 #include "Tools/factory.h"
26 #include "Tools/director.h"
27 #endif
28 
30 
41 template<typename FIELD, typename FOPR>
43 {
44  public:
45  typedef typename FIELD::real_t real_t;
47 
49 
50  virtual ~AEigensolver() {}
51 
52  private:
53  // non-copyable
56 
57  public:
58  virtual void set_parameters(const Parameters&) = 0;
59 
60  virtual void get_parameters(Parameters&) const = 0;
61 
62  virtual void solve(std::vector<real_t>& TDa,
63  std::vector<FIELD>& vk,
64  int& Nsbt, int& Nconv,
65  const FIELD& b)
66  {
67  vout.crucial("AEigensolver: real solve not implemented.\n");
68  exit(EXIT_FAILURE);
69  }
70 
72  virtual void solve(std::vector<complex_t>& TDa,
73  std::vector<FIELD>& vk,
74  int& Nsbt, int& Nconv,
75  const FIELD& b)
76  {
77  vout.crucial("AEigensolver: complex solve not implemented.\n");
78  exit(EXIT_FAILURE);
79  }
80 
81 #ifdef USE_FACTORY
82  public:
83  typedef AEigensolver *(*ProductCreator)(FOPR *);
84  typedef AEigensolver *(*ProductCreator_params)(FOPR *, const Parameters& params);
85 
87  typedef FactoryTemplate<AEigensolver, ProductCreator_params> Factory_fopr_params;
88 
89  static AEigensolver *New(const IdentifierType& subtype, FOPR *fopr)
90  {
91  ProductCreator p = Factory_fopr::Find(subtype);
92  return p ? (*p)(fopr) : 0;
93  }
94 
95  static AEigensolver *New(const IdentifierType& subtype, FOPR *fopr, const Parameters& params)
96  {
97  ProductCreator_params p = Factory_fopr_params::Find(subtype);
98  return p ? (*p)(fopr, params) : 0;
99  }
100 
101 #ifdef USE_FACTORY_AUTOREGISTER
102 #else
103  static bool init_factory();
104 #endif
105 #endif // USE_FACTORY
106 };
107 
108 #endif
AEigensolver::set_parameters
virtual void set_parameters(const Parameters &)=0
bridgeIO.h
factory.h
Parameters
Class for parameters.
Definition: parameters.h:46
director.h
AEigensolver::real_t
FIELD::real_t real_t
Definition: aeigensolver.h:45
AEigensolver::complex_t
ComplexTraits< real_t >::complex_t complex_t
Definition: aeigensolver.h:46
AEigensolver::solve
virtual void solve(std::vector< complex_t > &TDa, std::vector< FIELD > &vk, int &Nsbt, int &Nconv, const FIELD &b)
complex version of solve.
Definition: aeigensolver.h:72
real_t
double real_t
Definition: bridgeQXS_Clover_coarse_double.cpp:16
AEigensolver::solve
virtual void solve(std::vector< real_t > &TDa, std::vector< FIELD > &vk, int &Nsbt, int &Nconv, const FIELD &b)
Definition: aeigensolver.h:62
parameters.h
ComplexTraits
Definition: complexTraits.h:16
FactoryTemplate
Definition: factory.h:42
AEigensolver::~AEigensolver
virtual ~AEigensolver()
Definition: aeigensolver.h:50
AEigensolver::operator=
AEigensolver & operator=(const AEigensolver< FIELD, FOPR > &)
AEigensolver::get_parameters
virtual void get_parameters(Parameters &) const =0
commonParameters.h
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition: bridgeIO.cpp:180
complexTraits.h
bridge_defs.h
AEigensolver::AEigensolver
AEigensolver()
Definition: aeigensolver.h:48
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
IdentifierType
std::string IdentifierType
Definition: factory.h:39
AEigensolver
Eigensolver class for abstract base class of eigen solvers.
Definition: aeigensolver.h:42