当前位置: 首页>>代码示例>>C++>>正文


C++ Lattice::FixGaugePtr方法代码示例

本文整理汇总了C++中Lattice::FixGaugePtr方法的典型用法代码示例。如果您正苦于以下问题:C++ Lattice::FixGaugePtr方法的具体用法?C++ Lattice::FixGaugePtr怎么用?C++ Lattice::FixGaugePtr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Lattice的用法示例。


在下文中一共展示了Lattice::FixGaugePtr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: rotate_gauge_explicit

//-----------------------------------------------------------------------
// Rotate gauge of the lattice (from Min)
//-----------------------------------------------------------------------
void rotate_gauge_explicit(Lattice &lat,int dir)
{

  const char *cname="none";
  const char *fname="rotate_gauge_explicit";
  VRB.Func(cname,fname);

  if ((dir<0)||(dir>3)){
    VRB.Result(cname,fname,"Error:: direction should be 0,1,2,3\n");
    return;
  }

  int NX(GJP.XnodeSites());
  int NY(GJP.YnodeSites());
  int NZ(GJP.ZnodeSites());
  int NT(GJP.TnodeSites());


  //---------------------------------------------------------------
  // Set up the gauge fixing and other required conditions
  //---------------------------------------------------------------

  int num_nodes[4]
    = { GJP.Xnodes(), GJP.Ynodes(), GJP.Znodes(), GJP.Tnodes() } ;
  
  int node_sites[4]
    = { GJP.XnodeSites(), GJP.YnodeSites(), GJP.ZnodeSites(), GJP.TnodeSites() } ;
  
  int Size[4];
  for (int i=0; i<4; i++){
    Size[i] = num_nodes[i]*node_sites[i];
  }
  
  int *plns;
  plns = (int*) smalloc(Size[dir]*sizeof(int));
  
  for (int i=0; i<Size[dir]; i++){
    plns[i] = i;
  }
  
  int npln = Size[dir];
  
  FixGaugeType normdir;
  
  if (dir==3) normdir = FIX_GAUGE_COULOMB_T;
  else if (dir==0) normdir = FIX_GAUGE_COULOMB_X;
  else if (dir==1) normdir = FIX_GAUGE_COULOMB_Y;
  else normdir = FIX_GAUGE_COULOMB_Z;
      

  //----------------------------------------------------------------------
  //initialize the parameters need to gauge fixing ---------------------
  //----------------------------------------------------------------------
  Matrix *L;
  Matrix **Gp;
  int ii;
  
  int volume = NX*NY*NZ*NT;
  
  L = (Matrix*) smalloc(4*volume*sizeof(Matrix));
  Gp = (Matrix**) smalloc(npln*sizeof(Matrix*));
  
  for(ii=0; ii<npln; ii++)
    Gp[ii] = (Matrix*) smalloc(volume/node_sites[dir] * sizeof(Matrix));
  
  
  //-----------------------------------------------------------------------------
  //GAUGE FIXING MATRICES
  //-----------------------------------------------------------------------------

  for (int slice=0; slice<node_sites[dir]; slice++)
    for(int cnt=0; cnt<volume/node_sites[dir]; cnt++)
      Gp[slice][cnt]=lat.FixGaugePtr()[slice][cnt];
  
  //-------------------------------------------------------------------------------
  //-------------------------------------------------------------------------------
  // TRY TO Transform the Lattice to the Coulomb Gauge and store it ---------------
  //-------------------------------------------------------------------------------

  int tt,xx,yy,zz,temp_ind;
  int slice_ind[3];
  
  //slice_ind[3] stores the 3 directions on the 'dir' slice with indices increasing 
  temp_ind = 0;
  for (int i=0; i<4; i++){
    if (i!=dir) {
      slice_ind[temp_ind] = i;
      temp_ind++;
    }
  }
  
  VRB.Result(cname,fname,"dir == %d \n",dir);
  VRB.Result(cname,fname,"slice index == %d %d %d\n",slice_ind[0],slice_ind[1],slice_ind[2]);
  
  // the dummy node_sites for each dummy dirction
  int NN[4];
  NN[0] = node_sites[slice_ind[0]];
//.........这里部分代码省略.........
开发者ID:DeanHowarth,项目名称:QUDA-CPS,代码行数:101,代码来源:main.C

示例2: gaugeFixSink

//----------------------------------------------------------------------------
// Coulomb gauge fix fermion solution vector in hyperplanes of direction dir.
// Gauge fixing matrices must exist before this routine is used.
// --- Meifeng Lin 01/31/06
//---------------------------------------------------------------------------- 
void FermionVector::gaugeFixSink(Lattice &lat, int dir) const
{
  char *fname = "gaugeFixSink()";
  VRB.Func(d_class_name, fname);
  
  Matrix **gm = lat.FixGaugePtr();
  //-------------------------------------------------------
  //If gauge fixing matrices do not exist, 
  //nothing has to be done.
  //-------------------------------------------------------
  if(gm==0){
    ERR.General(d_class_name,fname,"No gauge fixing matrices were found\n");
    return;
  }
  else{
    printf("Gauge Fixing Sink...\n");

  }

  IFloat *fv = d_fermion_p;

  int error = 0;
  switch(dir){
  case 0:
    if ( lat.FixGaugeKind() != FIX_GAUGE_COULOMB_X )
      error = 1;break;
  case 1:
    if ( lat.FixGaugeKind() != FIX_GAUGE_COULOMB_Y )
      error = 1;break;
  case 2:
    if ( lat.FixGaugeKind() != FIX_GAUGE_COULOMB_Z )
      error = 1;break;
  case 3:
    if ( lat.FixGaugeKind() != FIX_GAUGE_COULOMB_T )
      error = 1;break;
  }
  if (error)
    ERR.General(d_class_name,fname,"Mismatch gauge fixing kind\n");

  int lcl[LORENTZs];
  
  //-------------------------------------------------------------------------
  // Indices for all the directions
  // Here use "t" to indicate the propagation direction, but not necessarily 
  // the generic t direction. Other 3 directions are arbitrarily labelled x,y,z
  //-------------------------------------------------------------------------
  int t = dir;
  int z = (dir + 1) % LORENTZs;
  int y = (dir + 2) % LORENTZs;
  int x = (dir + 3) % LORENTZs;
  
  Vector tmp_vec;
  
  for (lcl[t]=0; lcl[t] < lcl_sites[t]; lcl[t]++) {
    
    Matrix *pM = gm[lcl[t]];
    
    if(pM != NULL ){
      for (lcl[z]  = 0; lcl[z] < lcl_sites[z]; lcl[z]++)
	for (lcl[y] = 0; lcl[y] < lcl_sites[y]; lcl[y]++)
	  for (lcl[x] = 0; lcl[x] < lcl_sites[x]; lcl[x]++)
	    {
	      // the matrix offset
	      int j =  siteOffset(lcl,dir);
	      for (int spin = 0; spin < DIRACs; spin++)
		{
		  // the vector offset
		  int i= 2 * COLORs * ( spin + 4 * siteOffset(lcl));
		  tmp_vec.CopyVec((Vector*)&fv[i], 6);
		  uDotXEqual((IFloat*)&fv[i],(const IFloat*)&pM[j],
			     (const IFloat*)&tmp_vec);
		}
	    }
    }
    else{
         ERR.General(d_class_name,fname,"Not gauge fixing matrices were found at slice = %d\n",lcl[t]); 
         Float *null_p = 0;
         *null_p = 1.;
    }
  }


}
开发者ID:DeanHowarth,项目名称:QUDA-CPS,代码行数:88,代码来源:w_ferm_vec.C


注:本文中的Lattice::FixGaugePtr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。