Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
source.h
Go to the documentation of this file.
1 
14 #ifndef SOURCE_INCLUDED
15 #define SOURCE_INCLUDED
16 
17 #include "Parameters/parameters.h"
18 #include "Field/field.h"
19 
20 #include "IO/bridgeIO.h"
21 
22 #ifdef USE_FACTORY
23 #include "Tools/factory.h"
24 #endif
25 
27 
37 class Source
38 {
39  protected:
41 
42  public:
44  : m_vl(CommonParameters::Vlevel()) {}
45 
46  virtual ~Source() {}
47 
48  private:
49  // non-copyable
50  Source(const Source&);
51  Source& operator=(const Source&);
52 
53  public:
54  virtual void set_parameters(const Parameters&) = 0;
55 
57 
58  virtual void set(Field&, const int) = 0;
59  virtual void set(Field&, const int, const int) = 0;
60  virtual void set_all_color(Field&, const int) = 0;
61  virtual void set_all_color_spin(Field&) = 0;
62 
63 #ifdef USE_FACTORY
64  public:
65  typedef Source *(*ProductCreator)();
67 
68  static Source *New(const IdentifierType& subtype)
69  {
70  ProductCreator p = Factory::Find(subtype);
71 
72  return p ? (*p)() : 0;
73  }
74 
75 #ifdef USE_FACTORY_AUTOREGISTER
76 #else
77  static bool init_factory();
78 #endif
79 #endif
80 };
81 #endif /* SOURCE_INCLUDED */
Container of Field-type object.
Definition: field.h:45
virtual void set_all_color_spin(Field &)=0
Class for parameters.
Definition: parameters.h:46
void set_parameter_verboselevel(const Bridge::VerboseLevel vl)
Definition: source.h:56
virtual ~Source()
Definition: source.h:46
Common parameter class: provides parameters as singleton.
Bridge::VerboseLevel vl
VerboseLevel
Definition: bridgeIO.h:42
Source()
Definition: source.h:43
Bridge::VerboseLevel m_vl
Definition: source.h:40
std::string IdentifierType
Factory template class.
Definition: factory.h:39
Base class of source for a linear solver.
Definition: source.h:37
Source & operator=(const Source &)
virtual void set_all_color(Field &, const int)=0
virtual void set_parameters(const Parameters &)=0
virtual void set(Field &, const int)=0