本文整理汇总了C++中sp::DynamicalSystem::initialize方法的典型用法代码示例。如果您正苦于以下问题:C++ DynamicalSystem::initialize方法的具体用法?C++ DynamicalSystem::initialize怎么用?C++ DynamicalSystem::initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sp::DynamicalSystem
的用法示例。
在下文中一共展示了DynamicalSystem::initialize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
void Simulation::initialize(SP::Model m, bool withOSI)
{
// === Connection with the model ===
assert(m && "Simulation::initialize(model) - model = NULL.");
_T = m->finalT();
_nsds = m->nonSmoothDynamicalSystem();
// === Events manager initialization ===
_eventsManager->initialize(_T);
_tinit = _eventsManager->startingTime();
//===
if (withOSI)
{
if (numberOfOSI() == 0)
RuntimeException::selfThrow("Simulation::initialize No OSI !");
DynamicalSystemsGraph::VIterator dsi, dsend;
SP::DynamicalSystemsGraph DSG = _nsds->topology()->dSG(0);
for (std11::tie(dsi, dsend) = DSG->vertices(); dsi != dsend; ++dsi)
{
SP::OneStepIntegrator osi = DSG->properties(*dsi).osi;
SP::DynamicalSystem ds = DSG->bundle(*dsi);
if (!osi)
{
// By default, if the user has not set the OSI, we assign the first OSI to all DS
_nsds->topology()->setOSI(ds,*_allOSI->begin());
//std::cout << "By default, if the user has not set the OSI, we assign the first OSI to all DS"<<std::endl;
}
osi = DSG->properties(*dsi).osi;
ds->initialize(m->t0(), osi->getSizeMem());
}
// === OneStepIntegrators initialization ===
for (OSIIterator itosi = _allOSI->begin();
itosi != _allOSI->end(); ++itosi)
{
// for (DSIterator itds = (*itosi)->dynamicalSystems()->begin();
// itds != (*itosi)->dynamicalSystems()->end();
// ++itds)
// {
// (*itds)->initialize(startingTime(),
// (*itosi)->getSizeMem());
// addInOSIMap(*itds, *itosi);
// }
(*itosi)->setSimulationPtr(shared_from_this());
(*itosi)->initialize(*m);
}
}
// This is the default
_levelMinForInput = LEVELMAX;
_levelMaxForInput = 0;
_levelMinForOutput = LEVELMAX;
_levelMaxForOutput = 0;
computeLevelsForInputAndOutput();
// Loop over all DS in the graph, to reset NS part of each DS.
// Note FP : this was formerly done in inter->initialize call with local levels values
// but I think it's ok (better?) to do it with the simulation levels values.
DynamicalSystemsGraph::VIterator dsi, dsend;
SP::DynamicalSystemsGraph DSG = _nsds->topology()->dSG(0);
for (std11::tie(dsi, dsend) = DSG->vertices(); dsi != dsend; ++dsi)
{
//assert(_levelMinForInput <= _levelMaxForInput);
for (unsigned int k = _levelMinForInput ; k < _levelMaxForInput + 1; k++)
{
DSG->bundle(*dsi)->initializeNonSmoothInput(k);
}
}
InteractionsGraph::VIterator ui, uiend;
SP::InteractionsGraph indexSet0 = _nsds->topology()->indexSet0();
for (std11::tie(ui, uiend) = indexSet0->vertices(); ui != uiend; ++ui)
{
Interaction& inter = *indexSet0->bundle(*ui);
inter.initialize(_tinit, indexSet0->properties(*ui));
}
// Initialize OneStepNSProblem(s). Depends on the type of simulation.
// Warning FP : must be done in any case, even if the interactions set
// is empty.
initOSNS();
// Process events at time _tinit. Useful to save values in memories
// for example. Warning: can not be called during
// eventsManager->initialize, because it needs the initialization of
// OSI, OSNS ...
_eventsManager->preUpdate(*this);
//.........这里部分代码省略.........