Пример #1
0
void Peer::ros2(double * y, double& tstart, double tend, IContinuous *continuousSystem, ITime *timeSystem) {
    double *T=new double[_dimSys*_dimSys];
    double *D=new double[_dimSys];
    double *k1=new double[_dimSys];
    double *k2=new double[_dimSys];
    long int *P=new long int[_dimSys];
    long int info;
    long int dim=1;
    double t=tstart;
    const double gamma=1.-sqrt(2.)/2.;
    char trans='N';
    double hu=(tend-tstart)/10.;
    for(int count=0; count<10; ++count) {
        evalJ(t,y,T,continuousSystem, timeSystem,-hu*gamma);
        for(int i=0; i<_dimSys;++ i) T[i*_dimSys+i]+=1.;
        dgetrf_(&_dimSys, &_dimSys, T, &_dimSys, P, &info);
        evalF(t,y,k1,continuousSystem, timeSystem);
        evalD(t,y,D,continuousSystem, timeSystem);
        for(int i=0; i<_dimSys;++ i) k1[i]+=gamma*hu*D[i];
        dgetrs_(&trans, &_dimSys, &dim, T, &_dimSys, P, k1, &_dimSys, &info);
        for(int i=0; i<_dimSys;++ i) y[i]+=hu*k1[i];
        evalF(t,y,k2,continuousSystem, timeSystem);
        for(int i=0; i<_dimSys;++ i)  k2[i]+= hu*gamma*D[i]-2.*k1[i];
        dgetrs_(&trans, &_dimSys, &dim, T, &_dimSys, P, k2, &_dimSys, &info);
        for(int i=0; i<_dimSys;++ i) y[i]+=0.5*hu*(k1[i]+k2[i]);
    }
}
Пример #2
0
	uint8_t readB(){
		switch (type){
			case A_BYTE: return  evalB();
			case A_UINT: return  evalU();
			case A_INT: return  evalI();
			case A_LONG: return  evalL();
			case A_FLOAT: return  evalF();
			case A_DOUBLE: return  evalD();
			case A_TIME: return  evalT();
			default: return 0;
		}
		return 0;
	}
Пример #3
0
	uint32_t readT(){
		switch (type){
			case A_BYTE: return  evalB();
			case A_UINT: return  evalU();
			case A_INT: return  evalI();
			case A_LONG: return  evalL();
			case A_FLOAT: return  evalF();
			case A_DOUBLE: return  evalD();
			case A_TIME: return  evalT();
			case A_STRING: return 0;
			case BAD_TYPE: return 0;
		}
		return 0;
	}