本文整理汇总了C++中sp::InteractionsGraph::update_edges_indices方法的典型用法代码示例。如果您正苦于以下问题:C++ InteractionsGraph::update_edges_indices方法的具体用法?C++ InteractionsGraph::update_edges_indices怎么用?C++ InteractionsGraph::update_edges_indices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sp::InteractionsGraph
的用法示例。
在下文中一共展示了InteractionsGraph::update_edges_indices方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateInteractionBlocks
void MLCPProjectOnConstraints::updateInteractionBlocks()
{
// The present functions checks various conditions and possibly
// compute interactionBlocks matrices.
//
// Let interi and interj be two Interactions.
//
// Things to be checked are:
// 1 - is the topology time invariant?
// 2 - does interactionBlocks[interi][interj] already exists (ie has been
// computed in a previous time step)?
// 3 - do we need to compute this interactionBlock? A interactionBlock is
// to be computed if interi and interj are in IndexSet1 AND if interi and
// interj have common DynamicalSystems.
//
// The possible cases are:
//
// - If 1 and 2 are true then it does nothing. 3 is not checked.
// - If 1 == true, 2 == false, 3 == false, it does nothing.
// - If 1 == true, 2 == false, 3 == true, it computes the
// interactionBlock.
// - If 1==false, 2 is not checked, and the interactionBlock is
// computed if 3==true.
//
#ifdef MLCPPROJ_DEBUG
std::cout << " " << std::endl;
std::cout << "===================================================" << std::endl;
std::cout << "MLCPProjectOnConstraints::updateInteractionBlocks()" << std::endl;
#endif
// Get index set from Simulation
SP::InteractionsGraph indexSet = simulation()->indexSet(indexSetLevel());
// It seems that index() in not update in Index(0)
// see comment in void Simulation::updateIndexSets()
if (indexSetLevel() == 0)
{
indexSet->update_vertices_indices();
indexSet->update_edges_indices();
}
bool isLinear = simulation()->model()->nonSmoothDynamicalSystem()->isLinear();
// we put diagonal informations on vertices
// self loops with bgl are a *nightmare* at the moment
// (patch 65198 on standard boost install)
if (indexSet->properties().symmetric)
{
RuntimeException::selfThrow
(" MLCPProjectOnConstraints::updateInteractionBlocks() - not yet implemented for symmetric case");
}
else // not symmetric => follow out_edges for each vertices
{
if (!_hasBeenUpdated)
{
// printf("MLCPProjectOnConstraints::updateInteractionBlocks must be updated.\n");
_n = 0;
_m = 0;
_curBlock = 0;
}
InteractionsGraph::VIterator vi, viend;
for (std11::tie(vi, viend) = indexSet->vertices();
vi != viend; ++vi)
{
SP::Interaction inter = indexSet->bundle(*vi);
unsigned int nslawSize = std11::static_pointer_cast<OSNSMatrixProjectOnConstraints>
(_M)->computeSizeForProjection(inter);
#ifdef MLCPPROJ_DEBUG
std::cout << " " << std::endl;
std::cout << "Start to work on Interaction " << inter->number() << "of vertex" << *vi << std::endl;
#endif
if (! indexSet->blockProj[*vi])
{
#ifdef MLCPPROJ_DEBUG
std::cout << "Allocation of blockProj of size " << nslawSize << " x " << nslawSize << " for interaction " << inter->number() << std::endl;
#endif
indexSet->blockProj[*vi].reset(new SimpleMatrix(nslawSize, nslawSize));
}
if (!isLinear || !_hasBeenUpdated)
{
computeDiagonalInteractionBlock(*vi);
}
//.........这里部分代码省略.........