Example #1
0
CPS_START_NAMESPACE

//------------------------------------------------------------------
// Initialize static variables.
//------------------------------------------------------------------

//------------------------------------------------------------------
// Constructor
//------------------------------------------------------------------
Fwilson::Fwilson()
: FwilsonTypes()
{
  cname = "Fwilson";
  char *fname = "Fwilson()";
  VRB.Func(cname,fname);

  //----------------------------------------------------------------
  // Check if anisotropy is present and exit since Fwilson has
  // not been tested for anisotropic lattices.
  //----------------------------------------------------------------
  if(GJP.XiBare() != 1 ||
     GJP.XiV()    != 1 ||
     GJP.XiVXi()  != 1   ){
    ERR.General(cname,fname,
    "XiBare=%g, XiV=%g, XiVXi=%g : Fwilson has not been tested with anisotropy\n",
                GJP.XiBare(), GJP.XiV(), GJP.XiVXi());
  }

  //----------------------------------------------------------------
  // Do initializations before the wilson library can be used
  // Initialization involve memory allocation.
  //----------------------------------------------------------------

  //  static Wilson wilson_struct;
  //  f_dirac_op_init_ptr = &wilson_struct;
  //  wilson_init((Wilson *) f_dirac_op_init_ptr);

  static Wilson wilson_struct;
  f_dirac_op_init_ptr = &wilson_struct;
  wilson_init((Wilson*) f_dirac_op_init_ptr);
}
Example #2
0
CPS_START_NAMESPACE
//--------------------------------------------------------------------
//  CVS keywords
//
//  $Author: chulwoo $
//  $Date: 2013-04-05 17:51:13 $
//  $Header: /home/chulwoo/CPS/repo/CVS/cps_only/cps_pp/src/util/dirac_op/d_op_clover/qcdoc/clover.C,v 1.8 2013-04-05 17:51:13 chulwoo Exp $
//  $Id: clover.C,v 1.8 2013-04-05 17:51:13 chulwoo Exp $
//  $Name: not supported by cvs2svn $
//  $Locker:  $
//  $RCSfile: clover.C,v $
//  $Revision: 1.8 $
//  $Source: /home/chulwoo/CPS/repo/CVS/cps_only/cps_pp/src/util/dirac_op/d_op_clover/qcdoc/clover.C,v $
//  $State: Exp $
//
//--------------------------------------------------------------------

CPS_END_NAMESPACE
#include<util/clover.h>
CPS_START_NAMESPACE

//---------------------------------------------------------------------------
// clover.C:
//         implement struct Clover.
//          
// WARNING:                                                                 
//                                                                          
// This set of routines will work only if the node sublattices have         
// even number of sites in each direction.                                  
//---------------------------------------------------------------------------

CPS_END_NAMESPACE
#include<util/gjp.h>
#include<util/smalloc.h>
#include<util/error.h>
#include<util/verbose.h>
CPS_START_NAMESPACE


//----------------------------------------------------------------------
// external variable definition for clover_mat_mlt_asm.asm
//----------------------------------------------------------------------
CPS_END_NAMESPACE
//#include<comms/nga_reg.h>
CPS_START_NAMESPACE
//extern const unsigned int clover_cram_scratch_addr = CRAM_SCRATCH_ADDR;


