src/util/dirac_op/d_op_wilson/qcdsp/wilson_init.C

Go to the documentation of this file.
00001 #include<config.h>
00002 CPS_START_NAMESPACE
00003 //--------------------------------------------------------------------
00004 //  CVS keywords
00005 //
00006 //  $Source: /space/cvs/cps/cps++/src/util/dirac_op/d_op_wilson/qcdsp/wilson_init.C,v $
00007 //  $State: Exp $
00008 //
00009 //--------------------------------------------------------------------
00010 /****************************************************************************/
00011 /* 10/6/96                                                                  */
00012 /*                                                                          */
00013 /* wilson_int:                                                              */
00014 /*                                                                          */
00015 /* This routine performs all initializations needed before wilson func      */
00016 /* are called. It sets the addressing related arrays and reserves memory    */
00017 /* for the needed temporary buffers. It only needs to be called             */
00018 /* once at the begining of the program (or after a wilson_end call)         */
00019 /* before any number of calls to wilson funcs are made.                     */
00020 /*                                                                          */
00021 /****************************************************************************/
00022 
00023 /*--------------------------------------------------------------------------*/
00024 /* Include header files                                                     */
00025 /*--------------------------------------------------------------------------*/
00026 CPS_END_NAMESPACE
00027 #include<util/wilson.h>
00028 #include<util/gjp.h>
00029 #include<util/smalloc.h>
00030 #include<util/verbose.h>
00031 #include<util/error.h>
00032 CPS_START_NAMESPACE
00033 
00034 
00035 
00036 
00037 /*--------------------------------------------------------------------------*/
00038 /* Function declarations                                                    */
00039 /*--------------------------------------------------------------------------*/
00040 void wfm_sublatt_pointers(int slx, 
00041                           int sly, 
00042                           int slz, 
00043                           int slt, 
00044                           int slatt_eo, 
00045                           Wilson *wilson_p);
00046 
00047 /*=========================================================================*/
00048 /* wilson_init:                                                            */
00049 /*=========================================================================*/
00050 
00051 void wilson_init(Wilson *wilson_p)  /* pointer to Wilson type structure    */
00052 {
00053   char *cname = " ";
00054   char *fname = "wilson_init(Wilson*)";
00055   VRB.Func(cname,fname);
00056 
00057   int spinor_words;             /* size of the spinor field on the         */
00058                                 /* sublattice checkerboard                 */
00059 
00060   int half_spinor_words;        /* size of the spin-projected "half_spinors*/
00061                                 /* on the sublattice checkerboard including*/
00062                                 /* the communications padding              */
00063 
00064   int slx;                          /* x-direction size of node sublattice */
00065   int sly;                          /* y-direction size of node sublattice */
00066   int slz;                          /* z-direction size of node sublattice */
00067   int slt;                          /* t-direction size of node sublattice */
00068   int slatt_eo;                     /* =0/1 if the sublattice is even/odd. */
00069   int i;
00070   int size;
00071 
00072 
00073 
00074 /*--------------------------------------------------------------------------*/
00075 /* Set sublattice direction sizes                                           */
00076 /*--------------------------------------------------------------------------*/
00077   slx = GJP.XnodeSites();
00078   sly = GJP.YnodeSites();
00079   slz = GJP.ZnodeSites();
00080   slt = GJP.TnodeSites();
00081 
00082 /*--------------------------------------------------------------------------*/
00083 /* Determine if the sublattice is even or odd from the node coordinates     */
00084 /* If (px,py,pz,pt) are the coordinates of the node and the node            */
00085 /* mesh is of size (nx,ny,nz,nt) then a node is even/odd if its             */
00086 /* lexicographical number =  px + nx * ( py + ny * ( pz + nz * ( pt )))     */
00087 /* is even/odd.                                                             */
00088 /*--------------------------------------------------------------------------*/
00089 /* A runtime system function is needed here to determine (px,py,pz,pt) and  */
00090 /* (nx,ny,nz,nt). For now we set slat_eo = 0 which is a safe choice if      */
00091 /* slx,sly,slz,slt are all even.                                            */
00092 /* ??? */
00093   slatt_eo = 0;
00094 
00095 /*--------------------------------------------------------------------------*/
00096 /* Reserve memory for the node sublattice pointers                          */
00097 /*--------------------------------------------------------------------------*/
00098   size = 40*sly*slz*slt*sizeof(int);
00099   wilson_p->ptr = (int *) smalloc(size);
00100   if( wilson_p->ptr == 0)
00101     ERR.Pointer(cname,fname, "ptr");
00102   VRB.Smalloc(cname,fname,
00103               "ptr", wilson_p->ptr, size);
00104 
00105 /*--------------------------------------------------------------------------*/
00106 /* Set the node sublattice pointers                                         */
00107 /*--------------------------------------------------------------------------*/
00108   wfm_sublatt_pointers(slx, sly, slz, slt, slatt_eo, wilson_p);
00109 
00110 
00111 /*--------------------------------------------------------------------------*/
00112 /* Reserve memory for 1  temporary spinor (nedded by mdagm)                 */
00113 /*--------------------------------------------------------------------------*/
00114   spinor_words = SPINOR_SIZE * wilson_p->vol[1];
00115 
00116   wilson_p->spinor_tmp = (IFloat *) smalloc(spinor_words*sizeof(IFloat));
00117   if(wilson_p->spinor_tmp == 0)
00118     ERR.Pointer(cname,fname, "spinor_tmp");
00119   VRB.Smalloc(cname,fname,
00120               "spinor_tmp", wilson_p->spinor_tmp, spinor_words*sizeof(IFloat));
00121     
00122 
00123 /*--------------------------------------------------------------------------*/
00124 /* Reserve memory for the 4 forward and 4 backward spin projected half      */ 
00125 /* spinors.                                                                 */
00126 /*--------------------------------------------------------------------------*/
00127   for(i=0; i<4; i++){
00128     half_spinor_words = HALF_SPINOR_SIZE * wilson_p->padded_subgrid_vol[i];
00129 
00130     wilson_p->af[i] = (IFloat *) smalloc(half_spinor_words*sizeof(IFloat));
00131     if(wilson_p->af[i] == 0)
00132       ERR.Pointer(cname,fname, "af[i]");
00133     VRB.Smalloc(cname,fname,
00134                 "af[i]", wilson_p->af[i], half_spinor_words*sizeof(IFloat));
00135 
00136     wilson_p->ab[i] = (IFloat *) smalloc(half_spinor_words*sizeof(IFloat));
00137     if(wilson_p->ab[i] == 0)
00138       ERR.Pointer(cname,fname, "ab[i]");
00139     VRB.Smalloc(cname,fname,
00140                 "ab[i]", wilson_p->ab[i], half_spinor_words*sizeof(IFloat));
00141   }
00142 
00143 }
00144 
00145 
00146 
00147 
00148 
00149 
00150 
00151 
00152 
00153 
00154 
00155 
00156 
00157 
00158 
00159 
00160 
00161 
00162 
00163 
00164 
00165 
00166 
00167 
00168 CPS_END_NAMESPACE

Generated on Tue Mar 6 10:57:32 2007 for Columbia Physics System by  doxygen 1.4.6