本文整理汇总了C++中Site::LoopsOverNode方法的典型用法代码示例。如果您正苦于以下问题:C++ Site::LoopsOverNode方法的具体用法?C++ Site::LoopsOverNode怎么用?C++ Site::LoopsOverNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Site
的用法示例。
在下文中一共展示了Site::LoopsOverNode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calcmom
void AlgFourierProp::calcmom(const FourMom& p)
{
char *fname="calcmom(const FourMom&)";
VRB.Func(cname,fname);
Float p1( p.x() + 0.5*bc[0] );
Float p2( p.y() + 0.5*bc[1] );
Float p3( p.z() + 0.5*bc[2] );
Float p4( p.t() + 0.5*bc[3] );
const Float PI(3.141592654);
p1 *= 2.0*PI/(GJP.XnodeSites()*GJP.Xnodes());
p2 *= 2.0*PI/(GJP.YnodeSites()*GJP.Ynodes());
p3 *= 2.0*PI/(GJP.ZnodeSites()*GJP.Znodes());
p4 *= 2.0*PI/(GJP.TnodeSites()*GJP.Tnodes());
Site site;
while ( site.LoopsOverNode() )
{
const Float px( site.physX()*p1 );
const Float py( site.physY()*p2 );
const Float pz( site.physZ()*p3 );
const Float pt( site.physT()*p4 );
const Float pdotx( px + py + pz + pt );
Rcomplex fact( cos(pdotx), -sin(pdotx) );
//--------------------------------------------
// Using AddMult is logically equivalent to
// momprop += fact * (*prop)[i]; ,
// but cuts down on the number of loops over
// the data. The time taken is reduced by
// a factor of two.
//--------------------------------------------
momprop.AddMult(fact,(*prop)[site.Index()]);
}
}
示例2: run
void AlgTcharge::run()
{
Lattice& lattice( AlgLattice() );
Float tmat[nfunc][nfunc];
for (int f1(0);f1<nfunc;f1++)
for (int f2(0);f2<nfunc;f2++)
tmat[f1][f2] = 0;
// sum over lattice
Site nloop;
while ( nloop.LoopsOverNode() )
{
// Array of imaginary parts of the plaquettes
// at a given site
// plaqs[0] = F_01
// plaqs[1] = F_02
// plaqs[2] = F_03
// plaqs[3] = F_12
// plaqs[4] = F_13
// plaqs[5] = F_23
Matrix plaqs[nfunc][6];
//
// fill plaqs with the full plaquettes
// - then zero the real parts
//
int mu;
int nu;
int index(0);
for (mu=0;mu<3;++mu)
{
for (nu=mu+1;nu<4;nu++)
{
for (int f(0);f<nfunc;f++)
{
(*(leaf_map[f]))( lattice, plaqs[f][index], nloop.pos(), mu, nu );
ZeroReal(plaqs[f][index]);
}
index++;
}
}
for (int f1(0);f1<nfunc;f1++)
{
for (int f2(f1);f2<nfunc;f2++)
{
tmat[f1][f2] += MkTop(plaqs[f1],plaqs[f2]).real();
}
}
}
// global sum the approximations
for (int f1(0);f1<nfunc;f1++)
{
for (int f2(f1);f2<nfunc;f2++)
{
glb_sum( &tmat[f1][f2] );
}
}
// Print out results
//----------------------------------------------------------------
if(common_arg->filename != 0)
{
char *fname = "alg_tcharge()";
FILE *fp;
if( (fp = Fopen(common_arg->filename, "a")) == NULL ) {
ERR.FileA(cname,fname,common_arg->filename);
}
Fprintf(fp,"AlgTcharge:\n");
Fprintf(fp,"nleaf : %i\n",nfunc);
for (int f(0);f<nfunc;f++)
Fprintf(fp," %i : %s\n",f,names[f]);
for (int f1(0);f1<nfunc;f1++)
{
for (int f2(f1);f2<nfunc;f2++)
{
Fprintf(fp,"%i %i : %15e\n",f1,f2,tmat[f1][f2]);
}
}
Fclose(fp);
}
}