1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +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

@ -88,66 +88,7 @@ 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>
class HybridMonteCarlo {
private:

View File

@ -30,10 +30,10 @@ directory
#ifndef HMC_PLAQUETTE_H
#define HMC_PLAQUETTE_H
namespace Grid{
namespace QCD{
namespace Grid {
namespace QCD {
// this is only defined for a gauge theory
// this is only defined for a gauge theory
template <class Impl>
class PlaquetteLogger : public HmcObservable<typename Impl::Field> {
private:
@ -43,8 +43,8 @@ class PlaquetteLogger : public HmcObservable<typename Impl::Field> {
// 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; };
typedef typename Impl::Field Field; // necessary for HmcObservable compatibility
explicit PlaquetteLogger(std::string cf) { Stem = cf; }
void TrajectoryComplete(int traj,
Field &U,
@ -80,9 +80,8 @@ class PlaquetteLogger : public HmcObservable<typename Impl::Field> {
<< " " << peri_plaq << " " << peri_rect << std::endl;
}
};
//////////////////////////////////////////////////////////////
} // namespace QCD
} // namespace Grid
#endif //HMC_PLAQUETTE_H
#endif // HMC_PLAQUETTE_H