Esempio n. 1
0
 //CALCULATES HANKEL FUNCTION AND DERIVATIVE USING STARTING VALUES FROM SMALL T EXPANSION AND SOLVING BESSELS EQUATION
 void HankelH2(DOUBLE nu,DOUBLE xGoal,HankelPair &H2Goal){
     
     //Starting point
     DOUBLE xStart=DOUBLE(1.0);
     
     HankelPair H2Start;
     
     //Initialize at xStart using Series Expansion for small x 
     if(nu!=0){
         
         H2Start.Value=HankelH2StartValue(COMPLEX(0,nu),COMPLEX(xStart,0));
         H2Start.Derivative=HankelH2DerivativeStartValue(COMPLEX(0,nu),COMPLEX(xStart,0));
     }
     
     //For nu=0 use fixed values at x=1 
     else {
         
         //STARTING VALUES AT x=1
         xStart=DOUBLE(1.0);
         
         //FIXED VALUES FROM MATHEMATICA
         H2Start.Value=COMPLEX(0.76519769,-0.08825696);
         H2Start.Derivative=COMPLEX(-0.44005059,-0.78121282);
     }
     
     //EVOLVE TO XGOAL
     HankelH2Evolve(nu,xStart,H2Start,xGoal,H2Goal);
     
 }
Esempio n. 2
0
// get time when block of given size will be finished if started now
CTimerValue CBlockBufferStats::GetBlockFinalTime(SLONG slSize)
{
    CTimerValue tvNow = _pTimer->GetHighPrecisionTimer();

    // calculate how much should block be delayed due to latency and due to bandwidth
    CTimerValue tvBandwidth;
    if (bbs_fBandwidthLimit<=0.0f) {
        tvBandwidth = CTimerValue(0.0);
    } else {
        tvBandwidth = CTimerValue(DOUBLE((slSize*8)/bbs_fBandwidthLimit));
    }
    CTimerValue tvLatency;
    if (bbs_fLatencyLimit<=0.0f && bbs_fLatencyVariation<=0.0f) {
        tvLatency = CTimerValue(0.0);
    } else {
        tvLatency = CTimerValue(DOUBLE(bbs_fLatencyLimit+(bbs_fLatencyVariation*rand())/RAND_MAX));
    }

    // start of packet receiving is later of
    CTimerValue tvStart(
        Max(
            // current time plus latency and
            (tvNow+tvLatency).tv_llValue,
            // next free point in time
            bbs_tvTimeUsed.tv_llValue));
    // remember next free time and return it
    bbs_tvTimeUsed = tvStart+tvBandwidth;
    return bbs_tvTimeUsed;
}
Esempio n. 3
0
// when can a certian ammount of data be sent?
CTimerValue CPacketBufferStats::GetPacketSendTime(SLONG slSize) 
{
	CTimerValue tvNow = _pTimer->GetHighPrecisionTimer();

  // calculate how much should the packet be delayed due to latency and due to bandwidth
  CTimerValue tvBandwidth;
  if (pbs_fBandwidthLimit<=0.0f) {
    tvBandwidth = CTimerValue(0.0);
  } else {
    tvBandwidth = CTimerValue(DOUBLE((slSize*8)/pbs_fBandwidthLimit));
  }
  CTimerValue tvLatency;
  if (pbs_fLatencyLimit<=0.0f && pbs_fLatencyVariation<=0.0f) {
   tvLatency = CTimerValue(0.0);
  } else {
   tvLatency = CTimerValue(DOUBLE(pbs_fLatencyLimit+(pbs_fLatencyVariation*rand())/RAND_MAX));
  }

  // time when the packet should be sent is max of
  CTimerValue tvStart(
    Max(
      // current time plus latency and
      (tvNow+tvLatency).tv_llValue,
      // next free point in time
      pbs_tvTimeNextPacketStart.tv_llValue));
  // remember next free time and return it
  pbs_tvTimeNextPacketStart = tvStart+tvBandwidth;
  return pbs_tvTimeNextPacketStart;

};
const DOUBLE getAdjustedTimingFrequency( ) {
	LARGE_INTEGER timingFrequency;
	BOOL res1 = QueryPerformanceFrequency( &timingFrequency );
	if ( !res1 ) {
		fwprintf( stderr, L"QueryPerformanceFrequency failed!!!!!! Disregard any timing data!!\r\n" );
		}
	const DOUBLE adjustedTimingFrequency = ( DOUBLE( 1.00 ) / DOUBLE( timingFrequency.QuadPart ) );
	return adjustedTimingFrequency;
	}
