本文整理汇总了C++中sp::Interaction::setDSLinkAndWorkspace方法的典型用法代码示例。如果您正苦于以下问题:C++ Interaction::setDSLinkAndWorkspace方法的具体用法?C++ Interaction::setDSLinkAndWorkspace怎么用?C++ Interaction::setDSLinkAndWorkspace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sp::Interaction
的用法示例。
在下文中一共展示了Interaction::setDSLinkAndWorkspace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
std::pair<DynamicalSystemsGraph::EDescriptor, InteractionsGraph::VDescriptor>
Topology::addInteractionInIndexSet0(SP::Interaction inter, SP::DynamicalSystem ds1, SP::DynamicalSystem ds2)
{
// !! Private function !!
//
// Add inter and ds into IG/DSG
// Compute number of constraints
unsigned int nsLawSize = inter->nonSmoothLaw()->size();
unsigned int m = inter->getSizeOfY() / nsLawSize;
if (m > 1)
RuntimeException::selfThrow("Topology::addInteractionInIndexSet0 - m > 1. Obsolete !");
_numberOfConstraints += nsLawSize;
SP::DynamicalSystem ds2_ = ds2;
// _DSG is the hyper forest : (vertices : dynamical systems, edges :
// Interactions)
//
// _IG is the hyper graph : (vertices : Interactions, edges :
// dynamical systems)
assert(_DSG[0]->edges_number() == _IG[0]->size());
// _IG = L(_DSG), L is the line graph transformation
// vector of the Interaction
DynamicalSystemsGraph::VDescriptor dsgv1, dsgv2;
dsgv1 = _DSG[0]->add_vertex(ds1);
SP::VectorOfVectors workVds1 = _DSG[0]->properties(dsgv1).workVectors;
SP::VectorOfVectors workVds2;
if (!workVds1)
{
workVds1.reset(new VectorOfVectors());
_DSG[0]->properties(dsgv1).workMatrices.reset(new VectorOfMatrices());
ds1->initWorkSpace(*workVds1, *_DSG[0]->properties(dsgv1).workMatrices);
}
if(ds2)
{
dsgv2 = _DSG[0]->add_vertex(ds2);
workVds2 = _DSG[0]->properties(dsgv2).workVectors;
if (!workVds2)
{
workVds2.reset(new VectorOfVectors());
_DSG[0]->properties(dsgv2).workMatrices.reset(new VectorOfMatrices());
ds2->initWorkSpace(*workVds2, *_DSG[0]->properties(dsgv2).workMatrices);
}
}
else
{
dsgv2 = dsgv1;
ds2_ = ds1;
workVds2 = workVds1;
}
// this may be a multi edges graph
assert(!_DSG[0]->is_edge(dsgv1, dsgv2, inter));
assert(!_IG[0]->is_vertex(inter));
InteractionsGraph::VDescriptor ig_new_ve;
DynamicalSystemsGraph::EDescriptor new_ed;
std11::tie(new_ed, ig_new_ve) = _DSG[0]->add_edge(dsgv1, dsgv2, inter, *_IG[0]);
InteractionProperties& interProp = _IG[0]->properties(ig_new_ve);
interProp.DSlink.reset(new VectorOfBlockVectors);
interProp.workVectors.reset(new VectorOfVectors);
interProp.workMatrices.reset(new VectorOfSMatrices);
unsigned int nslawSize = inter->nonSmoothLaw()->size();
interProp.block.reset(new SimpleMatrix(nslawSize, nslawSize));
inter->setDSLinkAndWorkspace(interProp, *ds1, *workVds1, *ds2_, *workVds2);
// add self branches in vertex properties
// note : boost graph SEGFAULT on self branch removal
// see https://svn.boost.org/trac/boost/ticket/4622
_IG[0]->properties(ig_new_ve).source = ds1;
_IG[0]->properties(ig_new_ve).source_pos = 0;
if(!ds2)
{
_IG[0]->properties(ig_new_ve).target = ds1;
_IG[0]->properties(ig_new_ve).target_pos = 0;
}
else
{
_IG[0]->properties(ig_new_ve).target = ds2;
_IG[0]->properties(ig_new_ve).target_pos = ds1->getDim();
}
assert(_IG[0]->bundle(ig_new_ve) == inter);
assert(_IG[0]->is_vertex(inter));
assert(_DSG[0]->is_edge(dsgv1, dsgv2, inter));
assert(_DSG[0]->edges_number() == _IG[0]->size());
return std::pair<DynamicalSystemsGraph::EDescriptor, InteractionsGraph::VDescriptor>(new_ed, ig_new_ve);
}