本文整理汇总了C++中Lattice::SumReTrPlaq方法的典型用法代码示例。如果您正苦于以下问题:C++ Lattice::SumReTrPlaq方法的具体用法?C++ Lattice::SumReTrPlaq怎么用?C++ Lattice::SumReTrPlaq使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lattice
的用法示例。
在下文中一共展示了Lattice::SumReTrPlaq方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: write
CPS_START_NAMESPACE
#define PROFILE
void WriteLatticeParallel::write(Lattice & lat, const QioArg & wt_arg)
{
const char * fname = "write()";
VRB.Func(cname,fname);
char loginfo[100];
sprintf(loginfo,"Unload %s",wt_arg.FileName);
startLogging(loginfo);
#ifdef PROFILE
struct timeval start,end;
gettimeofday(&start,NULL);
#endif
//sync();
// init
int error = 0;
io_good = false;
// const char * filename = wt_arg.FileName;
recon_row_3 = wt_arg.ReconRow3;
FP_FORMAT dataFormat = wt_arg.FileFpFormat;
fpconv.setFileFormat(dataFormat);
if(fpconv.fileFormat == FP_UNKNOWN) {
ERR.General(cname,fname,"Output Floating Point format UNKNOWN\n");
}
// calc Plaq and LinkTrace
const int size_matrices(wt_arg.VolNodeSites()*4);
Matrix * lpoint = lat.GaugeField();
VRB.Flow(cname,fname, "Writing Gauge Field at Lattice::GaugeField() = %p\n", lpoint);
Float plaq = lat.SumReTrPlaq()/(18*wt_arg.VolSites()) ;
Float ltrace(0.0);
if(wt_arg.Scoor() == 0) {
for(int i=0;i<size_matrices;i++){
ltrace += (lpoint+i)->ReTr();
}
ltrace = globalSumFloat(ltrace) / (4*3*wt_arg.VolSites());
}
else
globalSumFloat(0.0); // everyone has to participate in global ops
log();
// write lattice data, in Parallel or Serial manner
// determined by the template parameter "IoStyle" of this class
int data_per_site = recon_row_3 ? 4*12 : 4*18;
const int chars_per_site = data_per_site * fpconv.fileFpSize();
unsigned int csum = 0;
#if TARGET != QCDOC // when not on QCDOC(like on LINUX), use serial IO mode
setSerial();
#endif
fstream output;
if (isRoot()){
output.open(wt_arg.FileName,ios::out);
output.close();
}
Float temp=0.;
glb_sum(&temp);
//sync();
if(parIO()) {
// all open file, start writing
output.open(wt_arg.FileName);
if(!output.good()) {
ERR.General(cname,fname, "Could not open file: [%s] for output.\n",wt_arg.FileName);
// VRB.Flow(cname,fname,"USER: maybe you should kill the process\n");
printf("Node %d:Could not open file: [%s] for output.\n",UniqueID(),wt_arg.FileName);
error = 1;
}
}
else {
// only node 0 open file, start writing
if(isRoot()) {
FILE *fp = Fopen(wt_arg.FileName,"w");
Fclose(fp);
output.open(wt_arg.FileName);
if(!output.good()) {
// VRB.Flow(cname,fname, "Could not open file: [%s] for output.\n",wt_arg.FileName);
// VRB.Flow(cname,fname,"USER: maybe you should kill the process\n");
error = 1;
}
}
}
if (error)
printf("Node %d: says opening %s failed\n",UniqueID(),wt_arg.FileName);
// if(synchronize(error) > 0)
// ERR.FileW(cname,fname,wt_arg.FileName);
error=0;
// write header
if(isRoot()){
//.........这里部分代码省略.........