Commit b863ad71 authored by Federico Ciuffardi's avatar Federico Ciuffardi
Browse files

addapted output

parent ee0ad2fe
......@@ -97,9 +97,9 @@ struct genericGraph {
}
}
gvd_vertex operator[](pos p) { return g[positions[p]]; }
gvd_vertex &operator[](pos p) { return g[positions[p]]; }
gvd_vertex operator[](Vertex v) { return g[v]; }
gvd_vertex &operator[](Vertex v) { return g[v]; }
std::pair<AdjacencyIterator, AdjacencyIterator> neighbors(pos p) {
return adjacent_vertices(positions[p], g);
......
......@@ -742,13 +742,13 @@ void GVDIC::update_possible_crit_distance_map(){
// update frontiers
for(auto it = free_frontier_to_false.begin(); it != free_frontier_to_false.end(); it++){
pos frontier = (*it);
cout<<"free frontier to false "<<frontier<<endl;
// cout<<"free frontier to false "<<frontier<<endl;
pos critical_to_update = disMapIC->cell_data[frontier].first_source;
if(critical_to_update != NULL_POS){
cout<<"criticals to update "<<critical_to_update<<" ";
// cout<<"criticals to update "<<critical_to_update<<" ";
erase_frontier(critical_to_update, frontier);
}
cout<<endl;
// cout<<endl;
}
//cout << "free_frontiers" << endl;
......@@ -816,32 +816,32 @@ void GVDIC::update_criticals(){
pos old_critical = it->second;
// delete frotier from old critic
if(old_critical != NULL_POS){
cout<<"frontier to erase from old source "<<frontier<<endl;
cout<<"criticals to update "<<old_critical<<" ";
// cout<<"frontier to erase from old source "<<frontier<<endl;
// cout<<"criticals to update "<<old_critical<<" ";
erase_frontier(old_critical, frontier);
}
cout<<endl;
// cout<<endl;
// add or update (change new criticals name)
pos new_critical = disMapIC->cell_data[frontier].first_source;
if(new_critical != NULL_POS){
cout << "frontier to add to new source " << frontier << endl;
cout<<"criticals to update "<<new_critical<<" ";
// cout << "frontier to add to new source " << frontier << endl;
// cout<<"criticals to update "<<new_critical<<" ";
add_frontier(new_critical, frontier);
}
cout<<endl;
// cout<<endl;
}
update_criticals_mind_f();
for(auto it = criticals.begin(); it != criticals.end(); it++){
cout<<(*it).first<<" fronteras: ";
for(auto it_f = (*it).second.frontiers.begin();it_f != (*it).second.frontiers.end(); it_f++){
cout<<(*it_f)<<" ";
}
cout<<endl;
}
// for(auto it = criticals.begin(); it != criticals.end(); it++){
// // cout<<(*it).first<<" fronteras: ";
// for(auto it_f = (*it).second.frontiers.begin();it_f != (*it).second.frontiers.end(); it_f++){
// // cout<<(*it_f)<<" ";
// }
// cout<<endl;
// }
}
//////////
......@@ -894,7 +894,7 @@ boost::tuple<criticals_info, GVD> GVDIC::get_points_of_interest(grid gt) {
// post increment
old_gt = gt;
return boost::make_tuple(criticals_info(), GVD());
return generate_output();
}
GVDIC::GVDIC(){
......@@ -905,4 +905,38 @@ GVDIC::GVDIC(){
GVDIC::~GVDIC(){
delete m;
delete disMapIC;
}
\ No newline at end of file
}
// generate the requiered output, this is just to test (not incremental)
boost::tuple<criticals_info, GVD> GVDIC::generate_output() {
GVD ret_gvd;
for(auto it = gvd.full_graph.begin(); it != gvd.full_graph.end(); it++){
pos p = *it;
ret_gvd.add_v(p);
ret_gvd[p].is_critical = is_elem(criticals, p);
ret_gvd[p].segment = disMapIC->cell_data[p].first_source;
pos_set adj_p = adj(gt, p);
for (auto it = adj_p.begin(); it != adj_p.end(); it++){
pos n = *it;
if(is_elem(ret_gvd.positions,n)){
ret_gvd.add_e(p,n);
ret_gvd.add_e(n,p);
}
}
}
criticals_info ret_criticals;
for(auto it = criticals.begin(); it!= criticals.end(); it++){
pos p = it->first;
critical_info2 ci2 = it->second;
ret_criticals[p].mind_f = ci2.mind_f.second;
ret_criticals[p].frontiers.push_back(ci2.mind_f.first);
ci2.frontiers.erase(ci2.mind_f.first);
for (auto it = ci2.frontiers.begin(); it != ci2.frontiers.end(); it++) {
ret_criticals[p].frontiers.push_back(*it);
}
}
return boost::make_tuple(ret_criticals, ret_gvd);
}
......@@ -98,6 +98,7 @@ class GVDIC {
boost::unordered_map<pos, CellDataO> cell_data_o;
boost::tuple<criticals_info, GVD> get_points_of_interest(grid gt);
boost::tuple<criticals_info, GVD> generate_output();
pos_set voro_to_false;
pos_set voro_to_true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment