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
23ae1c8
..
0df0072
100644
(file)
--- a/
src/edu/berkeley/qfat/Mesh.java
+++ b/
src/edu/berkeley/qfat/Mesh.java
@@
-319,33
+319,48
@@
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) {
- if (e.bg != null) { merge(e.bg); return; }
- ess.add(e);
- e.bg = this;
- }
- public void merge(BindingGroup bg) {
- for(E e : bg.ess) {
- e.bg = null;
- add(e);
+ if (e.bg != null) {
+ if (e.bg == this) return;
+ for(E ex : e.bg.left) {
+ ex.bg = this;
+ left.add(ex);
+ }
+ for(E ex : e.bg.right) {
+ ex.bg = this;
+ right.add(ex);
+ }
+ } else {
+ left.add(e);
+ e.bg = this;
}
}
public void dobind(E e) {
}
}
public void dobind(E e) {
- for(E ex : ess) {
+ // assumes e is part of the "left" set
+ for(E ex : left) {
if (ex==e) continue;
e.p1.bind(ex.p1);
e.p2.bind(ex.p2);
}
if (ex==e) continue;
e.p1.bind(ex.p1);
e.p2.bind(ex.p2);
}
+ for(E ex : right) {
+ if (ex==e) continue;
+ e.p1.bind(ex.pair.p1);
+ e.p2.bind(ex.pair.p2);
+ }
}
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? */
+ }
}
}
}
}
@@
-384,8
+399,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));
+ bg2.add(p2.getE(mid).pair);
return mid;
}
return mid;
}