CHROMA
syssolver_fgmres_dr_params.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Params of CG inverter
3  */
4 #include <string>
6 using namespace std;
7 
8 namespace Chroma
9 {
10 
11  // Read parameters
12  void read(XMLReader& xml, const std::string& path, SysSolverFGMRESDRParams& p)
13  {
14  XMLReader paramtop(xml, path);
15 
16  read(paramtop, "RsdTarget", p.RsdTarget);
17  read(paramtop, "NKrylov", p.NKrylov);
18  read(paramtop, "NDefl", p.NDefl);
19  read(paramtop, "MaxIter", p.MaxIter);
20  p.PrecondParams = readXMLGroup(paramtop, "PrecondParams", "invType");
21 
22  }
23 
24  // Writer parameters
25  void write(XMLWriter& xml, const std::string& path, const SysSolverFGMRESDRParams& p)
26  {
27  push(xml, path);
28  write(xml, "RsdTarget", p.RsdTarget);
29  write(xml, "NKyrlov", p.NKrylov);
30  write(xml, "NDefl", p.NDefl);
31  write(xml, "MaxIter", p.MaxIter);
32  xml << p.PrecondParams.xml;
33  }
34 
35  SysSolverFGMRESDRParams::SysSolverFGMRESDRParams()
36  {
37  RsdTarget = 0;
38  NKrylov = 0;
39  NDefl = 0;
40  MaxIter = 0;
41 
42 
43  // Create a dummy XML
44  XMLBufferWriter xml_buf;
45  push(xml_buf, "root");
46  push(xml_buf, "PrecondParams");
47  write(xml_buf, "invType", "NULL");
48  pop(xml_buf);
49  pop(xml_buf);
50 
51 
52  XMLReader read_back(xml_buf);
53  PrecondParams = readXMLGroup(read_back, "PrecondParams", "invType");
54  }
55 
56  //! Read parameters
57  SysSolverFGMRESDRParams::SysSolverFGMRESDRParams(XMLReader& xml, const std::string& path)
58  {
59  read(xml, path, *this);
60  }
61 
62 }
void write(XMLWriter &xml, const std::string &path, const SysSolverFGMRESDRParams &p)
void read(XMLReader &xml, const std::string &path, SysSolverFGMRESDRParams &p)
GroupXML_t readXMLGroup(XMLReader &xml_in, const std::string &path, const std::string &type_name)
Read group and return as a std::string.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
Definition: gtest.h:745
::std::string string
Definition: gtest.h:1979
Solve an FGMRESR-DR system.
push(xml_out,"Cooled_Topology")
pop(xml_out)