CHROMA
dilution_quark_source_const_w.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Dilution scheme inferred from pre-generated solutions.
4  *
5  * This dilution scheme takes pre-generated LatticeFermion solutions built
6  * in the chain of MAKE_SOURCE and PROPAGATOR inline measurement calls
7  */
8 
9 #ifndef __dilution_quark_source_const_h__
10 #define __dilution_quark_source_const_h__
11 
12 #include "chromabase.h"
15 #include "io/qprop_io.h"
16 #include "io/param_io.h"
17 
18 namespace Chroma
19 {
20  /*! \ingroup inlinehadron */
21  namespace DilutionQuarkSourceConstEnv
22  {
23  extern const std::string name;
24  bool registerAll();
25 
26  //! Parameter structure
27  /*! \ingroup inlinehadron */
28  struct Params
29  {
30  Params();
31  Params(XMLReader& xml_in, const std::string& path);
32  void writeXML(XMLWriter& xml_out, const std::string& path) const;
33 
34  struct QuarkFiles_t
35  {
37  {
38  multi1d<std::string> dilution_files; /*!< dilution files per timeslice*/
39  };
40 
41  multi1d<TimeSliceFiles_t> timeslice_files; /*!< full time dilution is assumed*/
42  };
43 
44  QuarkFiles_t quark_files; /*!< All the solutions for a single quark */
45 
47 
48  }; // struct Params
49 
50  //! Structure holding a source and its solutions
52  {
53  struct TimeSlices_t
54  {
55  struct Dilutions_t
56  {
57  std::string soln_file; //Solution filename for this dilution
60  };
61 
62  int t0; //time slice on which this diluted source
63  //has support. Full time dilution is assumed
64 
65  multi1d<Dilutions_t> dilutions;
66  };
67 
68  multi1d<TimeSlices_t> time_slices;
69 
70  int decay_dir;
71  Seed seed;
72  };
73 
74 
75 
76  //! Dilution scheme constructed by propagator solutions over diluted MAKE_SOURCE calls
77  class ConstDilutionScheme : public DilutionScheme<LatticeFermion>
78  {
79  public:
80 
81  //! Virtual destructor to help with cleanup;
83 
84  //! Default constructor
86  {
87  params = p;
88  init();
89  }
90 
91  //! The decay direction
92  int getDecayDir() const {return quark.decay_dir;}
93 
94  //! The seed identifies this quark
95  const Seed& getSeed() const {return quark.seed;}
96 
97  //! The actual t0 corresponding to this time dilution element
98  int getT0( int t0 ) const {return quark.time_slices[t0].t0;}
99 
100  //! The number of dilutions per timeslice fo timeslice t0
101  int getDilSize( int t0 ) const {return quark.time_slices[t0].dilutions.size();}
102 
103  //! The number of dilution timeslices included
104  int getNumTimeSlices() const {return quark.time_slices.size();}
105 
106  //! The kappa parameter in the wilson action
107  Real getKappa() const
108  {
109  Real kappa;
110  //Assume the kappa is the same for all dilutions
111  std::istringstream xml_k(quark.time_slices[0].dilutions[0].prop_header.fermact.xml);
112 
113  XMLReader proptop(xml_k);
114  if ( toBool(proptop.count("/FermionAction/Kappa") != 0) )
115  {
116  read(proptop, "/FermionAction/Kappa", kappa);
117  }
118  else
119  {
120  Real mass;
121  read(proptop, "/FermionAction/Mass", mass);
123  }
124 
125  return kappa;
126  }
127 
128  //! The info from the cfg on which the inversions were performed
130  {
131  return cfgInfo;
132  }
133 
134  //! returns the prop header for a given dilution
135  std::string getPropHeader(int t0, int dil) const
136  {
137  return quark.time_slices[t0].dilutions[dil].prop_header.fermact.xml;
138  }
139 
140  //! returns the source header for a given dilution
141  std::string getSourceHeader(int t0, int dil) const
142  {
143  return quark.time_slices[t0].dilutions[dil].source_header.source.xml;
144  }
145 
146  //! Return the diluted source std::vector
147  LatticeFermion dilutedSource(int t0, int dil) const;
148 
149  //! Return the solution std::vector corresponding to the diluted source
150  LatticeFermion dilutedSolution(int t0, int dil) const;
151 
152  protected:
153  //! Initialize the object
154  void init();
155 
156  //! Hide partial constructor
158 
159  private:
163  };
164 
165  } // namespace DilutionQuarkSourceConstEnv
166 
167 
168  //! Reader
169  /*! @ingroup hadron */
170  void read(XMLReader& xml, const std::string& path, DilutionQuarkSourceConstEnv::Params& param);
171 
172  //! Writer
173  /*! @ingroup hadron */
174  void write(XMLWriter& xml, const std::string& path, const DilutionQuarkSourceConstEnv::Params& param);
175 
176 } // namespace Chroma
177 
178 #endif
Abstract inline measurements.
Primary include file for CHROMA library code.
Dilution scheme constructed by propagator solutions over diluted MAKE_SOURCE calls.
std::string getPropHeader(int t0, int dil) const
returns the prop header for a given dilution
std::string getSourceHeader(int t0, int dil) const
returns the source header for a given dilution
int getDilSize(int t0) const
The number of dilutions per timeslice fo timeslice t0.
int getNumTimeSlices() const
The number of dilution timeslices included
Real getKappa() const
The kappa parameter in the wilson action.
int getT0(int t0) const
The actual t0 corresponding to this time dilution element.
~ConstDilutionScheme()
Virtual destructor to help with cleanup;.
LatticeFermion dilutedSolution(int t0, int dil) const
Return the solution std::vector corresponding to the diluted source.
std::string getCfgInfo() const
The info from the cfg on which the inversions were performed.
const Seed & getSeed() const
The seed identifies this quark.
LatticeFermion dilutedSource(int t0, int dil) const
Return the diluted source std::vector.
Abstract dilution scheme.
Dilution Schemes.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams &param)
Read parameters.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
Real massToKappa(const Real &Mass)
Convert a Kappa to a mass.
Definition: param_io.cc:31
void read(XMLReader &xml, const std::string &path, DilutionQuarkSourceConstEnv::Params::QuarkFiles_t::TimeSliceFiles_t &input)
bool registerAll()
Register all the factories.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
Double mass
Definition: pbg5p_w.cc:54
::std::string string
Definition: gtest.h:1979
int kappa
Definition: pade_trln_w.cc:112
Various parameter structs and reader/writers.
Routines associated with Chroma propagator IO.
Propagator parameters.
Definition: qprop_io.h:75
void writeXML(XMLWriter &xml_out, const std::string &path) const
Propagator source construction parameters.
Definition: qprop_io.h:27