Example #1
0
  int ILDGReader::header(){
    _Message(DEBUG_VERB_LEVEL, "ILDG Header...\n");
     n_uint64_t nbytes;

    LimeR = limeCreateReader(inputFile);
    do {limeReaderNextRecord(LimeR);}
    while (strncmp(limeReaderType(LimeR), "ildg-binary-data",16));

    nbytes = limeReaderBytes(LimeR);//size of this record (configuration)
    _Message(DEBUG_VERB_LEVEL, "ILDG Header: reading "<<nbytes<< " bytes record...\n");
  }
double ActionGaugeWilson::calc_H(){
  //Number of plaquettes
  int Nplaq = CommonPrms::instance()->Lvol()*NDIM_*(NDIM_-1)/2.0;
  double plaq = stpl_.plaquette(*u_);
  double plaq_xy = stpl_.plaq_mu_nu(*u_, 0,1);
  double plaq_xz = stpl_.plaq_mu_nu(*u_, 0,2);

  double Hgauge = Params.beta*Nplaq*(1.0 -plaq);

  _Message(ACTION_VERB_LEVEL,"    [ActionGaugeWilson] H = "<<Hgauge <<"\n");
  _Message(ACTION_VERB_LEVEL,"    [ActionGaugeWilson] Plaquette      = "<<plaq<<"\n");
  _Message(ACTION_VERB_LEVEL,"    [ActionGaugeWilson] Plaquette (xy) = "<<plaq_xy<<"\n");
  _Message(ACTION_VERB_LEVEL,"    [ActionGaugeWilson] Plaquette (xz) = "<<plaq_xz<<"\n");
  
  return Hgauge;
}
Example #3
0
 template < typename... Args > void Message( Tag::messageTag_t tag, const char *cp_fmt, const Args &... args )
 {
     if( !Funcs::_AreArgsValid( cp_fmt, args... ) )
     {
         SOFTBREAK;
         return;
     }
     _Message( tag, cp_fmt, args... );
 }
Example #4
0
extern void _MessageLevelPrintf(int level, char *file, int line, char *format,
                                ...) {
  char buff[SIZE_LOG - SIZE_FORMAT];
  va_list va;

  va_start(va, format);
  vsnprintf(buff, sizeof(buff), format, va);
  va_end(va);
  _Message(level, file, line, buff);
}
Example #5
0
GaugeField Action_Nf2_ratio::md_force(){
#ifdef ANTIPERIODIC_BC
  BC->apply_bc(*u_);
#endif

  Field eta = DdagD1_inv(D2_->mult_dag(phi_));
  long double timing;
  FINE_TIMING_START(timing);

  GaugeField fce(D1_->md_force(eta,D1_->mult(eta)));
  fce -= GaugeField(D2_->md_force(eta,phi_));

  FINE_TIMING_END(timing);
  _Message(TIMING_VERB_LEVEL, "[Timing] - Action_Nf2_ratio::md_force"
           << " - Force terms timing = "
           << timing << std::endl);

#ifdef ANTIPERIODIC_BC
  BC->apply_bc(*u_);
#endif

  FINE_TIMING_START(timing);

  if(smeared_) smart_conf_->smeared_force(fce);

  FINE_TIMING_END(timing);
  _Message(TIMING_VERB_LEVEL, "[Timing] - Action_Nf2_ratio::md_force"
           << " - Smeared force timing = "
           << timing << std::endl);

  FINE_TIMING_START(timing);

  GaugeField force = FieldUtils::TracelessAntihermite(fce); 

  FINE_TIMING_END(timing);
  _Message(TIMING_VERB_LEVEL, "[Timing] - Action_Nf2_ratio::md_force"
           << " - TracelessAntihermite timing = "
           << timing << std::endl);


  _MonitorMsg(ACTION_VERB_LEVEL, Action,force, name_);
  return force;
}
Example #6
0
double findMinMax::findMin(const double& max) const {
  std::valarray<double> gauss_va;
  int loop_count;
  double norm, epsilon, old_norm;
  double target_prec = 1e-5;

  gauss_va.resize(vect_size);
  rand_->get_gauss(gauss_va); 

  Field gauss_vect(gauss_va), temp_vect;
  temp_vect.resize(gauss_vect.size());
  old_norm = gauss_vect.norm();
  gauss_vect /= old_norm;
  old_norm = 1.0;
  loop_count = 0;

  CCIO::cout << "Calculating minimum eigenmode...";
  do {
    _Message(DEBUG_VERB_LEVEL,"Gauss vect old_norm = "<< old_norm << "\n");

    temp_vect = gauss_vect;
    temp_vect *= max;
    temp_vect -= Kernel_->mult(gauss_vect);
    gauss_vect = temp_vect;

    norm = gauss_vect.norm();
    _Message(DEBUG_VERB_LEVEL,"Gauss vect norm = "<< norm << "\n");
    gauss_vect /= norm;
    
    epsilon = fabs(old_norm-norm)/norm;
    old_norm = norm;    
    loop_count++;
    _Message(DEBUG_VERB_LEVEL,"Epsilon = "<< epsilon << "\n");
    _Message(DEBUG_VERB_LEVEL,"Loop #"<<loop_count << "\n");

  } while (epsilon > target_prec);

  CCIO::cout << "done\n";
  return (max-norm);
}
Example #7
0
	void CollisionTree::SendMessage(const SManifold & i_Manifold)
	{
		// Create message and manifold
		const SManifold _SecondManifold(i_Manifold.m_Second, i_Manifold.m_First, -i_Manifold.m_Normal);
		SMessage _Message(EMessageType::OnCollision);

		// First message
		_Message.m_CollisionData = & i_Manifold;
		i_Manifold.m_First.GetGameObject().SendMessage(_Message);
		// Second message
		_Message.m_CollisionData = & _SecondManifold;
		i_Manifold.GetOtherObject().SendMessage(_Message);
	}