Esempio n. 5
0
int main(void)
{
	printf("%d\n", DOUBLE(1 + 2));	//should be 2 * 1 + 2 = 4
	printf("%d\n", 4 / DOUBLE(2));	//should be 4 / 2 * 2 = 4
#undef DOUBLE
#define DOUBLE(x) (2 * (x))

	printf("%d\n", DOUBLE(1 + 2));	//should be 6
	printf("%d\n", 4 / DOUBLE(2));	//should be 1
}
Esempio n. 6
0
 // COMPUTE EMid= -i SUNcLog(UNew.UOldDagger) AND UMid=exp( i EMid*c) UOld //
 void GeodesicInterpolation(DOUBLE c,SU_Nc_FUNDAMENTAL_FORMAT *UOld,SU_Nc_FUNDAMENTAL_FORMAT *UNew,SU_Nc_FUNDAMENTAL_FORMAT *UMid,SU_Nc_ALGEBRA_FORMAT *EMid){
     
     SU_Nc_FUNDAMENTAL_FORMAT Buffer[SUNcGroup::MatrixSize];
     
     SUNcGroup::Operations::UD(UNew,UOld,Buffer);
     SUNcAlgebra::Operations::MatrixILog(-DOUBLE(1.0),Buffer,EMid);
     
     SUNcAlgebra::Operations::MatrixIExp(-DOUBLE(c),EMid,Buffer);
     SUNcGroup::Operations::UU(Buffer,UOld,UMid);
     
 }
Esempio n. 7
0
    std::string toString(){
		
		DOUBLE FullExponent=order/log(DOUBLE(10.0));
		INT IntExponent=floor(FullExponent);
		
		COMPLEX val=number*pow(DOUBLE(10.0),FullExponent-IntExponent);
		
		
        std::stringstream ss;
        ss << "(" << real(val) << "," << imag(val) << ")E" << IntExponent;
		
		return ss.str();
	}
