virtual void getAllParameters(std::vector<double>& v) const
    {
        check(kVals_.size() >= 2, "");
        check(kVals_.size() == amplitudes_.size(), "");

        int nPar = 4 + 2 * kVals_.size() - 2;

        v.resize(nPar);

        std::vector<double>::iterator it = v.begin();
        *(it++) = getOmBH2();
        *(it++) = getOmCH2();
        *(it++) = getH();
        *(it++) = getTau();

        for(int i = 1; i < kVals_.size() - 1; ++i)
        {
            check(it < v.end(), "");
            *(it++) = std::log(kVals_[i]);
        }

        for(int i = 0; i < amplitudes_.size(); ++i)
        {
            check(it < v.end(), "");
            *(it++) = std::log(amplitudes_[i] * 1e10);
        }

        check(it == v.end(), "");
    }
    virtual void getAllParameters(std::vector<double>& v) const
    {
        int nPar = 6;

        if(varyNEff_)
            ++nPar;
        if(varySumMNu_)
            ++nPar;

        v.resize(nPar);

        std::vector<double>::iterator it = v.begin();
        *(it++) = getOmBH2();
        *(it++) = getOmCH2();
        *(it++) = getH();
        *(it++) = getTau();
        *(it++) = getNs();
        *(it++) = std::log(getAs()*1e10);

        if(varyNEff_)
            *(it++) = nEff_;

        if(varySumMNu_)
            *(it++) = sumMNu_;

        check(it == v.end(), "");
    }
Ejemplo n.º 3
0
bool
VehicleType::handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper) {
    switch (variable) {
        case TRACI_ID_LIST:
            return wrapper->wrapStringList(objID, variable, getIDList());
        case ID_COUNT:
            return wrapper->wrapInt(objID, variable, getIDCount());
        case VAR_LENGTH:
            return wrapper->wrapDouble(objID, variable, getLength(objID));
        case VAR_HEIGHT:
            return wrapper->wrapDouble(objID, variable, getHeight(objID));
        case VAR_MINGAP:
            return wrapper->wrapDouble(objID, variable, getMinGap(objID));
        case VAR_MAXSPEED:
            return wrapper->wrapDouble(objID, variable, getMaxSpeed(objID));
        case VAR_ACCEL:
            return wrapper->wrapDouble(objID, variable, getAccel(objID));
        case VAR_DECEL:
            return wrapper->wrapDouble(objID, variable, getDecel(objID));
        case VAR_EMERGENCY_DECEL:
            return wrapper->wrapDouble(objID, variable, getEmergencyDecel(objID));
        case VAR_APPARENT_DECEL:
            return wrapper->wrapDouble(objID, variable, getApparentDecel(objID));
        case VAR_ACTIONSTEPLENGTH:
            return wrapper->wrapDouble(objID, variable, getActionStepLength(objID));
        case VAR_IMPERFECTION:
            return wrapper->wrapDouble(objID, variable, getImperfection(objID));
        case VAR_TAU:
            return wrapper->wrapDouble(objID, variable, getTau(objID));
        case VAR_SPEED_FACTOR:
            return wrapper->wrapDouble(objID, variable, getSpeedFactor(objID));
        case VAR_SPEED_DEVIATION:
            return wrapper->wrapDouble(objID, variable, getSpeedDeviation(objID));
        case VAR_VEHICLECLASS:
            return wrapper->wrapString(objID, variable, getVehicleClass(objID));
        case VAR_EMISSIONCLASS:
            return wrapper->wrapString(objID, variable, getEmissionClass(objID));
        case VAR_SHAPECLASS:
            return wrapper->wrapString(objID, variable, getShapeClass(objID));
        case VAR_WIDTH:
            return wrapper->wrapDouble(objID, variable, getWidth(objID));
        case VAR_COLOR:
            return wrapper->wrapColor(objID, variable, getColor(objID));
        case VAR_MINGAP_LAT:
            return wrapper->wrapDouble(objID, variable, getMinGapLat(objID));
        case VAR_MAXSPEED_LAT:
            return wrapper->wrapDouble(objID, variable, getMaxSpeedLat(objID));
        case VAR_LATALIGNMENT:
            return wrapper->wrapString(objID, variable, getLateralAlignment(objID));
        case VAR_PERSON_CAPACITY:
            return wrapper->wrapInt(objID, variable, getPersonCapacity(objID));
        default:
            return false;
    }
}
Ejemplo n.º 4
0
Archivo: CMesh.cpp Proyecto: MADAI/RHIC
double CMesh::getDULocal(int eta, int x, int y, int u, int v){
	if (v==1) 
		return (getS(eta,x+1,y,u) - getS(eta,x-1,y,u))/(getX(eta,x+1,y,v) - getX(eta,x-1,y,v));
	if (v==2) 
		return (getS(eta,x,y+1,u) - getS(eta,x,y-1,u))/(getX(eta,x,y+1,v) - getX(eta,x,y-1,v));
	if (v==3) 
		return getU0(eta,x,y)/getTau() 
		+ (getS(eta+1,x,y,u) - getS(eta-1,x,y,u))/(getX(eta+1,x,y,v) - getX(eta-1,x,y,v));
	
	return 0.;
}
 virtual void getAllParameters(std::vector<double>& v) const
 { 
     v.resize(8);
     v[0] = getOmBH2();
     v[1] = getOmCH2();
     v[2] = getH();
     v[3] = getTau();
     v[4] = getNs();
     v[5] = std::log(getAs() * 1e10);
     v[6] = getNEff();
     v[7] = getSumMNu();
 }
