aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src/fulltree.cc
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2009-09-03 16:19:15 -0500
committerBarry Wardell <barry.wardell@gmail.com>2011-12-14 16:42:31 +0000
commit11c4d98017cbb86d08e15fd1b549180184b58a26 (patch)
tree2546a154c6f7bc0bec87de7316125ae7d1453569 /Carpet/CarpetLib/src/fulltree.cc
parentf520477b1c14e02f1495cfa8d3e09f4e21ab34d0 (diff)
Import Carpet
Ignore-this: 309b4dd613f4af2b84aa5d6743fdb6b3
Diffstat (limited to 'Carpet/CarpetLib/src/fulltree.cc')
-rw-r--r--Carpet/CarpetLib/src/fulltree.cc46
1 files changed, 45 insertions, 1 deletions
diff --git a/Carpet/CarpetLib/src/fulltree.cc b/Carpet/CarpetLib/src/fulltree.cc
index cb6de5116..3234a73dc 100644
--- a/Carpet/CarpetLib/src/fulltree.cc
+++ b/Carpet/CarpetLib/src/fulltree.cc
@@ -15,6 +15,8 @@ fulltree<T,D,P>::fulltree ()
: type (type_empty)
{
assert (invariant());
+ // This is unused
+ assert (0);
}
@@ -193,6 +195,15 @@ fulltree<T,D,P>::const_iterator::const_iterator (fulltree const & f_)
if (f.is_branch()) {
assert (f.subtrees.size() > 0);
it = new const_iterator (* f.subtrees.at(i));
+ while ((*it).done()) {
+ delete it;
+ it = 0;
+ ++ i;
+ if (done()) break;
+ // to do: use a new function "reset iterator" instead
+ it = new const_iterator (* f.subtrees.at(i));
+ }
+ assert (done() or not (*it).done());
}
}
@@ -253,6 +264,7 @@ fulltree<T,D,P>::const_iterator::operator++ ()
++ i;
} else {
++ *it;
+#if 0
if ((*it).done()) {
delete it;
it = 0;
@@ -260,8 +272,19 @@ fulltree<T,D,P>::const_iterator::operator++ ()
if (not done()) {
// to do: use a new function "reset iterator" instead
it = new const_iterator (* f.subtrees.at(i));
+ assert (not (*it).done());
}
}
+#endif
+ while ((*it).done()) {
+ delete it;
+ it = 0;
+ ++ i;
+ if (done()) break;
+ // to do: use a new function "reset iterator" instead
+ it = new const_iterator (* f.subtrees.at(i));
+ }
+ assert (done() or not (*it).done());
}
return *this;
}
@@ -289,6 +312,15 @@ fulltree<T,D,P>::iterator::iterator (fulltree & f_)
if (f.is_branch()) {
assert (f.subtrees.size() > 0);
it = new iterator (* f.subtrees.at(i));
+ while ((*it).done()) {
+ delete it;
+ it = 0;
+ ++ i;
+ if (done()) break;
+ // to do: use a new function "reset iterator" instead
+ it = new iterator (* f.subtrees.at(i));
+ }
+ assert (done() or not (*it).done());
}
}
@@ -349,6 +381,7 @@ fulltree<T,D,P>::iterator::operator++ ()
++ i;
} else {
++ *it;
+#if 0
if ((*it).done()) {
delete it;
it = 0;
@@ -356,8 +389,19 @@ fulltree<T,D,P>::iterator::operator++ ()
if (not done()) {
// to do: use a new function "reset iterator" instead
it = new iterator (* f.subtrees.at(i));
+ assert (not (*it).done());
}
}
+#endif
+ while ((*it).done()) {
+ delete it;
+ it = 0;
+ ++ i;
+ if (done()) break;
+ // to do: use a new function "reset iterator" instead
+ it = new iterator (* f.subtrees.at(i));
+ }
+ assert (done() or not (*it).done());
}
return *this;
}
@@ -409,7 +453,7 @@ fulltree<T,D,P>::output (ostream & os) const
<< "dir=" << dir << ","
<< "subtrees=[";
for (size_t i=0; i<subtrees.size(); ++i) {
- os << bounds.at(i) << ":[" << i << "]=" << subtrees.at(i) << ":";
+ os << bounds.at(i) << ":[" << i << "]=" << *subtrees.at(i) << ":";
}
os << bounds.at(subtrees.size()) << "]";
} else {