Esempio n. 8
0
HRESULT CGraphics::UpdateTimer(void)
{
	LONGLONG time;

	if(!QueryPerformanceCounter((PLARGE_INTEGER)&time))
		return E_FAIL;

	// Calculate the elapsed time
	m_TimerElapsed = DOUBLE(time - m_TimerLast) / DOUBLE(m_TimerFrequency) * DOUBLE(m_TimerFrameRate);
	m_TimerAbsolute += m_TimerElapsed;
	m_TimerLast = time;

	return S_OK;
}
int main(void)
{
int x = DOUBLE(5) * 3;

printf("x: %d\n", x);
x = DOUBLE_impr(5) * 3;
printf("x: %d\n", x);

x = 3;
int y = DOUBLE(++x);
/* y = ( (++x) + (++x) ) */
printf("y: %d\n", y);

return 0;
}
Esempio n. 10
0
void KDialogP::UpdateTemperature()
{
	SOUNDSETTING setting;
	KCLastMemory::GetInstance()->GetSoundMemory(setting);
	if (setting.uAutoAir)
	{
		// 换算公式 F=(C×9/5)+32 ; 
		// C=(F-32)×5/9 ;式中F--华氏温度,C--摄氏温度 · 
		WCHAR wcsTemperature[16] = {0};
		DOUBLE dbTemperature = DOUBLE(setting.uOutdoorTemperature)/2 - 35;
		// 1 : 摄氏温度 2:华氏温度
		if (2 == setting.uTemperature)
		{
			swprintf(wcsTemperature, L"%.1f℉", (dbTemperature*9/5+32));
		}
		else
		{
			swprintf(wcsTemperature, L"%.1f℃", dbTemperature);
		}
		SAFECALL(m_pTxtTemperature)->SetText(wcsTemperature);
		SAFECALL(m_pTxtTemperature)->SetShow(true);
	}
	else
	{
		SAFECALL(m_pTxtTemperature)->SetShow(false);
	}
}
Esempio n. 11
0
void CSoundSourceFMod::UpdateVolume()
{
	// only if channel active
	if(_FModChannel==-1)
		return;

	float fGain = CSoundSystemFMod::GetMe()->GetTypeVolume(GetType());

	//3D模式
	if(_b3DMode)
	{
		//得到与听者距离平方
		FLOAT fDistanceSQR = TDU_GetDistSq(GetPos(), CSoundSystemFMod::GetMe()->Listener_GetPos());

		//计算声音分贝
		INT  nVolumeDB= INT(floor(2000.0 * log10(fGain))); // convert to 1/100th decibels
		const static INT s_nDBMin= -10000;
		const static INT s_nDBMax= 0;
		TDU_Clamp(nVolumeDB, s_nDBMin, s_nDBMax);

		//根据距离计算音量
		nVolumeDB= _ComputeManualRollOff(nVolumeDB, s_nDBMin, s_nDBMax, _Alpha, fDistanceSQR);
		
		//计算线性值
		DOUBLE	dAttGain= pow((DOUBLE)10.0, DOUBLE(nVolumeDB)/2000.0);
		TDU_Clamp(dAttGain, 0.0f, 1.0f);

		FSOUND_SetVolume(_FModChannel, UINT(dAttGain*255));
	}
	else
	{
		FSOUND_SetVolume(_FModChannel, UINT(fGain*255));
	}
}
 // MEASURE PEAK STRESS //
 void MeasurePeakStress(INT xLow,INT xHigh,INT yLow,INT yHigh,INT zLow,INT zHigh,GaugeLinks *U,GaugeTransformations *S){
     
     DOUBLE MaxStress=0.0;
     
     #pragma omp parallel
     {
         #pragma omp for reduction(max : MaxStress)
         for(INT z=zLow;z<=zHigh;z++){
             for(INT y=yLow;y<=yHigh;y++){
                 for(INT x=xLow;x<=xHigh;x++){
                     // DEFINE LOCAL STRESS //
                     DOUBLE LocalStress=DOUBLE(0.5)*(SUNcGroup::Operations::ReTrIDMinusU(EnslavedFields::U->Get(x,y,z,0))+SUNcGroup::Operations::ReTrIDMinusU(EnslavedFields::U->Get(x,y,z,1))+SUNcGroup::Operations::ReTrIDMinusU(EnslavedFields::U->Get(x,y,z,2))+SUNcGroup::Operations::ReTrIDMinusU(EnslavedFields::U->Get(x-1,y,z,0))+SUNcGroup::Operations::ReTrIDMinusU(EnslavedFields::U->Get(x,y-1,z,1))+SUNcGroup::Operations::ReTrIDMinusU(EnslavedFields::U->Get(x,y,z-1,2)));
                     
                     // TEST FOR SUPREMUM //
                     MaxStress=std::max(LocalStress,MaxStress);
                     
                 }
             }
             
         }
         
    }// END PARALLEL
     
     
     // SET GLOBAL PEAKSTRESS //
     PeakStress=MaxStress;
     
 }