//---------------------------------------------------------------------------
// clover_init()  
//---------------------------------------------------------------------------
// Purpose:
//  performs all initializations needed before clover funcs     
//  are called. It sets the addressing related arrays and reserves memory 
//  for the needed temporary buffers. It only needs to be called           
//  once at the begining of the program (or after a clover_end call)       
//  before any number of calls to clover funcs are made.
//---------------------------------------------------------------------------
void clover_init(Clover *clover_p)  
{
  char *cname = "";
  char *fname = "clover_init";  
  VRB.Func(cname,fname);

  // set the local lattice size
  //------------------------------------------------------------------------- 
  clover_p->nsites[0] = GJP.XnodeSites();
  clover_p->nsites[1] = GJP.YnodeSites();
  clover_p->nsites[2] = GJP.ZnodeSites();
  clover_p->nsites[3] = GJP.TnodeSites();
 

  // Do initializations before the wilson library can be used      
  // Initialization involve memory allocation.                       
  //-------------------------------------------------------------------------
  static Wilson wilson_struct;
  clover_p->wilson_p = &wilson_struct;
  wilson_init(clover_p->wilson_p);

  // allocate temporary buffers to be used by DiracOpClover::MatPcDagMatPc
  // and etc.
  //-------------------------------------------------------------------------
  int f_size = SPINOR_SIZE * GJP.VolNodeSites() * sizeof(IFloat);  
  clover_p->frm_buf0 = (IFloat *)smalloc(f_size);
  clover_p->frm_buf1 = clover_p->frm_buf0 + f_size / (2 * sizeof(IFloat));
  bzero((char *)clover_p->frm_buf0,f_size);

  if (clover_p->frm_buf0 == 0 || clover_p->frm_buf1 == 0)
    ERR.Pointer(cname,fname, "frm_buf");
  VRB.Smalloc(cname,fname, "frm_buf", clover_p->frm_buf0, f_size);

  // Set the clover coefficient                                      
  //-------------------------------------------------------------------------
  clover_p->clover_coef = GJP.CloverCoeff();
}
Example #3
0
CPS_START_NAMESPACE
//--------------------------------------------------------------------
//  CVS keywords
//
//  $Source: /home/chulwoo/CPS/repo/CVS/cps_only/cps_pp/src/util/dirac_op/d_op_dwf/noarch/dwf_init.C,v $
//  $State: Exp $
//
//--------------------------------------------------------------------
//------------------------------------------------------------------
// 11/26/97
//
// dwf_int:
//
// This routine performs all initializations needed before dwf
// func are called. It sets the addressing related arrays and
// reserves memory for the needed temporary buffers. It only needs
// to be called once at the begining of the program (or after a
// dwf_end call) before any number of calls to dwf funcs are made.
//
// WARNING:
//
// This set of routines will work only if the node sublattices have
// even number of sites in each direction.
//
//------------------------------------------------------------------

CPS_END_NAMESPACE
#include<util/dwf.h>
#include<util/gjp.h>
#include<util/smalloc.h>
#include<util/verbose.h>
#include<util/error.h>
CPS_START_NAMESPACE



void dwf_init(Dwf *dwf_p)
{
    char *cname = " ";
    char *fname = "dwf_init(Dwf*)";
    VRB.Func(cname,fname);

//------------------------------------------------------------------
// Do initializations before the wilson library can be used
// Initialization involve memory allocation.
//------------------------------------------------------------------
    static Wilson wilson_struct;
    dwf_p->wilson_p = &wilson_struct;
    wilson_init(dwf_p->wilson_p);

//------------------------------------------------------------------
// Allocate memory for two temporary fermion checkerboard fields
//------------------------------------------------------------------
    int f_size = 24 * GJP.VolNodeSites() * GJP.SnodeSites() / 2;

    dwf_p->frm_tmp1 = (IFloat *) smalloc(f_size*sizeof(IFloat));
    if(dwf_p->frm_tmp1 == 0)
        ERR.Pointer(cname,fname, "frm_tmp1");
    VRB.Smalloc(cname,fname,
                "frm_tmp1", dwf_p->frm_tmp1, f_size*sizeof(IFloat));

    dwf_p->frm_tmp2 = (IFloat *) smalloc(f_size*sizeof(IFloat));
    if(dwf_p->frm_tmp2 == 0)
        ERR.Pointer(cname,fname, "frm_tmp2");
    VRB.Smalloc(cname,fname,
                "frm_tmp2", dwf_p->frm_tmp2, f_size*sizeof(IFloat));

//------------------------------------------------------------------
// Allocate memory for a 12 word communications buffer needed
// for the spread-out case.
//------------------------------------------------------------------
    dwf_p->comm_buf = (IFloat *) smalloc(12 * sizeof(IFloat));
    if(dwf_p->comm_buf == 0)
        ERR.Pointer(cname,fname, "comm_buf");
    VRB.Smalloc(cname,fname,
                "comm_buf", dwf_p->comm_buf, 12*sizeof(IFloat));


//------------------------------------------------------------------
// Set the dwf coefficients
//------------------------------------------------------------------
    dwf_p->vol_4d = GJP.VolNodeSites();
    dwf_p->ls = GJP.SnodeSites();
    dwf_p->dwf_kappa =
        1.0 / ( 2 * ( 4 + GJP.DwfA5Inv() - GJP.DwfHeight() ) );

}
Example #4
0
void laplacian_init(int type1          /* operator type */,
		    int nz, int nx     /* dimensions */,
		    float dz, float dx /* sampling */,
		    float **vt1 /* [nx][nz] (v*t)^2 */)
