1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-18 15:57:05 +01:00

Fixed seg fault for observable modules

This commit is contained in:
Guido Cossu
2017-03-17 13:59:31 +09:00
parent 6d1e9e5f92
commit 91886068fe
26 changed files with 121 additions and 234 deletions

View File

@ -2,7 +2,7 @@
Grid physics library, www.github.com/paboyle/Grid
Source file: ./lib/qcd/modules/Registration.h
Source file: ./lib/qcd/modules/plaquette.h
Copyright (C) 2017
@ -43,41 +43,25 @@ 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
explicit PlaquetteLogger(std::string cf) { Stem = cf; }
// necessary for HmcObservable compatibility
typedef typename Impl::Field Field;
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 plaq = WilsonLoops<Impl>::avgPlaquette(U);
RealD impl_plaq = WilsonLoops<Impl>::avgPlaquette(U);
RealD impl_rect = WilsonLoops<Impl>::avgRectangle(U);
int def_prec = std::cout.precision();
std::cout << GridLogMessage
<< std::setprecision(std::numeric_limits<Real>::digits10 + 1)
<< "Plaquette: [ " << traj << " ] "<< plaq << std::endl;
std::cout.precision(def_prec);
// 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;
}
};