Esempio n. 13
0
 void Output(std::string fname){
     
     std::ofstream OutStream;
     OutStream.open(fname.c_str());
     
     OutStream << "#xLow=" << xLow << " xHigh=" << xHigh << " DeltaX=" << DeltaX << " NBins=" << NBins << std::endl;
     OutStream << "#TOTALCOUNTS=" << TotalCounts << " UNCOUNTED=" << OutOfRange << std::endl;
     
     for(INT i=0;i<NBins;i++){
         
         if(Counts[i]>0){
             
             OutStream << xValues[i]/Counts[i];
             
             for(INT j=0;j<NumberOfObservables;j++){
                 OutStream << " " << yValues[NumberOfObservables*i+j]/Counts[i];
             }
             
             OutStream << " " << Counts[i]/DOUBLE(TotalCounts+OutOfRange) << std::endl;
             
         }
         
     }
     
     OutStream.close();
     
 }
Esempio n. 14
0
// does "snap to grid" for given coordinate
void Snap( DOUBLE &fDest, DOUBLE fStep)
{
  // this must use floor() to get proper snapping of negative values.
  DOUBLE fDiv = fDest/fStep;
  DOUBLE fRound = fDiv + 0.5f;
  DOUBLE fSnap = DOUBLE(floor(fRound));
  DOUBLE fRes = fSnap * fStep;
  fDest = fRes;
}
Esempio n. 15
0
 void Power(SU_Nc_FUNDAMENTAL_FORMAT *V,SU_Nc_FUNDAMENTAL_FORMAT *Vm,DOUBLE m){
     
     SU_Nc_ALGEBRA_FORMAT logV[SUNcAlgebra::VectorSize];
     
     SUNcAlgebra::Operations::MatrixILog(DOUBLE(1.0),V,logV);
     
     SUNcAlgebra::Operations::MatrixIExp(m,logV,Vm);
     
 }
Esempio n. 16
0
/**
 * im_contrast_surface:
 * @in: input image
 * @out: output image
 * @half_win_size: window radius
 * @spacing: subsample output by this
 *
 * Generate an image where the value of each pixel represents the
 * contrast within a window of half_win_size from the corresponsing
 * point in the input image. Sub-sample by a factor of spacing.
 * 
 * See also: im_spcor(), im_gradcor().
 * 
 * Returns: 0 on success, -1 on error.
 */
int
im_contrast_surface (IMAGE * in, IMAGE * out, int half_win_size, int spacing)
{
  IMAGE *t1 = im_open_local (out, "im_contrast_surface intermediate", "p");

  if (!t1
      || im_embed (in, t1, 1, half_win_size, half_win_size,
		   in->Xsize + DOUBLE (half_win_size),
		   in->Ysize + DOUBLE (half_win_size))
      || im_contrast_surface_raw (t1, out, half_win_size, spacing))

    return -1;

  out->Xoffset = 0;
  out->Yoffset = 0;

  return 0;
}
Esempio n. 17
0
	//Computes sin(z) in smart complex format
	SmartComplex sine(COMPLEX z){
		
		SmartComplex res;
		
		res.number=COMPLEX(sin(real(z)),tanh(imag(z))*cos(real(z)));
		
		//USE COMPLETE log(cosh(x)) ONLY FOR x<10
		if(abs(imag(z))<DOUBLE(10.0)){
			res.order=log(cosh(imag(z)));
		}
		
		//ELSE USE log(cosh(x))~Abs[x]-log[2] (ABSOLUTE ERROR IS SMALLER THAN 1e-9 for |x|>10)
		else {
			res.order=abs(imag(z))-log(DOUBLE(2.0));
		}
		
		return res;
	}
Esempio n. 18
0
 //STARTING VALUE FOR ODE
 COMPLEX HankelH2StartValue(COMPLEX nu,COMPLEX z){
     
     //Calculate Normalized value including exp(pi nu/2) factor
     SmartComplex Value=SmartComplexFunctions::exponential(DOUBLE(0.5)*PI*imag(nu))*HankelH2Series(nu,z);
     
     //Cast to complex number
     return Value.number*exp(Value.order);
     
 }
