Skip to content
Snippets Groups Projects
Commit 940cd7a4 authored by vincent  lorrain's avatar vincent lorrain
Browse files

fix/56

parent db15f04f
No related branches found
No related tags found
No related merge requests found
...@@ -42,7 +42,7 @@ void FsmEdge::reSetDestNode(const std::shared_ptr<FsmNode>& newDest){ ...@@ -42,7 +42,7 @@ void FsmEdge::reSetDestNode(const std::shared_ptr<FsmNode>& newDest){
} }
void FsmEdge::propagateRelativePos(void){ void FsmEdge::propagateRelativePos(void){
std::set<int> myRelativeID; std::set<std::size_t> myRelativeID;
for (const auto& kvp : mRelativePos) { for (const auto& kvp : mRelativePos) {
myRelativeID.insert(kvp.first); myRelativeID.insert(kvp.first);
} }
...@@ -56,31 +56,31 @@ void FsmEdge::propagateRelativePos(void){ ...@@ -56,31 +56,31 @@ void FsmEdge::propagateRelativePos(void){
} }
std::set<int> nextRelativeID; std::set<std::size_t> nextRelativeID;
for (const auto& kvp : nextEdge->getRelative()) { for (const auto& kvp : nextEdge->getRelative()) {
nextRelativeID.insert(kvp.first); nextRelativeID.insert(kvp.first);
} }
// Find elements in myRelativeID but not in nextRelativeID // Find elements in myRelativeID but not in nextRelativeID
std::set<int> idxsToPush; std::set<std::size_t> idxsToPush;
std::set_difference(myRelativeID.begin(), myRelativeID.end(), std::set_difference(myRelativeID.begin(), myRelativeID.end(),
nextRelativeID.begin(), nextRelativeID.end(), nextRelativeID.begin(), nextRelativeID.end(),
std::inserter(idxsToPush, idxsToPush.begin())); std::inserter(idxsToPush, idxsToPush.begin()));
// Find elements in nextRelativeID but not in myRelativeID // Find elements in nextRelativeID but not in myRelativeID
std::set<int> idxsToGet; std::set<std::size_t> idxsToGet;
std::set_difference(nextRelativeID.begin(), nextRelativeID.end(), std::set_difference(nextRelativeID.begin(), nextRelativeID.end(),
myRelativeID.begin(), myRelativeID.end(), myRelativeID.begin(), myRelativeID.end(),
std::inserter(idxsToGet, idxsToGet.begin())); std::inserter(idxsToGet, idxsToGet.begin()));
// test for integrity we look if 2 edge refert to the samme // test for integrity we look if 2 edge refer to the same
// ref and are link the ref dif is one // ref and are link the ref dif is one
// not working for common node // not working for common node
// we can go deeper by find the all pass to a ref and see if the delta is good // we can go deeper by find the all pass to a ref and see if the delta is good
// Find elements present in both myRelativeID and nextRelativeID // Find elements present in both myRelativeID and nextRelativeID
std::set<int> idxsTotest; std::set<std::size_t> idxsTotest;
for (int idx : nextRelativeID){ for (std::size_t idx : nextRelativeID){
if (myRelativeID.find(idx) != myRelativeID.end()){ if (myRelativeID.find(idx) != myRelativeID.end()){
if (std::abs(getRelative().at(idx) - nextEdge->getRelative().at(idx)) != 1) { if (std::abs(getRelative().at(idx) - nextEdge->getRelative().at(idx)) != 1) {
throw std::runtime_error("Bad relative"); throw std::runtime_error("Bad relative");
...@@ -90,10 +90,10 @@ void FsmEdge::propagateRelativePos(void){ ...@@ -90,10 +90,10 @@ void FsmEdge::propagateRelativePos(void){
// this egde have more relative info than the next // this edge have more relative info than the next
std::map<size_t,int> tmpRelative; std::map<size_t,int> tmpRelative;
// we push this info to the next // we push this info to the next
for( auto idxToPush :idxsToPush ){ for(std::size_t idxToPush :idxsToPush ){
tmpRelative.insert( std::make_pair(idxToPush, getRelative().at(idxToPush) +1)); tmpRelative.insert( std::make_pair(idxToPush, getRelative().at(idxToPush) +1));
} }
if(tmpRelative.size() != 0){ if(tmpRelative.size() != 0){
...@@ -104,7 +104,7 @@ void FsmEdge::propagateRelativePos(void){ ...@@ -104,7 +104,7 @@ void FsmEdge::propagateRelativePos(void){
// the next node have more info than me i need to get it // the next node have more info than me i need to get it
for( auto idxToGet :idxsToGet ){ for( std::size_t idxToGet :idxsToGet ){
tmpRelative.insert( std::make_pair(idxToGet, nextEdge->getRelative().at(idxToGet) -1)); tmpRelative.insert( std::make_pair(idxToGet, nextEdge->getRelative().at(idxToGet) -1));
} }
if(tmpRelative.size() != 0){ if(tmpRelative.size() != 0){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment