本文整理汇总了C++中Interaction::number方法的典型用法代码示例。如果您正苦于以下问题:C++ Interaction::number方法的具体用法?C++ Interaction::number怎么用?C++ Interaction::number使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Interaction
的用法示例。
在下文中一共展示了Interaction::number方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: contactPointProcess
void contactPointProcess(SiconosVector& answer,
const Interaction& inter,
const T& rel)
{
answer.resize(14);
const SiconosVector& posa = *rel.pc1();
const SiconosVector& posb = *rel.pc2();
const SiconosVector& nc = *rel.nc();
const SimpleMatrix& jachqT = *rel.jachqT();
double id = inter.number();
double mu = ask<ForMu>(*inter.nslaw());
SiconosVector cf(jachqT.size(1));
prod(*inter.lambda(1), jachqT, cf, true);
answer.setValue(0, mu);
DEBUG_PRINTF("posa(0)=%g\n", posa(0));
DEBUG_PRINTF("posa(1)=%g\n", posa(1));
DEBUG_PRINTF("posa(2)=%g\n", posa(2));
answer.setValue(1, posa(0));
answer.setValue(2, posa(1));
answer.setValue(3, posa(2));
answer.setValue(4, posb(0));
answer.setValue(5, posb(1));
answer.setValue(6, posb(2));
answer.setValue(7, nc(0));
answer.setValue(8, nc(1));
answer.setValue(9, nc(2));
answer.setValue(10, cf(0));
answer.setValue(11, cf(1));
answer.setValue(12, cf(2));
answer.setValue(13, id);
};
示例2: assert
void D1MinusLinearOSI::initializeWorkVectorsForInteraction(Interaction &inter,
InteractionProperties& interProp,
DynamicalSystemsGraph & DSG)
{
DEBUG_BEGIN("D1MinusLinearOSI::initializeWorkVectorsForInteraction(Interaction &inter, InteractionProperties& interProp, DynamicalSystemsGraph & DSG)\n");
SP::DynamicalSystem ds1= interProp.source;
SP::DynamicalSystem ds2= interProp.target;
assert(ds1);
assert(ds2);
DEBUG_PRINTF("interaction number %i\n", inter.number());
VectorOfBlockVectors& DSlink = inter.linkToDSVariables();
if (!interProp.workVectors)
{
interProp.workVectors.reset(new VectorOfVectors);
interProp.workVectors->resize(D1MinusLinearOSI::WORK_INTERACTION_LENGTH);
}
if (!interProp.workBlockVectors)
{
interProp.workBlockVectors.reset(new VectorOfBlockVectors);
interProp.workBlockVectors->resize(D1MinusLinearOSI::BLOCK_WORK_LENGTH);
}
VectorOfVectors& inter_work = *interProp.workVectors;
VectorOfBlockVectors& inter_work_block = *interProp.workBlockVectors;
Relation &relation = *inter.relation();
RELATION::TYPES relationType = relation.getType();
inter_work[D1MinusLinearOSI::OSNSP_RHS].reset(new SiconosVector(inter.dimension()));
// Check if interations levels (i.e. y and lambda sizes) are compliant with the current osi.
_check_and_update_interaction_levels(inter);
// Initialize/allocate memory buffers in interaction.
inter.initializeMemory(_steps);
if (!(checkOSI(DSG.descriptor(ds1)) && checkOSI(DSG.descriptor(ds2))))
{
std::cout << "checkOSI(DSG.descriptor(ds1)): "
<< std::boolalpha
<< checkOSI(DSG.descriptor(ds1)) << std::endl;
std::cout << "checkOSI(DSG.descriptor(ds2)): "
<< std::boolalpha
<< checkOSI(DSG.descriptor(ds2)) << std::endl;
RuntimeException::selfThrow("D1MinusLinearOSI::initializeWorkVectorsForInteraction. The implementation is not correct for two different OSI for one interaction");
}
/* allocate and set work vectors for the osi */
unsigned int xfree = D1MinusLinearOSI::xfree;
DEBUG_PRINTF("ds1->number() %i\n",ds1->number());
DEBUG_PRINTF("ds2->number() %i\n",ds2->number());
if (ds1 != ds2)
{
DEBUG_PRINT("ds1 != ds2\n");
if ((!inter_work_block[xfree]) || (inter_work_block[xfree]->numberOfBlocks() !=2 ))
inter_work_block[xfree].reset(new BlockVector(2));
}
else
{
if ((!inter_work_block[xfree]) || (inter_work_block[xfree]->numberOfBlocks() !=1 ))
inter_work_block[xfree].reset(new BlockVector(1));
}
if(checkOSI(DSG.descriptor(ds1)))
{
DEBUG_PRINTF("ds1->number() %i is taken into account\n", ds1->number());
assert(DSG.properties(DSG.descriptor(ds1)).workVectors);
VectorOfVectors &workVds1 = *DSG.properties(DSG.descriptor(ds1)).workVectors;
inter_work_block[xfree]->setVectorPtr(0,workVds1[D1MinusLinearOSI::FREE]);
}
if (ds1 != ds2)
{
DEBUG_PRINT("ds1 != ds2\n");
if(checkOSI(DSG.descriptor(ds2)))
{
DEBUG_PRINTF("ds2->number() %i is taken into account\n",ds2->number());
assert(DSG.properties(DSG.descriptor(ds2)).workVectors);
VectorOfVectors &workVds2 = *DSG.properties(DSG.descriptor(ds2)).workVectors;
inter_work_block[xfree]->setVectorPtr(1,workVds2[D1MinusLinearOSI::FREE]);
}
}
DEBUG_EXPR(inter_work_block[xfree]->display(););