QUDA v0.4.0
A library for QCD on GPUs
quda/lib/gauge_field.cpp
Go to the documentation of this file.
00001 #include <gauge_field.h>
00002 
00003 GaugeField::GaugeField(const GaugeFieldParam &param, const QudaFieldLocation &location) :
00004   LatticeField(param, location), bytes(0), nColor(param.nColor), nFace(param.nFace),
00005   reconstruct(param.reconstruct), order(param.order), fixed(param.fixed), 
00006   link_type(param.link_type), t_boundary(param.t_boundary), anisotropy(param.anisotropy),
00007   tadpole(param.tadpole), create(param.create), is_staple(param.is_staple)
00008 {
00009   if (nColor != 3) errorQuda("nColor must be 3, not %d\n", nColor);
00010   if (nDim != 4 && nDim != 1) errorQuda("Number of dimensions must be 4 or 1, not %d", nDim);
00011   if (link_type != QUDA_WILSON_LINKS && anisotropy != 1.0) errorQuda("Anisotropy only supported for Wilson links");
00012   if (link_type != QUDA_WILSON_LINKS && fixed == QUDA_GAUGE_FIXED_YES)
00013     errorQuda("Temporal gauge fixing only supported for Wilson links");
00014 
00015   if(is_staple){
00016     real_length = volume*reconstruct;
00017     length = 2*stride*reconstruct; // two comes from being full lattice
00018   }else{
00019     real_length = 4*volume*reconstruct;
00020     length = 2*4*stride*reconstruct; // two comes from being full lattice
00021   }
00022 
00023   bytes = length*precision;
00024   bytes = ALIGNMENT_ADJUST(bytes);
00025   total_bytes = bytes;
00026 }
00027 
00028 GaugeField::~GaugeField() {
00029 
00030 }
00031 
00032 void GaugeField::checkField(const GaugeField &a) {
00033   LatticeField::checkField(a);
00034   if (a.link_type != link_type) errorQuda("link_type does not match %d %d", link_type, a.link_type);
00035   if (a.nColor != nColor) errorQuda("nColor does not match %d %d", nColor, a.nColor);
00036   if (a.nFace != nFace) errorQuda("nFace does not match %d %d", nFace, a.nFace);
00037   if (a.fixed != fixed) errorQuda("fixed does not match %d %d", fixed, a.fixed);
00038   if (a.t_boundary != t_boundary) errorQuda("t_boundary does not match %d %d", t_boundary, a.t_boundary);
00039   if (a.anisotropy != anisotropy) errorQuda("anisotropy does not match %e %e", anisotropy, a.anisotropy);
00040   if (a.tadpole != tadpole) errorQuda("tadpole does not match %e %e", tadpole, a.tadpole);
00041 }
00042 
00043 std::ostream& operator<<(std::ostream& output, const GaugeFieldParam& param) {
00044   output << static_cast<const LatticeFieldParam &>(param);
00045   output << "nColor = " << param.nColor << std::endl;
00046   output << "nFace = " << param.nFace << std::endl;
00047   output << "reconstruct = " << param.reconstruct << std::endl;
00048   output << "order = " << param.order << std::endl;
00049   output << "fixed = " << param.fixed << std::endl;
00050   output << "link_type = " << param.link_type << std::endl;
00051   output << "t_boundary = " << param.t_boundary << std::endl;
00052   output << "anisotropy = " << param.anisotropy << std::endl;
00053   output << "tadpole = " << param.tadpole << std::endl;
00054   output << "create = " << param.create << std::endl;
00055 
00056   return output;  // for multiple << operators.
00057 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines