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
5dd2aea
..
8a697dc
100644
(file)
--- a/
src/edu/berkeley/qfat/Mesh.java
+++ b/
src/edu/berkeley/qfat/Mesh.java
@@
-319,33
+319,52
@@
public class Mesh implements Iterable<Mesh.T> {
}
public class BindingGroup {
}
public class BindingGroup {
- private HashSet<E> ess = new HashSet<E>();
+ private HashSet<E> left = new HashSet<E>();
+ private HashSet<E> right = new HashSet<E>();
public BindingGroup() { }
public BindingGroup(E e) {
public BindingGroup() { }
public BindingGroup(E e) {
- ess.add(e);
+ left.add(e);
}
}
- public void add(E e) {
+ public void add(E e, boolean swap) {
if (e.bg != null) {
if (e.bg != null) {
- for(E ex : e.bg.ess) {
- ex.bg = null;
- add(ex);
+ if (e.bg == this) return;
+ for(E ex : (!swap ? e.bg.left : e.bg.right)) {
+ ex.bg = this;
+ left.add(ex);
+ }
+ for(E ex : (!swap ? e.bg.right : e.bg.left)) {
+ ex.bg = this;
+ right.add(ex);
}
} else {
}
} else {
- ess.add(e);
+ (!swap ? left : right).add(e);
e.bg = this;
}
}
public void dobind(E e) {
e.bg = this;
}
}
public void dobind(E e) {
- for(E ex : ess) {
+ // 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;
+ v1.bind(ex.p1);
+ v2.bind(ex.p2);
+ }
+ for(E ex : right) {
if (ex==e) continue;
if (ex==e) continue;
- e.p1.bind(ex.p1);
- e.p2.bind(ex.p2);
+ v1.bind(ex.p2);
+ v2.bind(ex.p1);
}
}
public void shatter(BindingGroup bg1, BindingGroup bg2) {
}
}
public void shatter(BindingGroup bg1, BindingGroup bg2) {
- for(E e : ess) {
+ for(E e : left) {
e.shatter(e.midpoint(), bg1, bg2);
}
e.shatter(e.midpoint(), bg1, bg2);
}
+ for(E e : right) {
+ e.shatter(e.midpoint(), bg2, bg1); /* swap correct? */
+ }
}
}
}
}
@@
-363,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);
+ bg.add(e.pair, false);
}
public void dobind() { if (bg != null) bg.dobind(this); }
}
public void dobind() { if (bg != null) bg.dobind(this); }
@@
-384,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;
}