From a4038f9af114e942f954511bde4958e655a03b32 Mon Sep 17 00:00:00 2001
From: Jonathan Lambrechts <jonathan.lambrechts@uclouvain.be>
Date: Tue, 18 May 2010 14:01:17 +0000
Subject: [PATCH] function : remove bug in substituted functions

---
 Solver/function.cpp | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/Solver/function.cpp b/Solver/function.cpp
index 7f99316263..0e67868319 100644
--- a/Solver/function.cpp
+++ b/Solver/function.cpp
@@ -9,7 +9,6 @@
   #include "dlfcn.h"
 #endif
 #include "Bindings.h"
-
 function::~function() {
 }
 
@@ -51,8 +50,7 @@ dataCacheDouble::dataCacheDouble(dataCacheMap *m, function *f):
   m->addDataCacheDouble(this, f->isInvalitedOnElement());
   _function = f;
   for(unsigned i=0; i<f->_childrenCache.size(); i++) {
-    m->addSecondaryCache(m->newChild());
-  }
+    m->addSecondaryCache(m->newChild()); }
   _substitutions.resize(f->_substitutedFunctions.size());
   for(unsigned i=0; i<f->_substitutedFunctions.size(); i++) {
     function::substitutedFunction s = f->_substitutedFunctions[i];
@@ -92,9 +90,10 @@ dataCacheDouble &dataCacheMap::get(const function *f, dataCacheDouble *caller) {
   dataCacheDouble *&r = _cacheDoubleMap[f];
   dataCacheMap *cParent = _parent;
   while (cParent && r==NULL) {
-    std::map<const function *, dataCacheDouble *>::iterator it = cParent->_cacheDoubleMap.find(f);
-    if (it != cParent->_cacheDoubleMap.end()) {
-      r = it->second;
+    /*std::map<const function *, dataCacheDouble *>::iterator it = cParent->_cacheDoubleMap.find(f);
+    if (it != cParent->_cacheDoubleMap.end()) {*/
+     // r = it->second;
+     r = &_parent->get(f,caller);
       for (std::set<dataCacheDouble*>::iterator dep = r->_iDependOn.begin(); dep != r->_iDependOn.end(); dep++) {
         //if (_cacheDoubleMap.find((*dep)->_function) != _cacheDoubleMap.end()) {
         if (&get((*dep)->_function) != *dep) {
@@ -102,7 +101,7 @@ dataCacheDouble &dataCacheMap::get(const function *f, dataCacheDouble *caller) {
           break;
         }
       }
-    }
+    //}
     cParent = cParent->_parent;
   }
   if (r==NULL)
-- 
GitLab