CHROMA
szin_read_obj_funcmap.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Read object function std::map
3  */
4 
5 #include "named_obj.h"
8 #include "io/szin_io.h"
9 #include "io/readszin.h"
10 #include "io/readszinqprop_w.h"
11 
12 namespace Chroma
13 {
14 
15  //! IO function std::map environment
16  /*! \ingroup inlineio */
17  namespace SZINReadObjCallMapEnv
18  {
19  // Anonymous namespace
20  namespace
21  {
22  //! Read a propagator
23  void SZINReadLatProp(const std::string& buffer_id,
24  const std::string& file)
25  {
26  LatticePropagator obj;
27  XMLReader record_xml;
28 
29  readSzinQprop(record_xml, obj, file);
30 
31  XMLBufferWriter file_xml;
32  push(file_xml, "SZIN");
33  pop(file_xml);
34 
35  TheNamedObjMap::Instance().create<LatticePropagator>(buffer_id);
36  TheNamedObjMap::Instance().getData<LatticePropagator>(buffer_id) = obj;
37  TheNamedObjMap::Instance().get(buffer_id).setFileXML(file_xml);
38  TheNamedObjMap::Instance().get(buffer_id).setRecordXML(record_xml);
39  }
40 
41  //! Read a gauge field in floating precision
42  void SZINReadArrayLatColMat(const std::string& buffer_id,
43  const std::string& file)
44  {
45  XMLReader record_xml;
46  multi1d<LatticeColorMatrix> obj(Nd);
47 
48  readSzin(record_xml, obj, file);
49 
50  XMLBufferWriter file_xml;
51  push(file_xml, "SZIN");
52  pop(file_xml);
53 
54  TheNamedObjMap::Instance().create< multi1d<LatticeColorMatrix> >(buffer_id);
55  TheNamedObjMap::Instance().getData< multi1d<LatticeColorMatrix> >(buffer_id) = obj;
56  TheNamedObjMap::Instance().get(buffer_id).setFileXML(file_xml);
57  TheNamedObjMap::Instance().get(buffer_id).setRecordXML(record_xml);
58  }
59 
60  //! Local registration flag
61  bool registered = false;
62 
63  } // end anonymous namespace
64 
65 
66  //! Register all the factories
67  bool registerAll()
68  {
69  bool success = true;
70  if (! registered)
71  {
72  success &= TheSZINReadObjFuncMap::Instance().registerFunction(std::string("LatticePropagator"),
73  SZINReadLatProp);
74  success &= TheSZINReadObjFuncMap::Instance().registerFunction(std::string("Multi1dLatticeColorMatrix"),
75  SZINReadArrayLatColMat);
76  registered = true;
77  }
78  return success;
79  }
80  }
81 
82 }
static T & Instance()
Definition: singleton.h:432
void readSzinQprop(XMLReader &xml, LatticePropagator &q, const std::string &file)
Read a SZIN propagator file. This is a simple memory dump reader.
void readSzin(SzinGauge_t &header, multi1d< LatticeColorMatrix > &u, const std::string &cfg_file)
Read a SZIN configuration file.
Definition: readszin.cc:31
Handle< MapObject< int, EVPair< LatticeColorVector > > > obj
Nd
Definition: meslate.cc:74
Named object support.
Named object function std::map.
static bool registered
Local registration flag.
bool registerAll()
Register all the factories.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
push(xml_out,"Condensates")
pop(xml_out)
::std::string string
Definition: gtest.h:1979
Read in a configuration written by SZIN up to configuration version 7.
Read a SZIN propagator.
Routines associated with SZIN gauge field IO.
Read object function std::map.