Esempio n. 19
0
TMath::DOUBLE TMath::asin(DOUBLE x)
{
	x = mod(x + 1, 2) - 1;
	DOUBLE r = 0;
	for (LONG n = 0; n <= 8L; n++)
	{
		r += fac(2 * n) / (pow(DOUBLE(2), 2 * n) * pow(fac(n), 2) * (2 * n + 1)) * pow(x, 2 * n + 1);
	}
	return r;
}
Esempio n. 20
0
void
_fp_pack_extword(
	fp_simd_type	*pfpsd,	/* Pointer to simulator data */
	uint64_t	*pu,	/* unpacked operand */
	uint_t		n)	/* register where datum starts */
{
	if ((n & 1) == 1)	/* fix register encoding */
		n = (n & 0x1e) | 0x20;
	pfpsd->fp_current_write_dreg(pu, DOUBLE(n), pfpsd);
}
Esempio n. 21
0
File: gen.c Progetto: kohsiangyu/Lab
// calculate the number of roots, given the number of levels
void TaxPar::calc_values(void)
{
  LINT nset;
  
  nset = 0;
  nset += (nlevels != 0);
  nset += (fanout != 0);
  nset += (nroots != 0);
  
  switch (nset) 
    {
    case 0:	// fill in defaults
      nroots = 250;
      fanout = 5;
      return;

    case 1:	// need to fill in 1 value
      assert (nlevels == 0);
      if (fanout == 0)
	fanout = 5;
      else if (nroots == 0)
	nroots = 250;
      return;

    case 2:
      if (nlevels == 0)		// all set!
	return;
      if (fanout != 0) {	// calculate nroots
	nroots = nitems / (1 + pow(DOUBLE(fanout), DOUBLE(nlevels-1)));
	if (nroots < 1)
	  nroots = 1;
      }
      else if (nroots != 0) {	// calculate fanout
	FLOAT temp;
	temp = (FLOAT)nitems / nroots - 1;
	temp = log((DOUBLE)temp) / (nlevels - 1);
	fanout = exp((DOUBLE)temp);
      }
    case 3:			// all set!
      return;
    }
}
Esempio n. 22
0
int
im_contrast_surface_raw (IMAGE * in, IMAGE * out, int half_win_size,
			 int spacing)
{
#define FUNCTION_NAME "im_contrast_surface_raw"

  cont_surf_params_t *params;

  if (im_piocheck (in, out) ||
    im_check_uncoded (FUNCTION_NAME, in) ||
    im_check_mono (FUNCTION_NAME, in) ||
    im_check_format (FUNCTION_NAME, in, IM_BANDFMT_UCHAR))
    return -1;

  if (half_win_size < 1 || spacing < 1)
    {
      im_error (FUNCTION_NAME, "%s", _("bad parameters"));
      return -1;
    }

  if (DOUBLE (half_win_size) >= LESSER (in->Xsize, in->Ysize))
    {
      im_error (FUNCTION_NAME,
		"%s", _("parameters would result in zero size output image"));
      return -1;
    }

  params = IM_NEW (out, cont_surf_params_t);

  if (!params)
    return -1;

  params->half_win_size = half_win_size;
  params->spacing = spacing;

  if (im_cp_desc (out, in))
    return -1;

  out->BandFmt = IM_BANDFMT_UINT;

  out->Xsize = 1 + ((in->Xsize - DOUBLE_ADD_ONE (half_win_size)) / spacing);
  out->Ysize = 1 + ((in->Ysize - DOUBLE_ADD_ONE (half_win_size)) / spacing);

  out->Xoffset = -half_win_size;
  out->Yoffset = -half_win_size;

  if (im_demand_hint (out, IM_FATSTRIP, in, NULL))
    return -1;

  return im_generate (out, im_start_one, cont_surf_gen, im_stop_one, in,
		      params);

#undef FUNCTION_NAME
}
Esempio n. 23
0
int get_args(tree* my_tree, double* argv, const int argc)
{
	assert(my_tree);
	assert(argv);
	assert(argc > 0);

	tree* temp_tree = my_tree -> right;

	int i = 0;
	for (i = 0; i < argc - 1; ++i)
	{
		assert(temp_tree -> left);
		argv[i] = DOUBLE(temp_tree -> left);
		assert(temp_tree -> right);
		temp_tree = temp_tree -> right;
	}
	argv[i] = DOUBLE(temp_tree);
	
	return TREE_OK;
}
 DOUBLE UnitarityNorm(SU_Nc_FUNDAMENTAL_FORMAT *V){
     
     SU_Nc_FUNDAMENTAL_FORMAT C[SUNcGroup::MatrixSize];
     SUNcGroup::Operations::UD(V,V,C);
     
     DOUBLE Norm=DOUBLE(0.0);
     
     for(int alpha=0;alpha<SUNcGroup::MatrixSize;alpha++){
         Norm+=SQR(C[alpha]-SUNcGroup::UnitMatrix[alpha]);
     }
     
     return sqrt(Norm);
 }
