Пример #1
0
Foam::tmp<Foam::volScalarField>
Foam::populationBalanceSubModels::growthModels::constantGrowth::Kg
(
    const volScalarField& abscissa
) const
{   
    dimensionedScalar minAbs
    (
        "minAbs", 
        abscissa.dimensions(), 
        minAbscissa_.value()
    );

    dimensionedScalar maxAbs
    (
        "maxAbs", 
        abscissa.dimensions(), 
        maxAbscissa_.value()
    );

    dimensionedScalar CgND
    (
        "CgND", 
        inv(abscissa.dimensions())*inv(abscissa.dimensions())*Cg_.dimensions(), 
        Cg_.value()
    );

    return CgND*pos(-abscissa+maxAbs)*pos(abscissa-minAbs);
}
Пример #2
0
Foam::tmp<Foam::volScalarField>
Foam::populationBalanceSubModels::breakupKernels::exponentialBreakup::Kb
(
    const volScalarField& abscissa
) const
{
    dimensionedScalar minAbs
    (
        "minAbs",
        abscissa.dimensions(),
        minAbscissa_.value()
    );

    return Cb_*pos(abscissa - minAbs)*exp(expCoeff_*pow3(abscissa));
}
Пример #3
0
//----------------------------------------------------------------------
// test absolute value
//----------------------------------------------------------------------
TEST_F(lfpTest, Absolute) {
	for (size_t idx=0; idx < addsub_cnt; ++idx) {
		LFP op1(addsub_tab[idx][0].h, addsub_tab[idx][0].l);
		LFP op2(op1.abs());

		ASSERT_TRUE(op2.signum() >= 0);

		if (op1.signum() >= 0)
			op1 -= op2;
		else
			op1 += op2;
		ASSERT_EQ(LFP(0,0), op1);
	}

	// There is one special case we have to check: the minimum
	// value cannot be negated, or, to be more precise, the
	// negation reproduces the original pattern.
	LFP minVal(0x80000000, 0x00000000);
	LFP minAbs(minVal.abs());
	ASSERT_EQ(-1, minVal.signum());
	ASSERT_EQ(minVal, minAbs);
}
Пример #4
0
void Main()
{
	glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);	
	glColor3f(1.0f, 1.0f, 1.0f);
	APP->Print(.7f, .9f, "FPS: %4.2f", APP->GetFPS());
	APP->Print(.7f, .8f, "Cubes: %d", vCubes.size());
	APP->Print(.7f, .7f, "Active: %d", i_ActiveCube);
	APP->Print(-1.f, .9f, "Position: %.2lf %.2lf %.2lf", g_Camera.m_vPosition.x, g_Camera.m_vPosition.y, g_Camera.m_vPosition.z);
	APP->Print(-1.f, .8f, "View: %.2lf %.2lf %.2lf", g_Camera.m_vView.x, g_Camera.m_vView.y, g_Camera.m_vView.z);
	APP->Print(-1.f, .7f, "Up: %.2lf %.2lf %.2lf", g_Camera.m_vUpVector.x, g_Camera.m_vUpVector.y, g_Camera.m_vUpVector.z);

	APP->Print(-1.f, .6f, "CameraRot: %.2lf", g_Camera.curRotY);
	if (APP->GetSet()->network)
		APP->Print(-1.f, .5f, "IP: %s", APP->GetSet()->ip_server);
	else
		APP->Print(-1.f, .5f, "IP: no");

	glLoadIdentity();

	EventKeysDown();

	if (i_ActiveCube >= 0 && i_ActiveCube < (int)vCubes.size())
	{
		if (changeActiveCube)
		{
			CVector3 vec = vCubes[i_ActiveCube]->GetCenter() - g_Camera.m_vView;

			float angle = vCubes[i_ActiveCube]->angleRotY - g_Camera.curRotY;
			if (g_Camera.curRotY > 0.0f && vCubes[i_ActiveCube]->angleRotY < 0.0f)
			{
				angle = minAbs(angle, 2.0f * Pi + vCubes[i_ActiveCube]->angleRotY - g_Camera.curRotY);
			}
			else if (g_Camera.curRotY < 0.0f && vCubes[i_ActiveCube]->angleRotY > 0.0f)
			{
				angle = minAbs(angle, -2.0f * Pi + vCubes[i_ActiveCube]->angleRotY - g_Camera.curRotY);
			}

			if (vec.Magnitude() <= 2.0f * MOVEMENT_SPEED)
			{
				if (abs(angle) <= MOVEMENT_ANGLE)
				{
					g_Camera.m_vView = vCubes[i_ActiveCube]->GetCenter();
					g_Camera.RotateAroundPoint(g_Camera.m_vView, angle, 0.0f, 1.0f, 0.0f);
					changeActiveCube = false;
				}
				else
				{
					if (angle > 0)
						g_Camera.RotateAroundPoint(g_Camera.m_vView, MOVEMENT_ANGLE, 0.0f, 1.0f, 0.0f);
					else
						g_Camera.RotateAroundPoint(g_Camera.m_vView, -MOVEMENT_ANGLE, 0.0f, 1.0f, 0.0f);
				}
			}
			else
			{
				float k = vec.Magnitude() / (2.0f * MOVEMENT_SPEED);

				if (k > 0.1f)
					g_Camera.RotateAroundPoint(g_Camera.m_vView, angle / k, 0.0f, 1.0f, 0.0f);

				vec.Normalize();
				vec *= 2.0f * MOVEMENT_SPEED;
				g_Camera.m_vView += vec;
				g_Camera.m_vPosition += vec;
			}
		}
		else
		{
			g_Camera.SetViewByMouse();

			vCubes[i_ActiveCube]->Set(g_Camera.m_vView.x, 0.0f, g_Camera.m_vView.z);
			vCubes[i_ActiveCube]->angleRotY = g_Camera.curRotY;
		}
	}

	gluLookAt(g_Camera.m_vPosition.x, g_Camera.m_vPosition.y, g_Camera.m_vPosition.z,
		g_Camera.m_vView.x,	  g_Camera.m_vView.y,	  g_Camera.m_vView.z,
		g_Camera.m_vUpVector.x, g_Camera.m_vUpVector.y, g_Camera.m_vUpVector.z);

	for (size_t i = 0; i < vCubes.size(); i++)
	{
		vCubes[i]->Render();
	}
}