本文整理汇总了C++中Interaction::y方法的典型用法代码示例。如果您正苦于以下问题:C++ Interaction::y方法的具体用法?C++ Interaction::y怎么用?C++ Interaction::y使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Interaction
的用法示例。
在下文中一共展示了Interaction::y方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeOutput
void LagrangianCompliantR::computeOutput(double time, Interaction& inter, InteractionProperties& interProp, unsigned int derivativeNumber)
{
VectorOfBlockVectors& DSlink = *interProp.DSlink;
SiconosVector workZ = *DSlink[LagrangianR::z];
if (derivativeNumber == 0)
{
SiconosVector& y = *inter.y(0);
SiconosVector& lambda = *inter.lambda(0);
SiconosVector workQ = *DSlink[LagrangianR::q0];
computeh(time, workQ, lambda, workZ, y);
}
else
{
SiconosVector& y = *inter.y(derivativeNumber);
SiconosVector& lambda = *inter.lambda(derivativeNumber);
SiconosVector workQ = *DSlink[LagrangianR::q0];
computeJachq(time, workQ, lambda, workZ);
computeJachlambda(time, workQ, lambda, workZ);
if (derivativeNumber == 1)
{
// y = Jach[0] q1 + Jach[1] lambda
prod(*_jachq, *DSlink[LagrangianR::q1], y);
prod(*_jachlambda, lambda, y, false);
}
else if (derivativeNumber == 2)
prod(*_jachq, *DSlink[LagrangianR::q2], y); // Approx: y[2] = Jach[0]q[2], other terms are neglected ...
else
RuntimeException::selfThrow("LagrangianCompliantR::computeOutput, index out of range or not yet implemented.");
}
*DSlink[LagrangianR::z] = workZ;
}
示例2: computeOutput
void LagrangianRheonomousR::computeOutput(double time, Interaction& inter, InteractionProperties& interProp, unsigned int derivativeNumber)
{
VectorOfBlockVectors& DSlink = *interProp.DSlink;
SiconosVector q = *DSlink[LagrangianR::q0];
SiconosVector z = *DSlink[LagrangianR::z];
SiconosVector& y = *inter.y(derivativeNumber);
if (derivativeNumber == 0)
computeh(time, q, z, y);
else
{
computeJachq(time, q, z);
if (derivativeNumber == 1)
{
// Computation of the partial derivative w.r.t time of h(q,t)
computehDot(time, q, z);
// Computation of the partial derivative w.r.t q of h(q,t) : \nabla_q h(q,t) \dot q
prod(*_jachq, *DSlink[LagrangianR::q1], y);
// Sum of the terms
y += *_hDot;
}
else if (derivativeNumber == 2)
prod(*_jachq, *DSlink[LagrangianR::q2], y); // Approx:, ...
// \warning : the computation of y[2] (in event-driven
// simulation for instance) is approximated by y[2] =
// Jach[0]q[2]. For the moment, other terms are neglected
// (especially, partial derivatives with respect to time).
else
RuntimeException::selfThrow("LagrangianRheonomousR::computeOutput(double time, Interaction& inter, InteractionProperties& interProp, unsigned int derivativeNumber) index >2 not yet implemented.");
}
*DSlink[LagrangianR::z] = z;
}
示例3: computeOutput
void NewtonEulerR::computeOutput(double time, Interaction& inter, unsigned int derivativeNumber)
{
DEBUG_BEGIN("NewtonEulerR::computeOutput(...)\n");
DEBUG_PRINTF("with time = %f and derivativeNumber = %i starts\n", time, derivativeNumber);
VectorOfBlockVectors& DSlink = inter.linkToDSVariables();
SiconosVector& y = *inter.y(derivativeNumber);
BlockVector& q = *DSlink[NewtonEulerR::q0];
if (derivativeNumber == 0)
{
computeh(time, q, y);
}
else
{
/* \warning V.A. 15/04/2016
* We decide finally not to update the Jacobian there. To be discussed
*/
// computeJachq(time, inter, DSlink[NewtonEulerR::q0]);
// computeJachqT(inter, DSlink[NewtonEulerR::q0]);
if (derivativeNumber == 1)
{
assert(_jachqT);
assert(DSlink[NewtonEulerR::velocity]);
DEBUG_EXPR(_jachqT->display();); DEBUG_EXPR((*DSlink[NewtonEulerR::velocity]).display(););
示例4: computeOutput
virtual void computeOutput(double t, Interaction& inter, InteractionProperties& interProp, unsigned int derivativeNumber)
{
VectorOfBlockVectors& DSlink = *interProp.DSlink;
if (derivativeNumber == 0)
{
computeh(t, *DSlink[NewtonEulerR::q0], *inter.y(0));
}
else
{
R_CLASS::computeOutput(t, inter, interProp, derivativeNumber);
}
}
示例5: computeOutput
void FirstOrderLinearR::computeOutput(double time, Interaction& inter, InteractionProperties& interProp, unsigned int level)
{
VectorOfBlockVectors& DSlink = *interProp.DSlink;
VectorOfVectors& workV = *interProp.workVectors;
VectorOfSMatrices& workM = *interProp.workMatrices;
SiconosVector& z = *workV[FirstOrderR::vec_z];
z = *DSlink[FirstOrderR::z];
// We get y and lambda of the interaction (pointers)
SiconosVector& y = *inter.y(0);
SiconosVector& lambda = *inter.lambda(0);
computeh(time, workV, workM, *DSlink[FirstOrderR::x], lambda, z, y);
*DSlink[FirstOrderR::z] = z;
}
示例6: computeh
void FirstOrderType1R::computeOutput(double time, Interaction& inter, InteractionProperties& interProp, unsigned int level)
{
SiconosVector& y = *inter.y(0);
// Warning: temporary method to have contiguous values in memory, copy of block to simple.
VectorOfBlockVectors& DSlink = *interProp.DSlink;
VectorOfVectors& workV = *interProp.workVectors;
SiconosVector& workX = *workV[FirstOrderR::vec_x];
workX = *DSlink[FirstOrderR::x];
SiconosVector& workZ = *workV[FirstOrderR::vec_z];
workZ = *DSlink[FirstOrderR::z];
computeh(time, workX, workZ, y);
*DSlink[FirstOrderR::z] = workZ;
}
示例7: computeOutput
void FirstOrderLinearR::computeOutput(double time, Interaction& inter, unsigned int level)
{
DEBUG_BEGIN("FirstOrderLinearR::computeOutput \n");
VectorOfBlockVectors& DSlink = inter.linkToDSVariables();
BlockVector& z = *DSlink[FirstOrderR::z];
BlockVector& x = *DSlink[FirstOrderR::x];
SP::SiconosVector z_vec(new SiconosVector(z));
SiconosVector& y = *inter.y(level);
SiconosVector& lambda = *inter.lambda(level);
computeh(time, x, lambda, *z_vec, y);
*DSlink[FirstOrderR::z] = *z_vec;
DEBUG_END("FirstOrderLinearR::computeOutput \n");
}
示例8: computeOutput
void LagrangianLinearTIR::computeOutput(double time, Interaction& inter, InteractionProperties& interProp, unsigned int derivativeNumber)
{
// get y and lambda of the interaction
SiconosVector& y = *inter.y(derivativeNumber);
VectorOfBlockVectors& DSlink = *interProp.DSlink;
prod(*_jachq, *DSlink[LagrangianR::q0 + derivativeNumber], y);
if (derivativeNumber == 0)
{
if (_e)
y += *_e;
if (_F)
prod(*_F, *DSlink[LagrangianR::z], y, false);
}
if (_jachlambda)
{
SiconosVector& lambda = *inter.lambda(derivativeNumber);
prod(*_jachlambda, lambda, y, false);
}
}