00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef ABS_INTEGRATOR_H
00011 #define ABS_INTEGRATOR_H
00012
00013 #include "chromabase.h"
00014 #include "update/molecdyn/field_state.h"
00015 #include "update/molecdyn/hamiltonian/abs_hamiltonian.h"
00016 #include "io/xmllog_io.h"
00017
00018
00019 namespace Chroma
00020 {
00021
00022
00023
00024 template<typename P, typename Q>
00025 class AbsComponentIntegrator {
00026 public:
00027
00028 virtual ~AbsComponentIntegrator(void) {}
00029
00030
00031 virtual void operator()(AbsFieldState<P,Q>& s,
00032 const Real& traj_length) const = 0;
00033
00034
00035 virtual void refreshFields(AbsFieldState<multi1d<LatticeColorMatrix>,
00036 multi1d<LatticeColorMatrix> >& s) const = 0;
00037
00038
00039 virtual void resetPredictors(void) const = 0;
00040 };
00041
00042
00043
00044 template<typename P, typename Q>
00045 class AbsRecursiveIntegrator : public AbsComponentIntegrator<P,Q> {
00046 public:
00047
00048 virtual ~AbsRecursiveIntegrator(void) {}
00049
00050
00051 virtual void operator()(AbsFieldState<P,Q>& s,
00052 const Real& traj_length) const = 0;
00053
00054
00055
00056 virtual AbsComponentIntegrator<P,Q>& getSubIntegrator() const = 0;
00057
00058
00059 virtual void refreshFields(AbsFieldState<multi1d<LatticeColorMatrix>,
00060 multi1d<LatticeColorMatrix> >& s) const {
00061 refreshFieldsThisLevel(s);
00062 getSubIntegrator().refreshFields(s);
00063 }
00064
00065
00066 virtual void resetPredictors(void) const {
00067 resetPredictorsThisLevel();
00068 getSubIntegrator().resetPredictors();
00069 }
00070
00071 protected:
00072
00073 virtual void refreshFieldsThisLevel(AbsFieldState<multi1d<LatticeColorMatrix>,
00074 multi1d<LatticeColorMatrix> >& s) const = 0;
00075
00076 virtual void resetPredictorsThisLevel(void) const = 0;
00077 };
00078
00079
00080
00081
00082 template<typename P, typename Q>
00083 class AbsMDIntegrator {
00084 public:
00085
00086
00087 virtual ~AbsMDIntegrator(void) {}
00088
00089
00090 virtual void operator()(AbsFieldState<P,Q>&s, const Real& trajLength) const {
00091
00092
00093 AbsComponentIntegrator<P,Q>& theIntegrator = getIntegrator();
00094
00095
00096
00097 QDPIO::cout << "MD: Resetting Chrono Predictors at start of trajectory" << endl;
00098 theIntegrator.resetPredictors();
00099
00100
00101 theIntegrator(s, trajLength);
00102 }
00103
00104
00105 virtual void refreshFields(AbsFieldState<P,Q>&s ) const {
00106 getIntegrator().refreshFields(s);
00107 }
00108
00109
00110 virtual Real getTrajLength(void) const = 0;
00111
00112
00113
00114
00115
00116 virtual void copyFields(void) const = 0;
00117 private:
00118
00119
00120 virtual AbsComponentIntegrator<P,Q>& getIntegrator() const = 0;
00121
00122 };
00123
00124
00125 }
00126
00127 #endif