CHROMA
hadron_contract.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Construct hadron contractions
3  */
4 
7 
8 #include <typeinfo> // For std::bad-cast
9 
10 namespace Chroma
11 {
12 
13  // Get source location
14  // Default version
15  multi1d<int>
16  HadronContract::getTSrce(const multi1d<ForwardProp_t>& forward_headers) const
17  {
18  multi1d<int> t_srce = forward_headers[0].source_header.getTSrce();
19  //int j_decay = forward_headers[0].source_header.j_decay;
20 
21  for(int loop=1; loop < forward_headers.size(); ++loop)
22  {
23  multi1d<int> t_srce_b = forward_headers[loop].source_header.getTSrce();
24 
25  if (t_srce != t_srce_b)
26  {
27  QDPIO::cerr << __func__ << ": the t_srce in the forward props are not all equal"
28  << std::endl;
29  QDP_abort(1);
30  }
31  }
32 
33  return t_srce;
34  }
35 
36 
37  // Get source location
38  // Default version
39  int
40  HadronContract::getDecayDir(const multi1d<ForwardProp_t>& forward_headers) const
41  {
42  int j_decay = forward_headers[0].source_header.j_decay;
43 
44  for(int loop=1; loop < forward_headers.size(); ++loop)
45  {
46  int j_decay_b = forward_headers[loop].source_header.j_decay;
47 
48  if (j_decay != j_decay_b)
49  {
50  QDPIO::cerr << __func__ << ": the decay_dir in the forward props are not all equal"
51  << std::endl;
52  QDP_abort(1);
53  }
54  }
55 
56  return j_decay;
57  }
58 
59 
60  //
61  // Extract quark prop headers
62  // Default version
63  //
66  {
67  ForwardProp_t header;
68 
69  try
70  {
71 // No snarfing
72 // ret.prop = TheNamedObjMap::Instance().getData<T>(prop_id);
73 
74  // Snarf the source info. This is will throw if the source_id is not there
75  XMLReader prop_file_xml, prop_record_xml;
76  TheNamedObjMap::Instance().get(prop_id).getFileXML(prop_file_xml);
77  TheNamedObjMap::Instance().get(prop_id).getRecordXML(prop_record_xml);
78 
79  // Try to invert this record XML into a ChromaProp struct
80  read(prop_record_xml, "/SinkSmear", header);
81  }
82  catch( std::bad_cast )
83  {
84  QDPIO::cerr << __func__ << ": caught dynamic cast error"
85  << std::endl;
86  QDP_abort(1);
87  }
88  catch (const std::string& e)
89  {
90  QDPIO::cerr << __func__ << ": caught error = " << e
91  << std::endl;
92  QDP_abort(1);
93  }
94 
95  return header;
96  }
97 
98 
99 } // end namespace Chroma
virtual multi1d< int > getTSrce(const multi1d< ForwardProp_t > &forward_headers) const
Convenience function to get t_srce from headers.
virtual ForwardProp_t readForwardPropHeader(const std::string &prop_id) const
Convenience function to read propagator.
virtual int getDecayDir(const multi1d< ForwardProp_t > &forward_headers) const
Convenience function to get decay_dir from headers.
static T & Instance()
Definition: singleton.h:432
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams &param)
Read parameters.
Construct hadron correlators.
multi1d< int > t_srce
int j_decay
Definition: meslate.cc:22
Named object function std::map.
multi1d< ForwardProp_t > & forward_headers
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
::std::string string
Definition: gtest.h:1979
Mega structure holding a full forward sink-smeared prop.
Definition: qprop_io.h:120