Example #1
0
void Simplex::insert(Point * p) {
  float newDelta = deltaZ(p);
  if (newDelta < _maxDelta)
    _innerPoints.push_back(p);
  else {
    _innerPoints.push_front(p);
    _maxDelta = newDelta;
  }
}
Example #2
0
//--------------------------------------------------------------------------
//
//--------------------------------------------------------------------------
void AlgWspect::run()
{
#ifdef  TIMING_ALG_W_SPECT
  int quark_b, quark_e;
  int meson_b, meson_m, meson_e, meson_bmp, meson_mmp, meson_emp;
  int nucleon_b, nucleon_m, nucleon_e;
  int total_b = clock();
  int total_e;  
#endif
	  CgArg cg = *cg_arg_p;
	  char *fname = "run()";
	  VRB.Func(d_class_name,fname);

	  // printf("in AlgWspect::run \n");

	  WspectOutput * output = (WspectOutput *)common_arg->results;
	  

	  // Set the Lattice pointer
	  //------------------------------------------------------------------------
	  Lattice& lat = AlgLattice();

	  int src_slice = d_arg_p->aots_start;
	  int src_slice_step = d_arg_p->aots_step;
	  int src_slice_end  = src_slice + src_slice_step * d_arg_p->aots_num;

	  VRB.Result(d_class_name,fname,"%d %d %d \n",src_slice,src_slice_step, src_slice_end);

	  for ( ; src_slice < src_slice_end; src_slice += src_slice_step) {


	    // Calculate quark propagator
	    //----------------------------------------------------------------------
	    // Ping:  certainly more work here to be done about the desired
	    //        combinations of non-degenerate quarks.
	    //        Presumably, more arguments will have to be passed in.
	    //        One way: for three flavors, [100] means use only q1
	    //                 to caculate spectrum.
	    //        Also some care needed to get the scope (CTOR and DTOR) 
	    //        of each quark propagator right.
	    //    const WspectQuark & q2 = q;
	    //    const WspectQuark & q3 = q;

	    // Xiaodong & Thomas:
	    // Modified to calculate also extended mesons
	    // q1 is the usual propagator(no source operator), which can be
	    // used to pass propagation direction and src_slice infomation
	    // to spectrum class

	    // there is a problem here --> check !
	    VRB.Result(d_class_name,fname,"prop_dir = %d , src_slice = %d \n",d_arg_p->prop_dir, src_slice);

	    WspectHyperRectangle hyperRect(d_arg_p->prop_dir, src_slice);    

	#ifdef  TIMING_ALG_W_SPECT
	    quark_b = clock();
	#endif

    VRB.Result(d_class_name,fname,"created quark q1 \n");
	    // create local quark propagator
	     WspectQuark q1(lat, output->cg, output->pbp,
			  output->mid_point, output->a0_p, d_arg_p[0], cg,hyperRect);
		  
      VRB.Result(d_class_name,fname,"finished quark q1 \n");
#ifdef  TIMING_ALG_W_SPECT
    quark_e = clock();
#endif

    //Note: for ExtendedMesons, do only zero momentum projection
    WspectMomenta  mom(hyperRect, q1.SourceCenter2(), d_arg_p->num_mom - 1);
    //    mom.dumpData();


    // Calculate LOCAL meson CORRELATOR
    // added control by Thomas and Xiaodong
    //----------------------------------------------------------------------
    {
#ifdef  TIMING_ALG_W_SPECT
      meson_b = clock();
#endif
     if(d_arg_p->normal_mesons_on) {
        WspectMesons mes(q1, q1, hyperRect, mom);
#if 0
	q1.dumpData("qprop.dat");
#endif

#ifdef  TIMING_ALG_W_SPECT
        meson_m = clock();
#endif
        //write data to files
        mes.print(output);
      }
#ifdef  TIMING_ALG_W_SPECT
      meson_e = clock();
#endif
    } //end of normal mesons
   

    // Calculate <\Delta J^5 \bar q1 \gamma^5 q1> with middle point sink
    // changed
    //----------------------------------------------------------------------
    if (lat.Fclass() == F_CLASS_DWF && output->mid_point)
      {
#ifdef  TIMING_ALG_W_SPECT
	meson_bmp = clock();
#endif
        WspectMesons mes(q1.Data_SP1(), q1.Data_SP2(), hyperRect, mom);
	
#ifdef  TIMING_ALG_W_SPECT
	meson_mmp = clock();
#endif
	
	mes.print_mp(output->mid_point);	
	
#ifdef  TIMING_ALG_W_SPECT
	meson_emp = clock();
#endif
      }
    
    // Calculate nucleon and delta's
    //----------------------------------------------------------------------
    if (d_arg_p->baryons_on) {
      
      {
#ifdef  TIMING_ALG_W_SPECT
	nucleon_b = clock();
#endif
	WspectBaryon nuc(q1, q1, q1, hyperRect,
			 WspectBaryon::NUCLEON_CONSTI,
			 WspectBaryon::NUCLEON_DIRAC);
#ifdef  TIMING_ALG_W_SPECT
	nucleon_m = clock();
#endif

	nuc.print(output->nucleon, output->fold);	

#ifdef  TIMING_ALG_W_SPECT
	nucleon_e = clock();
#endif   
      }

      
      {
	WspectBaryon nucPrime(q1, q1, q1, hyperRect,
			      WspectBaryon::NUCLEON_CONSTI,
			      WspectBaryon::UnitUnit);
	nucPrime.print(output->nucleon_prime, output->fold);	
      }
      
      
      {
	WspectBaryon deltaX(q1, q1, q1, hyperRect,
			    WspectBaryon::DELTA_CONSTI,
			    WspectBaryon::DELTAX_DIRAC);
	deltaX.print(output->delta_x, output->fold);	
      }
      
      
      {
	WspectBaryon deltaY(q1, q1, q1, hyperRect,
			    WspectBaryon::DELTA_CONSTI,
			    WspectBaryon::DELTAY_DIRAC);
	deltaY.print(output->delta_y, output->fold);      
      }
      
      
      {
	WspectBaryon deltaZ(q1, q1, q1, hyperRect,
			    WspectBaryon::DELTA_CONSTI,
			    WspectBaryon::DELTAZ_DIRAC);
	deltaZ.print(output->delta_z, output->fold); 
      }
      

      {
	WspectBaryon deltaT(q1, q1, q1, hyperRect,
			    WspectBaryon::DELTA_CONSTI,
			    WspectBaryon::DELTAT_DIRAC);
	deltaT.print(output->delta_t, output->fold); 
      }
    } //end if(baryons_on) 
    
    // Increment the counter
    d_counter += d_count_step;
  } // end of for(sc_slice,..)

#ifdef  TIMING_ALG_W_SPECT
  total_e = clock();
  printf("Total: %d = [%d - %d]\n", total_e - total_b, total_e, total_b);
  printf("Quark: %d = [%d - %d]\n", quark_e - quark_b, quark_e, quark_b);
  printf("Meson: \t%d = [%d - %d] = \n\tcalc %d = [%d - %d] + \n\tprint %d = [%d - %d]\n", 
	 meson_e - meson_b, meson_e, meson_b,
	 meson_m - meson_b, meson_m, meson_b,
	 meson_e - meson_m, meson_e, meson_m);
  printf("Nucleon:\t%d = [%d - %d] = \n\tcalc %d = [%d - %d] + \n\tprint %d = [%d - %d]\n", 
	 nucleon_e - nucleon_b, nucleon_e, nucleon_b,
	 nucleon_m - nucleon_b, nucleon_m, nucleon_b,
	 nucleon_e - nucleon_m, nucleon_e, nucleon_m);  
#endif 
   VRB.FuncEnd(d_class_name,fname);

}