1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-14 01:35:36 +00:00

Small cleanup of the observables

This commit is contained in:
Guido Cossu 2017-03-17 11:42:55 +09:00
parent b640230b1e
commit 6d1e9e5f92
2 changed files with 7 additions and 67 deletions

View File

@ -89,65 +89,6 @@ struct HMCparameters: Serializable {
}; };
/*
// Move this to a different file
template <class Field>
class HmcObservable {
public:
virtual void TrajectoryComplete(int traj, Field &U, GridSerialRNG &sRNG,
GridParallelRNG &pRNG) = 0;
};
// this is only defined for a gauge theory
template <class Impl>
class PlaquetteLogger : public HmcObservable<typename Impl::Field> {
private:
std::string Stem;
public:
// here forces the Impl to be of gauge fields
// if not the compiler will complain
INHERIT_GIMPL_TYPES(Impl);
typedef typename Impl::Field Field; // necessary for HmcObservable compatibility
PlaquetteLogger(std::string cf) { Stem = cf; };
void TrajectoryComplete(int traj,
Field &U,
GridSerialRNG &sRNG,
GridParallelRNG &pRNG) {
std::string file;
{
std::ostringstream os;
os << Stem << "." << traj;
file = os.str();
}
std::ofstream of(file);
RealD peri_plaq = WilsonLoops<PeriodicGimplR>::avgPlaquette(U);
RealD peri_rect = WilsonLoops<PeriodicGimplR>::avgRectangle(U);
RealD impl_plaq = WilsonLoops<Impl>::avgPlaquette(U);
RealD impl_rect = WilsonLoops<Impl>::avgRectangle(U);
// Fixme reorganise this output
of << traj << " " << impl_plaq << " " << impl_rect << " " << peri_plaq
<< " " << peri_rect << std::endl;
std::cout << GridLogMessage << "traj"
<< " "
<< "plaq "
<< " "
<< " rect "
<< " "
<< "peri_plaq"
<< " "
<< "peri_rect" << std::endl;
std::cout << GridLogMessage << traj << " " << impl_plaq << " " << impl_rect
<< " " << peri_plaq << " " << peri_rect << std::endl;
}
};
//////////////////////////////////////////////////////////////
*/
template <class IntegratorType> template <class IntegratorType>
class HybridMonteCarlo { class HybridMonteCarlo {
private: private:

View File

@ -30,10 +30,10 @@ directory
#ifndef HMC_PLAQUETTE_H #ifndef HMC_PLAQUETTE_H
#define HMC_PLAQUETTE_H #define HMC_PLAQUETTE_H
namespace Grid{ namespace Grid {
namespace QCD{ namespace QCD {
// this is only defined for a gauge theory // this is only defined for a gauge theory
template <class Impl> template <class Impl>
class PlaquetteLogger : public HmcObservable<typename Impl::Field> { class PlaquetteLogger : public HmcObservable<typename Impl::Field> {
private: private:
@ -43,8 +43,8 @@ class PlaquetteLogger : public HmcObservable<typename Impl::Field> {
// here forces the Impl to be of gauge fields // here forces the Impl to be of gauge fields
// if not the compiler will complain // if not the compiler will complain
INHERIT_GIMPL_TYPES(Impl); INHERIT_GIMPL_TYPES(Impl);
typedef typename Impl::Field Field; // necessary for HmcObservable compatibility typedef typename Impl::Field Field; // necessary for HmcObservable compatibility
PlaquetteLogger(std::string cf) { Stem = cf; }; explicit PlaquetteLogger(std::string cf) { Stem = cf; }
void TrajectoryComplete(int traj, void TrajectoryComplete(int traj,
Field &U, Field &U,
@ -80,9 +80,8 @@ class PlaquetteLogger : public HmcObservable<typename Impl::Field> {
<< " " << peri_plaq << " " << peri_rect << std::endl; << " " << peri_plaq << " " << peri_rect << std::endl;
} }
}; };
//////////////////////////////////////////////////////////////
} // namespace QCD } // namespace QCD
} // namespace Grid } // namespace Grid
#endif //HMC_PLAQUETTE_H #endif // HMC_PLAQUETTE_H