Ejemplo n.º 6
0
Archivo: CMesh.cpp Proyecto: MADAI/RHIC
void CMesh::calcIntegrals(){
	intS  = 0.; intE  = 0.;	intEp = 0.;	intEx = 0.;	intVr = 0.;
	
	double intEpD = 0., intExD = 0., intVrD = 0.;
	
	list<CCell*>::iterator it, end;
	for ( it=activeCells.begin(), end=activeCells.end(); it != end; ++it) {
		
		double fact=1.;
		for (int i=0;i<3;i++)
			for (int j=0;j<2;j++)
				if ( !(*it)->getNeighbor(i,j)->getActive()) 
					fact *= 0.5;
		
		(*it)->selfUpdate();
		
		intS   += fact * (*it)->getU0() * (*it)->getS();
		intE   += fact * (*it)->getTxy(0,0);
		intEp  += fact * ((*it)->getTxy(1,1) - (*it)->getTxy(2,2));
		intEpD += fact * ((*it)->getTxy(1,1) + (*it)->getTxy(2,2));
		intEx  += fact * ( pow((*it)->getX(2),2) - pow((*it)->getX(1),2)) * (*it)->getE();
		intExD += fact * ( pow((*it)->getX(2),2) + pow((*it)->getX(1),2)) * (*it)->getE();
		intVr  += fact * (*it)->getE() * (*it)->getGammaTrans() * (*it)->getVr();
		intVrD += fact * (*it)->getE() * (*it)->getGammaTrans();
	}
	
	if (mBjorken) {
		intS *= getTau()*mDx*mDy*mDn;
		intE *= getTau()*mDx*mDy*mDn;
	}
	else {
		intS *= mDx*mDy*mDn;
		intE *= mDx*mDy*mDn;
	}
	
	intEp /= intEpD;
	intEx /= intExD;
	intVr /= intVrD;
}
Ejemplo n.º 7
0
Archivo: CMesh.cpp Proyecto: MADAI/RHIC
bool CMesh::detectCrash(){
	list<CCell*>::iterator it, end;
	for ( it=activeCells.begin(), end=activeCells.end(); it != end; ++it)
		for (int l=0;l<11;l++) 
			if ( (*it)->getS(l) != (*it)->getS(l)) {
				printf("\n\ncrash cell (t=%0.6g) : n=%g x=%g y=%g \n",
					   getTau(),(*it)->getX(3),(*it)->getX(1),(*it)->getX(2));
				(*it)->print();		
				return false;
			}
	
	return true;
}
 virtual void getAllParameters(std::vector<double>& v) const
 {
     v.resize(5);
     v[0] = getOmBH2();
     v[1] = getOmCH2();
     v[2] = getH();
     v[3] = getTau();
     // kmin and kmax are fixed so don't return these
     v[4] = std::log(amplitudes_[0] * 1e10);
     for(int i = 1; i < kVals_.size() - 1; ++i)
     {
         v.push_back(std::log(kVals_[i]));
         v.push_back(std::log(amplitudes_[i] * 1e10));
     }
     v.push_back(std::log(amplitudes_[amplitudes_.size() - 1] * 1e10));
 }
