Beispiel #1
0
void BreckerStrategy::Calc(EndListRef &jun,GasProperty &gas,double dCdAIn,double dCdAOut)
{   
	double dPress = 0;
	double dGasFlow = 0;
	double dSc = jun.Sc();
	double dSb = jun.Sb(); 
	if(gas.GasPress() > dSc/dSb)
	{//流入
		dPress = SonicInPress(jun,gas,dCdAIn);
		if(dPress/gas.GasPress()<=0.53)
		{
			dGasFlow = gas.Sonicin(dCdAIn);
		}
		else
		{
			dPress = SubsonicInPress(jun,gas,dCdAIn);
			dGasFlow = gas.SubSonicin(dCdAIn,dPress);
		}
	}
	else
	{
		dPress = SonicOutPress(jun,gas,dCdAOut);
		if(dPress/gas.GasPress()>=(1/0.53))
		{
			dGasFlow = gas.SonicOut(dCdAOut,dPress);
		}
		else
		{
			dPress = SubsonicOutPress(jun,gas,dCdAOut);
			dGasFlow = gas.SubSonicOut(dCdAOut,dPress);
		}
	}
	UpData(jun,gas,dGasFlow,dPress);
}
Beispiel #2
0
int main()
{
#ifdef onlinejudge
    freopen("D:\\poj3468.txt", "r", stdin);
    freopen("D:\\poj3468_ans.txt", "w", stdout);
#endif

    scanf("%d %d", &n, &mNum);
    
    BuildTree(1, n, 1);
    for (int i=1; i<=mNum; ++i)
    {
        scanf("%s", cmd);
        if (cmd[0] == 'Q')
        {   /* Query */
            scanf("%d %d", &a, &b);
            printf("%I64d\n", Query(a, b, 1, n, 1));
        }
        else
        {   /* Add */
            scanf("%d %d %d", &a, &b, &c);
            UpData(a, b, c, 1, n, 1);
        }
    }/* End of For */
    
    return 0;
}
Beispiel #3
0
void DrawJunTool::DownClick(UINT nFlags, CPoint point)
{
	Component *pComponent = NULL;
	Jun *pJun = NULL;
	pComponent = m_pManager->CreatComponent(m_nID);
	if(pComponent != NULL)
	{
		pJun = dynamic_cast<Jun*>(pComponent);
		UpData(pJun,point);
	}
}
Beispiel #4
0
void UpData(int L, int R, int c, int l, int r, int rt)
{
    if (L<=l && r<=R)
    {
        col[rt] += c;
        sum[rt] += c*(r-l+1);
        
        return ;
    }/* End of If */

    PushDown(rt, r-l+1);    /* Push down */

    int m = (l+r)>>1;

    if (L <= m)
        UpData(L, R, c, lson);
    if (R > m)
        UpData(L, R, c, rson);
    sum[rt] = sum[rt<<1] + sum[rt<<1|1];    /* Push Up */
}/* UpData */
Beispiel #5
0
void DrawPipeTool::UpClick(UINT nFlags, CPoint point)
{
	long a = point.x - m_downPt.x;
	long b = point.y - m_downPt.y;
	long c = sqrt( double(a*a + b*b) );
	if(c > 16)
	{
		Component *pComponent = NULL;
		Pipe *pPipe = NULL;
		pComponent = m_pManager->CreatComponent(m_nID);
		if(pComponent != NULL)
		{
			pPipe = dynamic_cast<Pipe*>(pComponent);
			UpData(pPipe,point);
		}	
	}
}