/*< initialize >*/
{
    int i;
    float s1, s2, b0;
    const float tol=1.e-6;
    sf_filter ss, bb;

    type = type1;
    n1 = nz;
    n2 = nx;
    n12 = n1*n2;
    d1 = 1./(dz*dz);
    d2 = 1./(dx*dx);

    switch(type) {
	case 0:
	    center = -2.0*(d1+d2);
	    break;
	case 1:
	    corner = (d1+d2)/12.0;
	    s1 = (5*d1-d2)/6.0;
	    s2 = (5*d2-d1)/6.0;
	    d1 = s1;
	    d2 = s2;
	    center = -2.0*(2.0*corner+d1+d2);
	    break;
	case 2:
	    tri1 = sf_tridiagonal_init(n1);
	    sf_tridiagonal_const_define(tri1,10.0/(12.0*d1),1.0/(12.0*d1),false);
	    work1 = sf_floatalloc(n1);

	    tri2 = sf_tridiagonal_init(n2);
	    sf_tridiagonal_const_define(tri2,10.0/(12.0*d2),1.0/(12.0*d2),false);
	    work2 = sf_floatalloc(n2);
	    break;
	case 3:
	    corner = 3.0*(d1/d2+d2/d1);

	    ss = sf_allocatehelix(4);
	    ss->flt[0] = ss->flt[2] = (10.0 + corner)/144.0;
	    ss->flt[1] = ss->flt[3] = (2 - corner)/288.0;
	    ss->lag[0] = 1;
	    ss->lag[1] = n1-1;
	    ss->lag[2] = n1;
	    ss->lag[3] = n1+1;

	    bb = sf_allocatehelix(n1+1);
	    for (i=0; i <= n1; i++) {
		bb->lag[i] = i+1;
		bb->flt[i] = 0.0;
	    }

	    wilson_init(n1*10);
	    b0 = wilson_factor(100, (50.0 - corner)/72.0, ss, bb, true, tol);
	    wilson_close();
	    sf_deallocatehelix(ss);

	    bb = compress(bb,tol);
	    sf_warning("nb=%d",bb->nh);

	    work1 = sf_floatalloc(n12);

	    corner = (d1+d2)/(12.0*b0*b0);
	    s1 = (5*d1-d2)/(6.0*b0*b0);
	    s2 = (5*d2-d1)/(6.0*b0*b0);
	    d1 = s1;
	    d2 = s2;
	    center = -2.0*(2.0*corner+d1+d2);

	    sf_polydiv_init(n1*n2,bb);
	    break;
	case 4:
	    dd1 = -d1/12.0;
	    dd2 = -d2/12.0;
	    d1 *= 4.0/3.0;
	    d2 *= 4.0/3.0;
	    center = -2.0*(d1+d2+dd1+dd2);
	    break;
	case 5:
	    vt = vt1;
	    break;
	default:
	    sf_error("%s: Unknown Laplacian type",__FILE__);
    }
}