CHROMA
syssolver_qphix_clover_params.cc
Go to the documentation of this file.
2 #include "chromabase.h"
3 #include "io/xml_group_reader.h"
4 #include "chroma_config.h"
5 
6 
7 
8 using namespace QDP;
9 
10 namespace Chroma {
11 
12  namespace QPhiXSolverTypeEnv {
13 
14  bool registerAll(void)
15  {
16  bool success;
17  success = theQPhiXSolverTypeMap::Instance().registerPair(std::string("CG"),
18  CG);
19 
20  success &=theQPhiXSolverTypeMap::Instance().registerPair(std::string("BICGSTAB" ),
21  BICGSTAB);
22 
23  return success;
24  }
25 
26  const std::string typeIDString = "QPhiXSolverType";
28  };
29 
30  using namespace QPhiXSolverTypeEnv;
31  //! Read an WaveType enum
32  void read(XMLReader& xml_in, const std::string& path, QPhiXSolverType& t) {
33  theQPhiXSolverTypeMap::Instance().read(typeIDString, xml_in, path,t);
34  }
35 
36  //! Write an WaveType enum
37  void write(XMLWriter& xml_out, const std::string& path, const QPhiXSolverType& t) {
38  theQPhiXSolverTypeMap::Instance().write(typeIDString, xml_out, path, t);
39  }
40 
41 
42 
43  SysSolverQPhiXCloverParams::SysSolverQPhiXCloverParams(XMLReader& xml,
44  const std::string& path)
45  {
46  XMLReader paramtop(xml, path);
47 
48  read(paramtop, "MaxIter", MaxIter);
49  read(paramtop, "RsdTarget", RsdTarget);
50  read(paramtop, "CloverParams", CloverParams);
51  read(paramtop, "SolverType", SolverType);
52  read(paramtop, "AntiPeriodicT", AntiPeriodicT);
53 
54  if ( paramtop.count("Verbose") > 0 ) {
55  read(paramtop, "Verbose", VerboseP);
56  }
57  else {
58  VerboseP = false;
59  }
60 
61  if (paramtop.count("Delta") > 0 ) {
62  read(paramtop,"Delta", Delta);
63  }
64  else {
65  Delta = Real(-1);
66  }
67 
68  if( paramtop.count("RsdToleranceFactor") > 0 ) {
69  read(paramtop, "RsdToleranceFactor", RsdToleranceFactor);
70  }
71  else {
72  RsdToleranceFactor = Real(10); // Tolerate an order of magnitude difference by default.
73  }
74 
75  }
76 
77  void read(XMLReader& xml, const std::string& path,
79  {
81  p = tmp;
82  }
83 
84  void write(XMLWriter& xml, const std::string& path,
86  push(xml, path);
87  write(xml, "MaxIter", p.MaxIter);
88 
89  // Hack. Write delta only if it is greater than 0.
90  // -ve sign indicates user did not supply
91  if( toBool(p.Delta > 0 ) ) {
92  write(xml, "Delta", p.Delta);
93  }
94 
95  write(xml, "RsdTarget", p.RsdTarget);
96  write(xml, "Verbose", p.VerboseP);
97  write(xml, "CloverParams", p.CloverParams);
98  write(xml, "SolverType", p.SolverType);
99  write(xml, "AntiPeriodicT", p.AntiPeriodicT);
100  write(xml, "RsdToleranceFactor", p.RsdToleranceFactor);
101 
102 
103  }
104 
105 
106 
107 }
Primary include file for CHROMA library code.
Double tmp
Definition: meslate.cc:60
int t
Definition: meslate.cc:37
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
void read(XMLReader &xml, const std::string &path, SysSolverQPhiXCloverParams &p)
void write(XMLWriter &xml, const std::string &path, const SysSolverQPhiXCloverParams &p)
::std::string string
Definition: gtest.h:1979
push(xml_out,"Cooled_Topology")
Read an XML group as a std::string.