Example #8
0
bool CBillboard::LoadTexture(char *filename)
{
	_SafeRelease(m_texture);
	D3DXIMAGE_INFO info;
	if(D3DXCreateTextureFromFileEx(m_device, filename, D3DX_DEFAULT_NONPOW2/*使用此参数才不会放大,使用0或者D3DX_DEFAULT图片会被放大一倍*/
		, D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT,0, D3DFMT_UNKNOWN, 
		D3DPOOL_MANAGED, D3DX_FILTER_TRIANGLE ,D3DX_FILTER_TRIANGLE,
		NULL, &info, NULL, &m_texture) != D3D_OK)
	{
		_Message("加载纹理%s失败!",filename);
		return false;
	}

	return true;
}
Example #9
0
double Action_Nf2_ratio::calc_H(){
#ifdef ANTIPERIODIC_BC
  BC->apply_bc(*u_);
#endif

  Field zeta = D2_->mult_dag(phi_);//2 flavors
  double H_nf2r = zeta*DdagD1_inv(zeta);

#ifdef ANTIPERIODIC_BC
  BC->apply_bc(*u_);
#endif

  _Message(ACTION_VERB_LEVEL,"    ["<<name_<<"] H = "<<H_nf2r<<"\n");

  return H_nf2r;
}
Example #10
0
  int ILDGReader::read(double *buffer, unsigned int size){
    _Message(DEBUG_VERB_LEVEL, "ILDG Reader...\n");
    //Read just as it is
    //order is (in, ex, sites)  
    n_uint64_t bytes_to_read = sizeof(double)*size;
    n_uint64_t read =  bytes_to_read;
    limeReaderReadData(buffer, &read, LimeR);

#ifndef BIG_ENDIAN_TYPE
    byte_swap(buffer, size);
#endif

    /* 
#ifdef DEBUG_VERB_LEVEL
    for (int i = 0; i < bytes_to_read; i++){
      std::cout << "buffer["<<i<<"] = "<< buffer[i] << "\n";
    }
#endif
    */  
  }
