本文整理汇总了C++中sp::DynamicalSystem::allocateWorkVector方法的典型用法代码示例。如果您正苦于以下问题:C++ DynamicalSystem::allocateWorkVector方法的具体用法?C++ DynamicalSystem::allocateWorkVector怎么用?C++ DynamicalSystem::allocateWorkVector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sp::DynamicalSystem
的用法示例。
在下文中一共展示了DynamicalSystem::allocateWorkVector方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
void SchatzmanPaoliOSI::initialize(Model& m)
{
OneStepIntegrator::initialize(m);
// Get initial time
double t0 = _simulation->startingTime();
// Compute W(t0) for all ds
DynamicalSystemsGraph::VIterator dsi, dsend;
for (std11::tie(dsi, dsend) = _dynamicalSystemsGraph->vertices(); dsi != dsend; ++dsi)
{
if (!checkOSI(dsi)) continue;
SP::DynamicalSystem ds = _dynamicalSystemsGraph->bundle(*dsi);
Type::Siconos dsType = Type::value(*ds);
if (dsType == Type::LagrangianLinearTIDS)
{
// Computation of the first step for starting
SP::LagrangianLinearTIDS d = std11::static_pointer_cast<LagrangianLinearTIDS> (ds);
SP::SiconosVector q0 = d->q0();
SP::SiconosVector q = d->q();
SP::SiconosVector v0 = d->velocity0();
SP::SiconosVector velocity = d->velocity();
// std::cout << " q0 = " << std::endl;
// q0->display();
// std::cout << " v0 = " << std::endl;
// v0->display();
// We first swap the initial value contained in q and v after initialization.
d->qMemory()->swap(*q);
d->velocityMemory()->swap(*velocity);
// we compute the new state values
double h = _simulation->timeStep();
*q = *q0 + h* * v0;
//*velocity=*velocity; we do nothing for the velocity
// This value will swapped when OneStepIntegrator::saveInMemory will be called
// by the rest of Simulation::initialize (_eventsManager->preUpdate();)
// SP::SiconosVector qprev = d->qMemory()->getSiconosVector(0);
// SP::SiconosVector qprev2 = d->qMemory()->getSiconosVector(1);
// SP::SiconosVector vprev = d->velocityMemory()->getSiconosVector(0);
// std::cout << " qprev = " << std::endl;
// qprev->display();
// std::cout << " qprev2 = " << std::endl;
// qprev2->display();
// std::cout << " vprev = " << std::endl;
// vprev->display();
}
// Memory allocation for workX. workX[ds*] corresponds to xfree (or vfree in lagrangian case).
// workX[*itDS].reset(new SiconosVector((*itDS)->dimension()));
// W initialization
initW(t0, ds, *dsi);
// if ((*itDS)->getType() == Type::LagrangianDS || (*itDS)->getType() == Type::FirstOrderNonLinearDS)
ds->allocateWorkVector(DynamicalSystem::local_buffer,_dynamicalSystemsGraph->properties(*dsi).W->size(0));
}
}