aniso_io.cc

Go to the documentation of this file.
00001 // $Id: aniso_io.cc,v 3.2 2008/01/21 20:41:23 edwards Exp $
00002 /*! \file
00003  *  \brief Anisotropy parameters
00004  */
00005 
00006 #include "io/aniso_io.h"
00007 
00008 namespace Chroma 
00009 { 
00010 
00011   //! Initialize a anisotropy param struct
00012   AnisoParam_t::AnisoParam_t()
00013   {
00014     anisoP = false;
00015     t_dir  = Nd-1;   // doesn't matter - should not be used when anisoP is false
00016     xi_0   = 1;
00017     nu     = 1;
00018   }
00019   
00020 
00021   //! Read a anisotropy param struct
00022   void read(XMLReader& xml, const string& path, AnisoParam_t& param)
00023   {
00024     QDPIO::cout << "Reading an AnisoParam_t" << endl;
00025 
00026     XMLReader paramtop(xml, path);
00027 
00028     read(paramtop, "anisoP", param.anisoP);
00029 
00030     // To avoid confusion later, if the anisoP is false, then set the
00031     // struct to its default state.
00032     if (param.anisoP)
00033     {
00034       read(paramtop, "t_dir", param.t_dir);
00035       read(paramtop, "xi_0", param.xi_0);
00036 
00037       if (paramtop.count("nu") != 0) 
00038         read(paramtop, "nu", param.nu);
00039       else
00040         param.nu = 1.0;
00041     }
00042     else
00043     {
00044       AnisoParam_t foo;
00045       param = foo;
00046     }
00047   }
00048 
00049 
00050   //! Write a anisotropy param struct
00051   void write(XMLWriter& xml, const string& path, const AnisoParam_t& param)
00052   {
00053     push(xml, path);
00054 
00055     write(xml, "anisoP", param.anisoP);
00056     write(xml, "t_dir", param.t_dir);
00057     write(xml, "xi_0", param.xi_0);
00058     write(xml, "nu", param.nu);
00059 
00060     pop(xml);
00061   }
00062 
00063 
00064   // Make fermion coefficients
00065   multi1d<Real> makeFermCoeffs(const AnisoParam_t& aniso)
00066   {
00067     multi1d<Real> cf(Nd);
00068     cf = 1.0;
00069 
00070     if (aniso.anisoP)
00071     {
00072       for(int mu=0; mu < cf.size(); ++mu)
00073       {
00074         if (mu != aniso.t_dir)
00075         {
00076           cf[mu] = aniso.nu / aniso.xi_0;
00077         }
00078       }
00079     }
00080 
00081     return cf;
00082   }
00083 
00084 
00085 }  // end namespace Chroma

Generated on Sun Nov 22 04:28:48 2009 for CHROMA by  doxygen 1.4.7