Example #11
0
void Action_Nf2_ratio::init(const RandNum& rand){
  long double rnd_timing;
  std::valarray<double> ph(fsize_);

  FINE_TIMING_START(rnd_timing); 

  MPrand::mp_get_gauss(ph,rand);

  FINE_TIMING_END(rnd_timing);
  _Message(TIMING_VERB_LEVEL, "[Timing] - Action_Nf2_ratio::init"
	   << " - Random numbers timing = "
	   << rnd_timing << std::endl);     

#ifdef ANTIPERIODIC_BC
  BC->apply_bc(*u_);
#endif

  phi_= D1_->mult_dag(Field(ph));
  phi_= D2_->mult(DdagD2_inv(phi_));
  
#ifdef ANTIPERIODIC_BC
  BC->apply_bc(*u_);
#endif
}
Example #12
0
void SUNRep<COLORS>::GenerateRep() {
  // Generating the fundamental representation
  ////////////////////////////////////////////
  double rsq = 1.0/sqrt(2.0);
  // initialization
  _Message(0, "SUNRep Message: Generating fundamental representation for SU("<<COLORS<<")...\n");
  for (int a = 0; a < ADJCOL; a++) 
    FundamentalGen[a].zero();
  
  // setting off-diagonal generators
  _Message(DEBUG_VERB_LEVEL, "Off diagonal generators...\n");
  int a = 0;
  for (int i = 0; i < COLORS-1; i++) {
    for (int j = i+1; j < COLORS; j++) {
      FundamentalGen[a].set(i,j, rsq, 0.0);
      FundamentalGen[a].set(j,i, rsq, 0.0); 

      a++;

      FundamentalGen[a].set(i,j, 0.0, -rsq);
      FundamentalGen[a].set(j,i, 0.0,  rsq);
      a++;	
    }
  }
 _Message(DEBUG_VERB_LEVEL, "Wrote "<<a<<" off-diagonal generators\n");

  for (int j = 0; j < COLORS-1; j++) {
    for (int i = 0; i < j+1; i++) {
      FundamentalGen[a].set(i,i, 1.0/sqrt((double)((j+1)*(j+2))), 0.0);
    }
    FundamentalGen[a].set(j+1,j+1, -double(j+1)/sqrt((double)((j+1)*(j+2))), 0.0);
    a++;
  }

  _Message(DEBUG_VERB_LEVEL, "Wrote "<<a<<" fundamental generators\n");

  // Generating the adjoint representation
  ////////////////////////////////////////////
  _Message(0, "SUNRep Message: Generating adjoint representation for SU("<<COLORS<<")...\n");
  SUNmatrix<ADJCOL> temp;
  for(int ia = 0; ia < ADJCOL; ia++) {

    for (int ic = 0; ic < ADJCOL; ic++) {
      for (int ib = 0; ib < ADJCOL; ib++) {
	
	temp.zero();
	for (int j = 0; j < COLORS; j++){ 
	  for (int i = 0; i < COLORS; i++) {
	    for (int k = 0; k < COLORS; k++) {
	      temp.set(i,j, 
		       temp.r(i,j)+
		       (FundamentalGen[ia].r(i,k)*FundamentalGen[ib].i(k,j)+
			FundamentalGen[ia].i(i,k)*FundamentalGen[ib].r(k,j)-
			FundamentalGen[ib].r(i,k)*FundamentalGen[ia].i(k,j)-
			FundamentalGen[ib].i(i,k)*FundamentalGen[ia].r(k,j)),
			temp.i(i,j) + 
		       (FundamentalGen[ia].i(i,k)*FundamentalGen[ib].i(k,j)-
			FundamentalGen[ia].r(i,k)*FundamentalGen[ib].r(k,j)+
			FundamentalGen[ib].r(i,k)*FundamentalGen[ia].r(k,j)-
			FundamentalGen[ib].i(i,k)*FundamentalGen[ia].i(k,j)));
	    }
	  }
	}

	for (int i = 0; i < COLORS; i++) {
	  for (int k = 0; k < COLORS; k++) {
	    AdjointGen[ia].set(ib,ic,
			       AdjointGen[ia].r(ib,ic) +
			       rsq*(temp.r(i,k)*FundamentalGen[ic].r(k,i)-temp.i(i,k)*FundamentalGen[ic].i(k,i)),
			       AdjointGen[ia].i(ib,ic) +
			       rsq*(temp.r(i,k)*FundamentalGen[ic].i(k,i)+temp.i(i,k)*FundamentalGen[ic].r(k,i)));
	  }
	}


      }
    }
    _Message(DEBUG_VERB_LEVEL, "Generated adjoint generator number "<<ia<<"\n");
  }






}