From 6e63582c0b15be5c8109f6aecfbc192332d7e636 Mon Sep 17 00:00:00 2001
From: Jonathan Lambrechts <jonathan.lambrechts@uclouvain.be>
Date: Wed, 21 Apr 2010 14:32:58 +0000
Subject: [PATCH] function : correct replace mechanism

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

diff --git a/Solver/function.cpp b/Solver/function.cpp
index 2418fe4dc7..c50a86dd39 100644
--- a/Solver/function.cpp
+++ b/Solver/function.cpp
@@ -98,7 +98,8 @@ dataCacheDouble &dataCacheMap::get(const function *f, dataCacheDouble *caller) {
     if (it != cParent->_cacheDoubleMap.end()) {
       r = it->second;
       for (std::set<dataCacheDouble*>::iterator dep = r->_iDependOn.begin(); dep != r->_iDependOn.end(); dep++) {
-        if (&(*dep)->_cacheMap == this) {
+        //if (_cacheDoubleMap.find((*dep)->_function) != _cacheDoubleMap.end()) {
+        if (&get((*dep)->_function) != *dep) {
           r = NULL;
           break;
         }
@@ -499,9 +500,11 @@ void functionReplace::get(fullMatrix<double> &v, const function *f, int iMap) {
 }
 
 void functionReplace::compute(){
-  for (int i = 0; i < _toReplace.size(); i++)
+  for (int i = 0; i < _toReplace.size(); i++){
     currentCache->toReplace[i]->set();
+  }
   for (int i = 0; i < _toCompute.size(); i++) {
+    currentCache->toCompute[i]->_valid =false;
     _toCompute[i].val->setAsProxy((*currentCache->toCompute[i])());
   }
 };
-- 
GitLab