Esempio n. 25
0
LPTSTR Unit2String( LFIXED Fixed, LPTSTR lpFixed )
{
	long points, picas;
	double d;

	switch ( Units )
	{
		case UT_MM:
			d = (DOUBLE(Fixed) *  (double)25.4);
			DoubleToString(d, lpFixed, 2);
		break;

		case UT_PICAS:
			// d is now in points
			d = (DOUBLE(Fixed) * (double)Points)/10.0;
			points  = (long)(d + 0.5);
			picas   = points/12L;
			points -= (picas*12L);
			wsprintf(lpFixed, "%ld,%ld", picas, points);
		break;

		case UT_CM:
			d  = (DOUBLE(Fixed) * (double)2.54);
			DoubleToString(d, lpFixed, 3);
		break;

		case UT_PIXELS:
			d = (DOUBLE(Fixed) * (double)UnitRes);
			DoubleToString(d, lpFixed, 0);
		break;

		case UT_INCHES:
		default:
			FixedAscii( Fixed, lpFixed, 3 );
		break;
	}

	return( lpFixed );
}
Esempio n. 26
0
void genGateKeeperApprovedAppRow(sqlite3_stmt* const stmt, Row& r) {
  for (int i = 0; i < sqlite3_column_count(stmt); i++) {
    auto column_name = std::string(sqlite3_column_name(stmt, i));
    auto column_type = sqlite3_column_type(stmt, i);
    if (column_type == SQLITE_TEXT) {
      auto value = sqlite3_column_text(stmt, i);
      if (value != nullptr) {
        r[column_name] = std::string(reinterpret_cast<const char*>(value));
      }
    } else if (column_type == SQLITE_FLOAT) {
      auto value = sqlite3_column_double(stmt, i);
      r[column_name] = DOUBLE(value);
    }
  }
}
Esempio n. 27
0
void CKmlLoader::packet_1002(const unsigned real_sequence, const unsigned sequence, const QMap<QString, QVariant> content)
{
#define LON_LAT(name)\
	QString::number(content[name].toDouble() / M_PI * 180, 'g', 11)

#define DOUBLE(name)\
	QString::number(content[name].toDouble(), 'g', 11)

	const QString field = QString("%1,%2,%3\n")
		.arg(LON_LAT("longitude"))
		.arg(LON_LAT("latitude"))
		.arg(DOUBLE("altitude"));

	stream.writeCharacters(field);
}
Esempio n. 28
0
/* layer 3 */
static DOUBLE anfisAndOrNode(FIS *fis, int index, char *action, int index2)
{
	DOUBLE *input = fis->node[index]->input;
	int which_rule = fis->node[index]->l_index;
	int and_or = fis->and_or[which_rule];
	DOUBLE (*AndOrFcn)() = and_or == 1? fis->andFcn:fis->orFcn;
	int i;

	anfisSetupInputArray(fis, index);

	if (strcmp(action, "forward") == 0) {
		fis->node[index]->tmp =
			fisArrayOperation(input, fis->node[index]->fanin_n,
			AndOrFcn);
		return(fis->node[index]->tmp);
	}
	if (strcmp(action, "backward") == 0) {
		if ((AndOrFcn == fisMin) || (AndOrFcn == fisMax)) {
			for (i = 0; i < fis->node[index]->fanin_n; i++)
				if (fis->node[index]->tmp == input[i])
					break;
			return(index2 == i? 1.0:0.0);
		}
		if (AndOrFcn == fisProduct) {
			DOUBLE product = 1.0;
			for (i = 0; i < fis->node[index]->fanin_n; i++) {
				if (i == index2)
					continue;
				product *= input[i];
			}
			return(product);
		}
		if (AndOrFcn == fisProbOr) {
			DOUBLE product = 1.0;
			for (i = 0; i < fis->node[index]->fanin_n; i++) {
				if (i == index2)
					continue;
				product *= (1 - input[i]);
			}
			return(product);
		}
	}
	if (strcmp(action, "parameter") == 0)
		return(0.0);
	fisError("Unknown action!\n");
	return(0);	/* for suppressing compiler's warning only */
}
Esempio n. 29
0
File: pixel.c Progetto: dmt4/atomeye
int main (int argc, char *argv[])
{
    int i;
    double r,g,b;
    printf ("The colormap %d is \"%s\".\n", AX_CMAP_IDX,
            AX_cmap_funs[AX_CMAP_IDX].name);
    printf ("Compare the following printout with Matlab function\n"
            "fprintf(1,'%%5d %%9.4f %%9.4f %%9.4f\\n',"
            "[(1:%d)' %s(%d)]')\n\n",
            M, AX_cmap_funs[AX_CMAP_IDX].name, M);
    for (i=1; i<=M; i++)
    {
        AX_cmap (AX_CMAP_IDX, DOUBLE(i)/M, &r, &g, &b);
        printf ("%5d %9.4f %9.4f %9.4f\n", i, r, g, b);
    }
    return (0);
}
Esempio n. 30
0
namespace ChernSimonsNumber{
    
