Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Federico Ciuffardi Alves
pgMappingCooperativo
Commits
ce76aa80
Commit
ce76aa80
authored
Oct 28, 2020
by
Romina Julieta Parada Venossa
Browse files
frontiers have only one critics represented by a pos
parent
1fed6bb4
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/lib/GVD/DisMapIC.cpp
View file @
ce76aa80
...
...
@@ -69,13 +69,12 @@ void DisMapIC::save_frontier_old_source(pos frontier){
if
(
is_elem
((
*
frontiers
),
frontier
)
&&
!
is_elem
(
updated_frontiers
,
frontier
)){
pos
first_source
=
cell_data
[
frontier
].
first_source
;
if
(
first_source
!=
NULL_POS
){
//updated_frontiers[frontier] = cell_data[frontier].first_source;
updated_frontiers
[
frontier
].
clear
();
updated_frontiers
[
frontier
].
insert
(
first_source
);
updated_frontiers
[
frontier
]
=
cell_data
[
frontier
].
first_source
;
//updated_frontiers[frontier].insert(first_source);
//updated_frontiers[frontier] = cell_data[frontier].sources;
}
else
{
//
updated_frontiers[frontier] = NULL_POS;
updated_frontiers
[
frontier
].
clear
();
updated_frontiers
[
frontier
]
=
NULL_POS
;
//
updated_frontiers[frontier].clear();
}
}
}
...
...
src/lib/GVD/DisMapIC.h
View file @
ce76aa80
...
...
@@ -60,7 +60,7 @@ class DisMapIC{
// these are only the FREE FRONTIERS
pos_set
*
frontiers
;
//for updating critics, old sources for frontiers are saved, new frontiers and frontiers with new critics with same distance are also saved with empty set
boost
::
unordered_map
<
pos
,
pos
_set
>
updated_frontiers
;
boost
::
unordered_map
<
pos
,
pos
>
updated_frontiers
;
//pos_set new_frontiers;
void
save_frontier_old_source
(
pos
frontier
);
...
...
src/lib/GVD/GVDIC.cpp
View file @
ce76aa80
...
...
@@ -738,22 +738,15 @@ void GVDIC::update_possible_crit(pos_set to_add_gvd, pos_set to_erase_gvd) {
// pcrit distance map
///
void
GVDIC
::
update_possible_crit_distance_map
(){
// update frontiers
/*disMapIC->frontiers.insert(frontier_to_true.begin(), frontier_to_true.end());
for(auto it = frontier_to_false.begin(); it != frontier_to_false.end(); it++){
pos frontier = *it;
// erase frontiers, so they are no longer consider for the recognition of new critics
disMapIC->frontiers.erase(frontier);
//disMapIC->save_frontier_old_source(f_pos); should be already saved from last iteration??
}*/
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
;
pos_set
criticals_to_update
=
disMapIC
->
cell_data
[
frontier
].
sources
;
for
(
auto
it_crit
=
criticals_to_update
.
begin
();
it_crit
!=
criticals_to_update
.
end
();
it_crit
++
){
pos
critical
=
(
*
it_crit
);
cout
<<
"criticals to update "
<<
critical
<<
" "
;
erase_frontier
(
critical
,
frontier
);
pos
critical_to_update
=
disMapIC
->
cell_data
[
frontier
].
first_source
;
if
(
critical_to_update
!=
NULL_POS
){
cout
<<
"criticals to update "
<<
critical_to_update
<<
" "
;
erase_frontier
(
critical_to_update
,
frontier
);
}
cout
<<
endl
;
}
...
...
@@ -817,65 +810,31 @@ void GVDIC::add_frontier(pos critical, pos frontier){
}
void
GVDIC
::
update_criticals
(){
//old crits
//for each frontier_to_false and frontier changed remove frontier from old sources
//delete from crit frontiers
// if no longer crit then
//delete from crit
//paso 1 (agregar descricpion del trello)
/*
for(auto it = frontier_to_false.begin(); it != frontier_to_false.end(); it++){
pos frontier = (*it);
cout<<"frontier to eliminate "<<frontier<<endl;
pos_set criticals_to_update = disMapIC->cell_data[frontier].sources;
for(auto it_crit = criticals_to_update.begin(); it_crit != criticals_to_update.end(); it_crit++){
pos critical = (*it_crit);
cout<<"critical to update "<<critical<<endl;
erase_frontier(critical, frontier);
}
}*/
for
(
auto
it
=
disMapIC
->
updated_frontiers
.
begin
();
it
!=
disMapIC
->
updated_frontiers
.
end
();
it
++
){
pos
frontier
=
it
->
first
;
pos_set
old_criticals
=
it
->
second
;
if
(
!
old_criticals
.
empty
()){
cout
<<
"frontier to erase from old source "
<<
frontier
<<
endl
;
}
pos
old_critical
=
it
->
second
;
// delete frotier from old critic
for
(
auto
it_old_crit
=
old_criticals
.
begin
();
it_old_crit
!=
old_criticals
.
end
();
it_old_crit
++
){
pos
critical
=
(
*
it_old_crit
);
cout
<<
"criticals to update "
<<
critical
<<
" "
;
erase_frontier
(
critical
,
frontier
);
if
(
old_critical
!=
NULL_POS
){
cout
<<
"frontier to erase from old source "
<<
frontier
<<
endl
;
cout
<<
"criticals to update "
<<
old_
critical
<<
" "
;
erase_frontier
(
old_
critical
,
frontier
);
}
cout
<<
endl
;
// add or update (change new criticals name)
pos
_set
new_critical
s
=
disMapIC
->
cell_data
[
frontier
].
source
s
;
if
(
!
new_critical
s
.
empty
()
){
pos
new_critical
=
disMapIC
->
cell_data
[
frontier
].
first_
source
;
if
(
new_critical
!=
NULL_POS
){
cout
<<
"frontier to add to new source "
<<
frontier
<<
endl
;
}
for
(
auto
it_new_crit
=
new_criticals
.
begin
();
it_new_crit
!=
new_criticals
.
end
();
it_new_crit
++
){
pos
critical
=
(
*
it_new_crit
);
cout
<<
"criticals to update "
<<
critical
<<
" "
;
add_frontier
(
critical
,
frontier
);
/*if(!is_elem(criticals, critical)){
criticals[critical] = critical_info2();
criticals[critical].mind_f = pair(pos(),MAXFLOAT);
}
criticals[critical].frontiers.insert(frontier);
float frontier_dist = disMapIC->cell_data[frontier].dist;
if(criticals[critical].mind_f > frontier_dist){
criticals[critical].mind_f = frontier_dist;
}*/
cout
<<
"criticals to update "
<<
new_critical
<<
" "
;
add_frontier
(
new_critical
,
frontier
);
}
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
++
){
...
...
@@ -883,12 +842,6 @@ void GVDIC::update_criticals(){
}
cout
<<
endl
;
}
//delete from old_source frontier the ones in frontier_to_false
//new crits
//for each forntier that changed
//add crit or update crit
}
//////////
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment