@@ -14,8 +14,8 @@ impl<T: CoordsFloat> CMap2<T> {
1414 lhs_dart_id : DartIdType ,
1515 rhs_dart_id : DartIdType ,
1616 ) -> TransactionClosureResult < ( ) , SewError > {
17- let b1lhs_dart_id = self . betas [ ( 1 , lhs_dart_id) ] . read ( t ) ?;
18- let b1rhs_dart_id = self . betas [ ( 1 , rhs_dart_id) ] . read ( t ) ?;
17+ let b1lhs_dart_id = self . beta_tx :: < 1 > ( t , lhs_dart_id) ?;
18+ let b1rhs_dart_id = self . beta_tx :: < 1 > ( t , rhs_dart_id) ?;
1919 // match (is lhs 1-free, is rhs 1-free)
2020 match ( b1lhs_dart_id == NULL_DART_ID , b1rhs_dart_id == NULL_DART_ID ) {
2121 // trivial case, no update needed
@@ -24,13 +24,12 @@ impl<T: CoordsFloat> CMap2<T> {
2424 self . betas. two_link_core( t, lhs_dart_id, rhs_dart_id) ,
2525 SewError
2626 ) ;
27- let eid_new = self . edge_id_tx ( t, lhs_dart_id) ?;
2827 try_or_coerce ! (
2928 self . attributes. merge_attributes(
3029 t,
3130 OrbitPolicy :: Edge ,
32- eid_new ,
33- lhs_dart_id as EdgeIdType , // valid in 2D
31+ lhs_dart_id . min ( rhs_dart_id ) as EdgeIdType ,
32+ lhs_dart_id as EdgeIdType ,
3433 rhs_dart_id as EdgeIdType ,
3534 ) ,
3635 SewError
@@ -49,18 +48,20 @@ impl<T: CoordsFloat> CMap2<T> {
4948 SewError
5049 ) ;
5150 // merge vertices & attributes from the old IDs to the new one
52- let lhs_vid_new = self . vertex_id_tx ( t, lhs_dart_id) ?;
53- let eid_new = self . edge_id_tx ( t, lhs_dart_id) ?;
5451 try_or_coerce ! (
55- self . vertices
56- . merge( t, lhs_vid_new, lhs_vid_old, b1rhs_vid_old) ,
52+ self . vertices. merge(
53+ t,
54+ lhs_vid_old. min( b1rhs_vid_old) ,
55+ lhs_vid_old,
56+ b1rhs_vid_old
57+ ) ,
5758 SewError
5859 ) ;
5960 try_or_coerce ! (
6061 self . attributes. merge_attributes(
6162 t,
6263 OrbitPolicy :: Vertex ,
63- lhs_vid_new ,
64+ lhs_vid_old . min ( b1rhs_vid_old ) ,
6465 lhs_vid_old,
6566 b1rhs_vid_old,
6667 ) ,
@@ -70,7 +71,7 @@ impl<T: CoordsFloat> CMap2<T> {
7071 self . attributes. merge_attributes(
7172 t,
7273 OrbitPolicy :: Edge ,
73- eid_new ,
74+ lhs_eid_old . min ( rhs_eid_old ) ,
7475 lhs_eid_old,
7576 rhs_eid_old,
7677 ) ,
@@ -90,18 +91,20 @@ impl<T: CoordsFloat> CMap2<T> {
9091 SewError
9192 ) ;
9293 // merge vertices & attributes from the old IDs to the new one
93- let rhs_vid_new = self . vertex_id_tx ( t, rhs_dart_id) ?;
94- let eid_new = self . edge_id_tx ( t, lhs_dart_id) ?;
9594 try_or_coerce ! (
96- self . vertices
97- . merge( t, rhs_vid_new, b1lhs_vid_old, rhs_vid_old) ,
95+ self . vertices. merge(
96+ t,
97+ b1lhs_vid_old. min( rhs_vid_old) ,
98+ b1lhs_vid_old,
99+ rhs_vid_old
100+ ) ,
98101 SewError
99102 ) ;
100103 try_or_coerce ! (
101104 self . attributes. merge_attributes(
102105 t,
103106 OrbitPolicy :: Vertex ,
104- rhs_vid_new ,
107+ b1lhs_vid_old . min ( rhs_vid_old ) ,
105108 b1lhs_vid_old,
106109 rhs_vid_old,
107110 ) ,
@@ -111,7 +114,7 @@ impl<T: CoordsFloat> CMap2<T> {
111114 self . attributes. merge_attributes(
112115 t,
113116 OrbitPolicy :: Edge ,
114- eid_new ,
117+ lhs_eid_old . min ( rhs_eid_old ) ,
115118 lhs_eid_old,
116119 rhs_eid_old,
117120 ) ,
@@ -158,24 +161,29 @@ impl<T: CoordsFloat> CMap2<T> {
158161 SewError
159162 ) ;
160163 // merge vertices & attributes from the old IDs to the new one
161- let lhs_vid_new = self . vertex_id_tx ( t, lhs_dart_id) ?;
162- let rhs_vid_new = self . vertex_id_tx ( t, rhs_dart_id) ?;
163- let eid_new = self . edge_id_tx ( t, lhs_dart_id) ?;
164164 try_or_coerce ! (
165- self . vertices
166- . merge( t, lhs_vid_new, lhs_vid_old, b1rhs_vid_old) ,
165+ self . vertices. merge(
166+ t,
167+ lhs_vid_old. min( b1rhs_vid_old) ,
168+ lhs_vid_old,
169+ b1rhs_vid_old
170+ ) ,
167171 SewError
168172 ) ;
169173 try_or_coerce ! (
170- self . vertices
171- . merge( t, rhs_vid_new, b1lhs_vid_old, rhs_vid_old) ,
174+ self . vertices. merge(
175+ t,
176+ b1lhs_vid_old. min( rhs_vid_old) ,
177+ b1lhs_vid_old,
178+ rhs_vid_old
179+ ) ,
172180 SewError
173181 ) ;
174182 try_or_coerce ! (
175183 self . attributes. merge_attributes(
176184 t,
177185 OrbitPolicy :: Vertex ,
178- lhs_vid_new ,
186+ lhs_vid_old . min ( b1rhs_vid_old ) ,
179187 lhs_vid_old,
180188 b1rhs_vid_old,
181189 ) ,
@@ -185,7 +193,7 @@ impl<T: CoordsFloat> CMap2<T> {
185193 self . attributes. merge_attributes(
186194 t,
187195 OrbitPolicy :: Vertex ,
188- rhs_vid_new ,
196+ b1lhs_vid_old . min ( rhs_vid_old ) ,
189197 b1lhs_vid_old,
190198 rhs_vid_old,
191199 ) ,
@@ -195,7 +203,7 @@ impl<T: CoordsFloat> CMap2<T> {
195203 self . attributes. merge_attributes(
196204 t,
197205 OrbitPolicy :: Edge ,
198- eid_new ,
206+ lhs_eid_old . min ( rhs_eid_old ) ,
199207 lhs_eid_old,
200208 rhs_eid_old,
201209 ) ,
@@ -213,9 +221,9 @@ impl<T: CoordsFloat> CMap2<T> {
213221 t : & mut Transaction ,
214222 lhs_dart_id : DartIdType ,
215223 ) -> TransactionClosureResult < ( ) , SewError > {
216- let rhs_dart_id = self . betas [ ( 2 , lhs_dart_id) ] . read ( t ) ?;
217- let b1lhs_dart_id = self . betas [ ( 1 , lhs_dart_id) ] . read ( t ) ?;
218- let b1rhs_dart_id = self . betas [ ( 1 , rhs_dart_id) ] . read ( t ) ?;
224+ let rhs_dart_id = self . beta_tx :: < 2 > ( t , lhs_dart_id) ?;
225+ let b1lhs_dart_id = self . beta_tx :: < 1 > ( t , lhs_dart_id) ?;
226+ let b1rhs_dart_id = self . beta_tx :: < 1 > ( t , rhs_dart_id) ?;
219227 // match (is lhs 1-free, is rhs 1-free)
220228 match ( b1lhs_dart_id == NULL_DART_ID , b1rhs_dart_id == NULL_DART_ID ) {
221229 ( true , true ) => {
0 commit comments