Ejemplo n.º 9
0
Archivo: CMesh.cpp Proyecto: MADAI/RHIC
void CMesh::calcLossIntegrals(){
	
	double tempE[3]; tempE[0]=0.; tempE[1]=0.; tempE[2]=0.;
	double tempS[3]; tempS[0]=0.; tempS[1]=0.; tempS[2]=0.;
	
	double mTau = getTau();
	double temp = 0.;
	
	eLoss = 0.; sLoss = 0.;
	
	list<CCell*>::iterator it, end;
	for ( it=activeCells.begin(), end=activeCells.end(); it != end; ++it) {
		
		double fact=1.;
		for (int i=0;i<3;i++)
			for (int j=0;j<2;j++)
				if ( !(*it)->getNeighbor(i,j)->getActive()) 
					fact *= 0.5;
					
		temp += fact * (*it)->getTxyCalc(3,3);
		
		if (fact < 1.0) {
			for (int i=0;i<3;i++)
				for (int j=0;j<2;j++)
					if ( !(*it)->getNeighbor(i,j)->getActive()) {
						tempE[i] += fact * (*it)->getTxy(0,i);
						tempS[i] += fact * (*it)->getS() * (*it)->getS(i);
					}
		}
	}
	
	if (mBjorken)
		eLoss = mTau*mTau*mDx*mDy*mDn*temp;
	else 
		eLoss = mDx*mDy*mDn*temp;
	
	if (mBjorken){
		eLoss += mTau*(mDx*mDy*tempE[2] + mDx*mDn*tempE[1] + mDy*mDn*tempE[0]);
		sLoss += mTau*(mDx*mDy*tempS[2] + mDx*mDn*tempS[1] + mDy*mDn*tempS[0]);
	}
	else {
		eLoss += mDx*mDy*tempE[2] + mDx*mDn*tempE[1] + mDy*mDn*tempE[0];
		sLoss += mDx*mDy*tempS[2] + mDx*mDn*tempS[1] + mDy*mDn*tempS[0];
	}
	
}
Ejemplo n.º 10
0
//------------------------------------------------------------------------------
// serialize() -- print the value of this object to the output stream sout.
//------------------------------------------------------------------------------
std::ostream& LagFilter::serialize(std::ostream& sout, const int i, const bool slotsOnly) const
{
    int j = 0;
    if ( !slotsOnly ) {
        sout << "( " << getFactoryName() << std::endl;
        j = 4;
    }

    BaseClass::serialize(sout,i+j,true);

    indent(sout,i+j);
    sout << "tau:   " << getTau() << std::endl;

    if ( !slotsOnly ) {
        indent(sout,i);
        sout << ")" << std::endl;
    }

    return sout;
}
Ejemplo n.º 11
0
double scoreOfEllipse(Line *line, CvBox2D ellipse) {
//	printf("%f, %f, %d\n", getEpsilon(line, ellipse), getTau(ellipse), getPhi(line, ellipse));
	double score = pow(getEpsilon(line, ellipse), 2) * exp(abs(1-getTau(ellipse))) / pow(getPhi(line, ellipse), 2);
//	printf("score : %f\n", score);
	return score;
}