    ///////////
    // NAIVE //
    ///////////
    
    // DELTA NCS ALONG THE ORIGINAL TRAJECTORY //
    DOUBLE DeltaNCsRealTime=DOUBLE(0.0);
    
    /////////////
    // COOLING //
    /////////////
    
    // DELTA NCS REAL-TIME ALONG STANDARD COOL PATH  //
    DOUBLE DeltaNCsCoolRealTime=DOUBLE(0.0);
    
    // DELTA NCS ALONG COOLING PATH //
    DOUBLE DeltaNCsCooling=DOUBLE(0.0);
    
    /////////////////
    // CALIBRATION //
    /////////////////
    
    // DELTA NCS BETWEEN STANDARD COOL PATH AND VACUUM //
    DOUBLE DeltaNCsCalibration=DOUBLE(0.0); DOUBLE DeltaNCsPreviousCalibration=DOUBLE(0.0);
    
    // DELTA NCS IN REAL TIME ALONG THE STANDARD COOLING PATH AT TIME OF CALIBRATION //
    DOUBLE DeltaNCsRealTimeCalibration=DOUBLE(0.0); DOUBLE DeltaNCsRealTimePreviousCalibration=DOUBLE(0.0);
            
    
    DOUBLE NCsDot(GaugeLinks *U,ElectricFields *E){
        
        DOUBLE EDotB;
        
        ////////////////////////////////////////
        // COMPUTE VOLUME INTEGRAL OF tr[E.B] //
        ////////////////////////////////////////
        
        // OPTION TO USE UNIMPROVED OPERATORS //
        //EDotB=UnimprovedOperators::ComputeEDotB(U,E);
        // END OPTION //
        
        // OPTION TO USE IMPROVED OPERATORS //
        EDotB=ImprovedOperators::ComputeEDotB(U,E);
        // END OPTION //
        
        
        return DOUBLE(0.125)*EDotB/SQR(PI);
    }
    
    
    
}