本文整理汇总了C++中sp::Topology::setHasChanged方法的典型用法代码示例。如果您正苦于以下问题:C++ Topology::setHasChanged方法的具体用法?C++ Topology::setHasChanged怎么用?C++ Topology::setHasChanged使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sp::Topology
的用法示例。
在下文中一共展示了Topology::setHasChanged方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateIndexSet
void TimeStepping::updateIndexSet(unsigned int i)
{
// To update IndexSet i: add or remove Interactions from
// this set, depending on y values.
// boost::default_color_type is used to organize update in InteractionsGraph:
// - white_color : undiscovered vertex (Interaction)
// - gray_color : discovered vertex (Interaction) but searching descendants
// - black_color : discovered vertex (Interaction) together with the descendants
assert(_nsds);
assert(_nsds->topology());
SP::Topology topo = _nsds->topology();
assert(i < topo->indexSetsSize() &&
"TimeStepping::updateIndexSet(i), indexSets[i] does not exist.");
// IndexSets[0] must not be updated in simulation, since it belongs to Topology.
assert(i > 0 &&
"TimeStepping::updateIndexSet(i=0), indexSets[0] cannot be updated.");
// For all Interactions in indexSet[i-1], compute y[i-1] and
// update the indexSet[i].
SP::InteractionsGraph indexSet0 = topo->indexSet(0);
SP::InteractionsGraph indexSet1 = topo->indexSet(1);
assert(indexSet0);
assert(indexSet1);
DynamicalSystemsGraph& DSG0= *nonSmoothDynamicalSystem()->dynamicalSystems();
topo->setHasChanged(false);
DEBUG_PRINTF("TimeStepping::updateIndexSet(unsigned int i). update indexSets start : indexSet0 size : %ld\n", indexSet0->size());
DEBUG_PRINTF("TimeStepping::updateIndexSet(unsigned int i). update IndexSets start : indexSet1 size : %ld\n", indexSet1->size());
// Check indexSet1
InteractionsGraph::VIterator ui1, ui1end, v1next;
std11::tie(ui1, ui1end) = indexSet1->vertices();
//Remove interactions from the indexSet1
for (v1next = ui1; ui1 != ui1end; ui1 = v1next)
{
++v1next;
SP::Interaction inter1 = indexSet1->bundle(*ui1);
if (indexSet0->is_vertex(inter1))
{
InteractionsGraph::VDescriptor inter1_descr0 = indexSet0->descriptor(inter1);
assert((indexSet0->color(inter1_descr0) == boost::white_color));
indexSet0->color(inter1_descr0) = boost::gray_color;
if (Type::value(*(inter1->nonSmoothLaw())) != Type::EqualityConditionNSL)
{
// We assume that the integrator of the ds1 drive the update of the index set
//SP::OneStepIntegrator Osi = indexSet1->properties(*ui1).osi;
SP::DynamicalSystem ds1 = indexSet1->properties(*ui1).source;
OneStepIntegrator& osi = *DSG0.properties(DSG0.descriptor(ds1)).osi;
//if(predictorDeactivate(inter1,i))
if (osi.removeInteractionFromIndexSet(inter1, i))
{
// Interaction is not active
// ui1 becomes invalid
indexSet0->color(inter1_descr0) = boost::black_color;
indexSet1->eraseProperties(*ui1);
InteractionsGraph::OEIterator oei, oeiend;
for (std11::tie(oei, oeiend) = indexSet1->out_edges(*ui1);
oei != oeiend; ++oei)
{
InteractionsGraph::EDescriptor ed1, ed2;
std11::tie(ed1, ed2) = indexSet1->edges(indexSet1->source(*oei), indexSet1->target(*oei));
if (ed2 != ed1)
{
indexSet1->eraseProperties(ed1);
indexSet1->eraseProperties(ed2);
}
else
{
indexSet1->eraseProperties(ed1);
}
}
indexSet1->remove_vertex(inter1);
/* \warning V.A. 25/05/2012 : Multiplier lambda are only set to zero if they are removed from the IndexSet*/
inter1->lambda(1)->zero();
topo->setHasChanged(true);
}
}
}
else
{
// Interaction is not in indexSet0 anymore.
// ui1 becomes invalid
indexSet1->eraseProperties(*ui1);
InteractionsGraph::OEIterator oei, oeiend;
for (std11::tie(oei, oeiend) = indexSet1->out_edges(*ui1);
oei != oeiend; ++oei)
{
InteractionsGraph::EDescriptor ed1, ed2;
std11::tie(ed1, ed2) = indexSet1->edges(indexSet1->source(*oei), indexSet1->target(*oei));
if (ed2 != ed1)
//.........这里部分代码省略.........