本文整理汇总了C++中Lattice::FsiteSize方法的典型用法代码示例。如果您正苦于以下问题:C++ Lattice::FsiteSize方法的具体用法?C++ Lattice::FsiteSize怎么用?C++ Lattice::FsiteSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lattice
的用法示例。
在下文中一共展示了Lattice::FsiteSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Alg
//------------------------------------------------------------------
AlgEig::AlgEig(Lattice& latt,
CommonArg *c_arg,
EigArg *arg) :
Alg(latt, c_arg)
{
cname = "AlgEig";
char *fname = "AlgEig(L&,CommonArg*,EigArg*)";
VRB.Func(cname,fname);
// Initialize the argument pointer
//----------------------------------------------------------------
if(arg == 0)
ERR.Pointer(cname,fname, "arg");
alg_eig_arg = arg;
Ncb = NumChkb(alg_eig_arg->RitzMatOper);
// Set the node size of the full (non-checkerboarded) fermion field
// NOTE: at this point we must know on what lattice size the operator
// will act.
//----------------------------------------------------------------
int f_size = GJP.VolNodeSites() * latt.FsiteSize() * Ncb / 2;
VRB.Flow(cname,fname,"f_size=%d\n",0);
// int f_size = GJP.VolNodeSites() * Ncb / 2;
// exit(1);
//VRB.Flow(cname,fname,"Doing Ritz");
int N_eig = alg_eig_arg->N_eig;
// Allocate memory for the eigenvectors and eigenvalues
//----------------------------------------------------------------
eigenv = (Vector **) smalloc (cname,fname, "eigenv", N_eig * sizeof(Vector *));
for(int n = 0; n < N_eig; ++n)
{
eigenv[n] = (Vector *) smalloc(cname,fname, "eigenv[n]", (f_size)* sizeof(Float));
}
lambda = (Float *) smalloc(cname,fname, "lambda", 2*N_eig * sizeof(Float));
chirality = (Float *) smalloc(cname,fname,"chirality", N_eig * sizeof(Float));
valid_eig = (int *) smalloc(cname,fname,"valid_eig",N_eig * sizeof(int));
// Print out input parameters
//----------------------------------------------------------------
VRB.Input(cname,fname,
"N_eig = %d\n",int(N_eig));
VRB.Input(cname,fname,
"MaxCG = %d\n",alg_eig_arg->MaxCG);
VRB.Input(cname,fname,
"Mass_init = %g\n",IFloat(alg_eig_arg->Mass_init));
VRB.Input(cname,fname,
"Mass_final = %g\n",IFloat(alg_eig_arg->Mass_final));
VRB.Input(cname,fname,
"Mass_step = %g\n",IFloat(alg_eig_arg->Mass_step));
// Calculate n_masses if necessary
VRB.Flow(cname,fname,"alg_eig_arg->pattern_kind=%d\n",alg_eig_arg->pattern_kind);
switch( alg_eig_arg->pattern_kind ) {
case ARRAY:
n_masses = alg_eig_arg->Mass.Mass_len;
break;
case LOG:
n_masses = (int) ((log(alg_eig_arg->Mass_final - alg_eig_arg->Mass_init)
/ log(alg_eig_arg->Mass_step)) + 1.000001);
break;
case LIN:
n_masses = (int) (fabs((alg_eig_arg->Mass_final
- alg_eig_arg->Mass_init)/alg_eig_arg->Mass_step) + 1.000001);
break;
default:
ERR.General(cname, fname,
"alg_eig_arg->pattern_kind = %d is unrecognized\n",
alg_eig_arg->pattern_kind);
break;
}
VRB.FuncEnd(cname,fname);
}
示例2: Alg
CPS_START_NAMESPACE
/*!\file
\brief Methods of the AlgPbp class.
$Id: alg_pbp.C,v 1.14 2012-07-06 20:22:08 chulwoo Exp $
*/
//--------------------------------------------------------------------
// CVS keywords
//
// $Author: chulwoo $
// $Date: 2012-07-06 20:22:08 $
// $Header: /home/chulwoo/CPS/repo/CVS/cps_only/cps_pp/src/alg/alg_pbp/alg_pbp.C,v 1.14 2012-07-06 20:22:08 chulwoo Exp $
// $Id: alg_pbp.C,v 1.14 2012-07-06 20:22:08 chulwoo Exp $
// $Name: not supported by cvs2svn $
// $Locker: $
// $RCSfile: alg_pbp.C,v $
// $Revision: 1.14 $
// $Source: /home/chulwoo/CPS/repo/CVS/cps_only/cps_pp/src/alg/alg_pbp/alg_pbp.C,v $
// $State: Exp $
//
//--------------------------------------------------------------------
//------------------------------------------------------------------
//
// alg_pbp.C
//
// AlgPbp is derived from Alg and is relevant to the
// stochastic measurement of PsiBar Psi using the
// Conjugate Gradient algorithm. The type of fermion is
// determined by the argument to the constructor.
//
// PsiBarPsi is normalized so that for large values of the
// PbpArg.mass PsiBarPsi = 1 / mass for any fermion type.
// This normalization results to the following small mass
// behavior for a trivial background gauge field with periodic
// boundary conditions:
// Staggered = 16 / ( Volume * mass )
// Wilson = 1 / ( Volume * mass )
// Dwf = 1 / ( Volume * mass )
//
//------------------------------------------------------------------
CPS_END_NAMESPACE
#include <util/qcdio.h>
#include <alg/alg_pbp.h>
#include <util/lattice.h>
#include <util/gjp.h>
#include <util/smalloc.h>
#include <util/vector.h>
#include <util/verbose.h>
#include <util/error.h>
CPS_START_NAMESPACE
#define POINT
#undef POINT
#define Z2
#undef Z2
//------------------------------------------------------------------
/*!
\param latt The lattice on which to compute the condensate.
\param c_arg The common argument structure for all algorithms.
\param arg The algorithm parameters.
*/
//------------------------------------------------------------------
AlgPbp::AlgPbp(Lattice& latt,
CommonArg *c_arg,
PbpArg *arg) :
Alg(latt, c_arg)
{
cname = "AlgPbp";
char *fname = "AlgPbp(L&,CommonArg*,PbpArg*)";
VRB.Func(cname,fname);
// Initialize the argument pointer
//----------------------------------------------------------------
if(arg == 0)
ERR.Pointer(cname,fname, "arg");
alg_pbp_arg = arg;
// Set the node size of the full (non-checkerboarded) fermion field
//----------------------------------------------------------------
f_size = GJP.VolNodeSites() * latt.FsiteSize();
// Allocate memory for the source.
//----------------------------------------------------------------
src = (Vector *) smalloc(f_size * sizeof(Float));
if(src == 0)
ERR.Pointer(cname,fname, "src");
VRB.Smalloc(cname,fname, "src", src, f_size * sizeof(Float));
// Allocate memory for the solution
//----------------------------------------------------------------
sol = (Vector *) smalloc(f_size * sizeof(Float));
if(sol == 0)
ERR.Pointer(cname,fname, "sol");
VRB.Smalloc(cname,fname, "sol", sol, f_size * sizeof(Float));
//.........这里部分代码省略.........
示例3: AlgHmd
CPS_START_NAMESPACE
//------------------------------------------------------------------
/*!
\param latt The lattice on which the HMC algorithm runs.
\param c_arg The common argument structure for all algorithms.
\param arg The algorithm parameters.
*/
//------------------------------------------------------------------
AlgHmcQPQ::AlgHmcQPQ(Lattice& latt,
CommonArg *c_arg,
HmdArg *arg) :
AlgHmd(latt, c_arg, arg)
{
int i, j;
cname = "AlgHmcQPQ";
char *fname = "AlgHmcQPQ(L&,CommonArg*,HmdArg*)";
VRB.Func(cname,fname);
int n_masses;
// Initialize the number of dynamical fermion masses
//----------------------------------------------------------------
n_frm_masses = hmd_arg->n_frm_masses;
if(n_frm_masses > MAX_HMD_MASSES) {
ERR.General(cname,fname,
"hmd_arg->n_frm_masses = %d is larger than MAX_HMD_MASSES = %d\n",
n_frm_masses, MAX_HMD_MASSES);
}
// Initialize the number of dynamical boson masses
//----------------------------------------------------------------
n_bsn_masses = hmd_arg->n_bsn_masses;
if(n_bsn_masses > MAX_HMD_MASSES) {
ERR.General(cname,fname,
"hmd_arg->n_bsn_masses = %d is larger than MAX_HMD_MASSES = %d\n",
n_bsn_masses, MAX_HMD_MASSES);
}
// Calculate the fermion field size.
//----------------------------------------------------------------
f_size = GJP.VolNodeSites() * latt.FsiteSize() / (latt.FchkbEvl()+1);
// Allocate memory for the fermion CG arguments.
//----------------------------------------------------------------
if(n_frm_masses != 0) {
frm_cg_arg = (CgArg **) smalloc(n_frm_masses * sizeof(int));
if(frm_cg_arg == 0)
ERR.Pointer(cname,fname, "frm_cg_arg");
VRB.Smalloc(cname,fname,
"frm_cg_arg",frm_cg_arg, n_frm_masses * sizeof(int));
for(i=0; i<n_frm_masses; i++) {
frm_cg_arg[i] = (CgArg *) smalloc(sizeof(CgArg));
if(frm_cg_arg[i] == 0)
ERR.Pointer(cname,fname, "frm_cg_arg[i]");
VRB.Smalloc(cname,fname,
"frm_cg_arg[i]", frm_cg_arg[i], sizeof(CgArg));
}
}
// Initialize the fermion CG arguments
//----------------------------------------------------------------
//??? Complete this
for(i=0; i<n_frm_masses; i++) {
frm_cg_arg[i]->mass = hmd_arg->frm_mass[i];
frm_cg_arg[i]->max_num_iter = hmd_arg->max_num_iter[i];
frm_cg_arg[i]->stop_rsd = hmd_arg->stop_rsd[i];
}
// Allocate memory for the boson CG arguments.
//----------------------------------------------------------------
if(n_bsn_masses != 0) {
bsn_cg_arg = (CgArg **) smalloc(n_bsn_masses * sizeof(int));
if(bsn_cg_arg == 0)
ERR.Pointer(cname,fname, "bsn_cg_arg");
VRB.Smalloc(cname,fname,
"bsn_cg_arg",bsn_cg_arg, n_bsn_masses * sizeof(int));
for(i=0; i<n_bsn_masses; i++) {
bsn_cg_arg[i] = (CgArg *) smalloc(sizeof(CgArg));
if(bsn_cg_arg[i] == 0)
ERR.Pointer(cname,fname, "bsn_cg_arg[i]");
VRB.Smalloc(cname,fname,
"bsn_cg_arg[i]", bsn_cg_arg[i], sizeof(CgArg));
}
}
// Initialize the boson CG arguments
//----------------------------------------------------------------
//??? Complete this
for(i=0; i<n_bsn_masses; i++) {
bsn_cg_arg[i]->mass = hmd_arg->bsn_mass[i];
bsn_cg_arg[i]->max_num_iter = hmd_arg->max_num_iter[i];
bsn_cg_arg[i]->stop_rsd = hmd_arg->stop_rsd[i];
//.........这里部分代码省略.........
示例4: Alg
CPS_START_NAMESPACE
/*!\file
\brief Methods of the AlgDens class.
$Id: alg_dens.C,v 1.8 2008-02-14 20:45:44 chulwoo Exp $
*/
//--------------------------------------------------------------------
// CVS keywords
//
// $Author: chulwoo $
// $Date: 2008-02-14 20:45:44 $
// $Header: /home/chulwoo/CPS/repo/CVS/cps_only/cps_pp/src/alg/alg_dens/alg_dens.C,v 1.8 2008-02-14 20:45:44 chulwoo Exp $
// $Id: alg_dens.C,v 1.8 2008-02-14 20:45:44 chulwoo Exp $
// $Name: not supported by cvs2svn $
// $Locker: $
// $RCSfile: alg_dens.C,v $
// $Revision: 1.8 $
// $Source: /home/chulwoo/CPS/repo/CVS/cps_only/cps_pp/src/alg/alg_dens/alg_dens.C,v $
// $State: Exp $
//
//--------------------------------------------------------------------
//------------------------------------------------------------------
//
// alg_dens.C
//
// AlgDens is derived from Alg and is relevant to the
// stochastic measurement of derivatives of the partition function
// with respect to the chemical potential using the
// Conjugate Gradient algorithm. The type of fermion is
// determined by the argument to the constructor.
//
//------------------------------------------------------------------
CPS_END_NAMESPACE
#include <util/qcdio.h>
#include <alg/alg_dens.h>
#include <util/lattice.h>
#include <util/gjp.h>
#include <util/smalloc.h>
#include <util/vector.h>
#include <util/verbose.h>
#include <util/error.h>
CPS_START_NAMESPACE
#define POINT
#undef POINT
#define Z2
#undef Z2
//------------------------------------------------------------------
/*!
\param latt The lattice on which to compute the condensate.
\param c_arg The common argument structure for all algorithms.
\param arg The algorithm parameters.
*/
//------------------------------------------------------------------
AlgDens::AlgDens(Lattice& latt,
CommonArg *c_arg,
DensArg *arg) :
Alg(latt, c_arg)
{
cname = "AlgDens";
char *fname = "AlgDens(L&,CommonArg*,DensArg*)";
VRB.Func(cname,fname);
// Initialize the argument pointer
//----------------------------------------------------------------
if(arg == 0)
ERR.Pointer(cname,fname, "arg");
alg_dens_arg = arg;
// Set the node size of the full (non-checkerboarded) fermion field
//----------------------------------------------------------------
f_size = GJP.VolNodeSites() * latt.FsiteSize();
// Allocate memory for the source.
//----------------------------------------------------------------
src = (Vector *) smalloc(f_size * sizeof(Float));
if(src == 0)
ERR.Pointer(cname,fname, "src");
VRB.Smalloc(cname,fname, "src", src, f_size * sizeof(Float));
srcM = (Vector *) smalloc(f_size * sizeof(Float));
if(srcM == 0)
ERR.Pointer(cname,fname, "srcM");
VRB.Smalloc(cname,fname, "srcM", srcM, f_size * sizeof(Float));
// Allocate memory for the solutions
//----------------------------------------------------------------
save = (Vector *) smalloc(f_size * (alg_dens_arg->max_save) * sizeof(Float));
if(save == 0)
ERR.Pointer(cname,fname, "save");
VRB.Smalloc(cname,fname, "save", save, f_size * (alg_dens_arg->max_save) * sizeof(Float));
sol = (Vector *) smalloc(f_size * sizeof(Float));
if(sol == 0)
ERR.Pointer(cname,fname, "sol");
VRB.Smalloc(cname,fname, "sol", sol, f_size * sizeof(Float));
//.........这里部分代码省略.........