projects
/
anneal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
checkpoint
[anneal.git]
/
src
/
edu
/
berkeley
/
qfat
/
Mesh.java
diff --git
a/src/edu/berkeley/qfat/Mesh.java
b/src/edu/berkeley/qfat/Mesh.java
index
0df0072
..
563e2f5
100644
(file)
--- a/
src/edu/berkeley/qfat/Mesh.java
+++ b/
src/edu/berkeley/qfat/Mesh.java
@@
-325,33
+325,37
@@
public class Mesh implements Iterable<Mesh.T> {
public BindingGroup(E e) {
left.add(e);
}
public BindingGroup(E e) {
left.add(e);
}
- public void add(E e) {
+ public void add(E e, boolean swap) {
if (e.bg != null) {
if (e.bg == this) return;
if (e.bg != null) {
if (e.bg == this) return;
- for(E ex : e.bg.left) {
+ for(E ex : (!swap ? e.bg.left : e.bg.right)) {
ex.bg = this;
left.add(ex);
}
ex.bg = this;
left.add(ex);
}
- for(E ex : e.bg.right) {
+ for(E ex : (!swap ? e.bg.right : e.bg.left)) {
ex.bg = this;
right.add(ex);
}
} else {
ex.bg = this;
right.add(ex);
}
} else {
- left.add(e);
+ (!swap ? left : right).add(e);
e.bg = this;
}
}
public void dobind(E e) {
// assumes e is part of the "left" set
e.bg = this;
}
}
public void dobind(E e) {
// assumes e is part of the "left" set
+ Vert v1 = null;
+ Vert v2 = null;
+ if (left.contains(e)) { v1 = e.p1; v2 = e.p2; }
+ if (right.contains(e)) { v1 = e.p2; v2 = e.p1; }
for(E ex : left) {
if (ex==e) continue;
for(E ex : left) {
if (ex==e) continue;
- e.p1.bind(ex.p1);
- e.p2.bind(ex.p2);
+ v1.bind(ex.p1);
+ v2.bind(ex.p2);
}
for(E ex : right) {
if (ex==e) continue;
}
for(E ex : right) {
if (ex==e) continue;
- e.p1.bind(ex.pair.p1);
- e.p2.bind(ex.pair.p2);
+ v1.bind(ex.p2);
+ v2.bind(ex.p1);
}
}
public void shatter(BindingGroup bg1, BindingGroup bg2) {
}
}
public void shatter(BindingGroup bg1, BindingGroup bg2) {
@@
-378,7
+382,7
@@
public class Mesh implements Iterable<Mesh.T> {
public int compareTo(E e) { return e.length() > length() ? 1 : -1; }
public void bindEdge(E e) {
public int compareTo(E e) { return e.length() > length() ? 1 : -1; }
public void bindEdge(E e) {
- e.pair.bg.add(this);
+ e.pair.bg.add(this, false);
}
public void dobind() { if (bg != null) bg.dobind(this); }
}
public void dobind() { if (bg != null) bg.dobind(this); }
@@
-399,8
+403,8
@@
public class Mesh implements Iterable<Mesh.T> {
newT(r.p, p1.p, mid, null);
newT(r.p, mid, p2.p, null);
newT(r.p, p1.p, mid, null);
newT(r.p, mid, p2.p, null);
- bg1.add(p1.getE(mid));
- bg2.add(p2.getE(mid).pair);
+ bg1.add(p1.getE(mid), false);
+ bg2.add(p2.getE(mid).pair, false);
return mid;
}
return mid;
}