CHROMA
quark_source_sink.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*! @file
4  * @brief Quark source or sink smearing
5  */
6 
7 #ifndef __quark_source_sink_h__
8 #define __quark_source_sink_h__
9 
10 #include "chromabase.h"
11 #include "handle.h"
13 #include "io/xml_group_reader.h"
14 
15 namespace Chroma
16 {
17  //! Base class for quark source and sink smearing
18  /*! @ingroup smear
19  *
20  * Supports creation and application of smearing (with link smearing)
21  * on quarks, and potentially displacements. Basically the construction
22  * of a "source" or "sink" state on a pre-existing quark object
23  */
24  template<typename T>
26  {
27  public:
28  //! Virtual destructor to help with cleanup;
29  virtual ~QuarkSourceSink() {}
30 
31  //! Smear the quark
32  /*!
33  * \param obj Object to source or sink smear ( Modify )
34  */
35  virtual void operator()(T& obj) const = 0;
36 
37 
38  protected:
39  //! Potentially smear the gauge field
40  /*!
41  * \param u Gauge field to smear ( Modify )
42  * \param link_smearing group holding XML of link smearing ( Read )
43  */
44  virtual void create(multi1d<LatticeColorMatrix>& u,
45  const GroupXML_t& link_smearing)
46  {
47  //
48  // Smear the gauge field if needed
49  //
50  std::istringstream xml_l(link_smearing.xml);
51  XMLReader linktop(xml_l);
52  const std::string link_path = "/LinkSmearing";
53 
55  linkSmearing(TheLinkSmearingFactory::Instance().createObject(link_smearing.id,
56  linktop,
57  link_path));
58  (*linkSmearing)(u);
59  }
60 
61 
62  };
63 
64 }
65 
66 
67 #endif
Primary include file for CHROMA library code.
Class for counted reference semantics.
Definition: handle.h:33
Base class for quark source and sink smearing.
virtual ~QuarkSourceSink()
Virtual destructor to help with cleanup;.
virtual void operator()(T &obj) const =0
Smear the quark.
virtual void create(multi1d< LatticeColorMatrix > &u, const GroupXML_t &link_smearing)
Potentially smear the gauge field.
static T & Instance()
Definition: singleton.h:432
Class for counted reference semantics.
Handle< MapObject< int, EVPair< LatticeColorVector > > > obj
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
static multi1d< LatticeColorMatrix > u
LinOpSysSolverMGProtoClover::T T
::std::string string
Definition: gtest.h:1979
Hold group xml and type id.
Read an XML group as a std::string.