1818 ******************************************************************************/
1919
2020#include < forward_list>
21+ #include < iostream>
2122#include < set>
2223
2324#include " sbg/map_entry.hpp"
@@ -153,19 +154,28 @@ bool DomOrdPWMap::operator==(const PWMapStrategy& other) const
153154 // Comparison between short_map and long_map needed.
154155 if (doInt (short_sp, long_sp)) {
155156 Set cap_dom = short_map.dom ().intersection (long_map.dom ());
156- Map short_cap_map (cap_dom, short_map.exp ());
157- Map long_cap_map (cap_dom, long_map.exp ());
158- if (!cap_dom.isEmpty () && short_cap_map != long_cap_map) {
159- return false ;
157+ if (!cap_dom.isEmpty ()) {
158+ Exp short_exp = short_map.exp ();
159+ Exp long_exp = long_map.exp ();
160+ if (short_exp != long_exp) {
161+ return false ;
162+ }
163+
164+ Map short_cap_map (cap_dom, short_exp);
165+ Map long_cap_map (cap_dom, long_exp);
166+ if (short_cap_map != long_cap_map) {
167+ return false ;
168+ }
160169 }
161170 }
162171
163172 ++prev_index;
164173 ++curr_index;
165174 }
166175
167- if (indexes.empty ())
176+ if (indexes.empty ()) {
168177 break ;
178+ }
169179 }
170180
171181 return true ;
@@ -196,7 +206,7 @@ PWMapStratPtr DomOrdPWMap::operator+(const PWMapStrategy& other) const
196206void DomOrdPWMap::processAdd (const Map& m1, const Map& m2,
197207 Set& set_in, Set& set_out,
198208 OrdMapCollection& ord_pwmap,
199- NAT global_pos) const
209+ NAT & global_pos) const
200210{
201211 Map res_add = m1 + m2;
202212 if (!res_add.dom ().isEmpty ()) {
@@ -621,7 +631,7 @@ PWMapStratPtr DomOrdPWMap::minAdjMap(const PWMapStrategy& other) const
621631void DomOrdPWMap::processMinAdjMap (const Map& m1, const Map& m2,
622632 Set& set_in, Set& set_out,
623633 OrdMapCollection& ord_pwmap,
624- NAT global_pos) const
634+ NAT & global_pos) const
625635{
626636 Set dom_res = SET_FACT .createSet ();
627637 Set ith_dom = m1.dom ().intersection (m2.dom ());
@@ -735,7 +745,7 @@ Set DomOrdPWMap::equalImage(const PWMapStrategy& other) const
735745void DomOrdPWMap::processEqualImage (const Map& m1, const Map& m2,
736746 Set& set_in, Set& set_out,
737747 OrdMapCollection& ord_pwmap,
738- NAT global_pos) const
748+ NAT & global_pos) const
739749{
740750 Set cap_dom = m1.dom ().intersection (m2.dom ());
741751 if (!cap_dom.isEmpty ()) {
@@ -759,7 +769,7 @@ Set DomOrdPWMap::lessImage(const PWMapStrategy& other) const
759769void DomOrdPWMap::processLessImage (const Map& m1, const Map& m2,
760770 Set& set_in, Set& set_out,
761771 OrdMapCollection& ord_pwmap,
762- NAT global_pos) const
772+ NAT & global_pos) const
763773{
764774 set_out.insertBack (m1.lessImage (m2));
765775}
@@ -791,38 +801,41 @@ void DomOrdPWMap::processMapsOrd(
791801
792802 auto short_begin = short_pw->pieces_ .begin ();
793803 NAT global_pos = 0 ;
794-
795- for (const MapEntry& long_mpe : long_pw->pieces_ ) {
804+ for (const MapEntry& long_mpe : long_pw->pieces_ ) {
796805 const Map& long_map = long_mpe.first ;
797806 const SetPerimeter& long_sp = long_mpe.second ;
798807
799808 auto prev_index = indexes.before_begin ();
800809 auto curr_index = indexes.begin ();
801-
802810 while (curr_index != indexes.end ()) {
803811 size_t idx = *curr_index;
804812 const MapEntry& short_mpe = *(short_begin + idx);
805- const Map& s_m = short_mpe.first ;
813+ const Map& short_map = short_mpe.first ;
806814 const SetPerimeter& short_sp = short_mpe.second ;
807-
815+
808816 if (short_sp.second < long_sp.first ) {
809817 curr_index = indexes.erase_after (prev_index);
810818 continue ;
811819 }
812820
813- if (long_sp.second < short_sp.first )
821+ if (long_sp.second < short_sp.first ) {
814822 break ;
823+ }
815824
816825 // Process overlapping perimeters
817826 if (doInt (short_sp, long_sp)) {
818- (this ->*process)(s_m, long_map, set_in, set_out, ord_map, global_pos);
827+ (this ->*process)(short_map, long_map, set_in, set_out, ord_map
828+ , global_pos);
819829 }
820830
821831 ++prev_index;
822832 ++curr_index;
833+ // ++aux_it;
823834 }
824- if (indexes.empty ())
835+
836+ if (indexes.empty ()) {
825837 break ;
838+ }
826839 }
827840}
828841
0 commit comments