summaryrefslogtreecommitdiff
path: root/src/CGALEvaluator.cc
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2012-01-09 22:59:53 (GMT)
committerMarius Kintel <marius@kintel.net>2012-01-09 23:01:50 (GMT)
commit22b98cd05217acf0bf78969a3baaf4568781670f (patch)
tree005e046609df534e12f202e2233a3ba20b1d1abc /src/CGALEvaluator.cc
parentc513ad9a287ee1b5cc5e456c665792958649e2ed (diff)
Updated cache handling to keep the root node and issue a warning if it didn't fit into the cache. Better debug output
Diffstat (limited to 'src/CGALEvaluator.cc')
-rw-r--r--src/CGALEvaluator.cc20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc
index c403e85..bbf8cca 100644
--- a/src/CGALEvaluator.cc
+++ b/src/CGALEvaluator.cc
@@ -42,16 +42,12 @@ CGAL_Nef_polyhedron CGALEvaluator::evaluateCGALMesh(const AbstractNode &node)
if (!isCached(node)) {
Traverser evaluate(*this, node, Traverser::PRE_AND_POSTFIX);
evaluate.execute();
- // FIXME: If the root node didn't fit into the cache, the following assert
- // will fail. We should handle this differently:
- // 1) Return a NULL polyhedron, so the caller knows what happens
- // 2) Return the polyhedron in a reference parameter and return a status code
- // explicitly telling the caller what happened
- // 3) Somehow ask the user to increase cache size and continue processing
- assert(isCached(node));
+ return this->root;
assert(this->visitedchildren.empty());
}
- return CGALCache::instance()->get(this->tree.getIdString(node));
+ else {
+ return CGALCache::instance()->get(this->tree.getIdString(node));
+ }
}
bool CGALEvaluator::isCached(const AbstractNode &node) const
@@ -360,11 +356,11 @@ void CGALEvaluator::addToParent(const State &state, const AbstractNode &node, co
else {
// Root node, insert into cache
if (!isCached(node)) {
- CGALCache::instance()->insert(this->tree.getIdString(node), N);
- // FIXME: If the root node didn't fit into the cache, the following assert
- // will fail. See evaluateCGALMesh(const AbstractNode &node)
- assert(isCached(node));
+ if (!CGALCache::instance()->insert(this->tree.getIdString(node), N)) {
+ PRINTF("WARNING: CGAL Evaluator: Root node didn't fit into cache");
+ }
}
+ this->root = N;
}
}
contact: Jan Huwald // Impressum