From a440719eb353bb34d0f985d92b536a0ecbd1b72c Mon Sep 17 00:00:00 2001
From: Jonathan Lambrechts <jonathan.lambrechts@uclouvain.be>
Date: Tue, 20 Apr 2010 22:18:59 +0000
Subject: [PATCH] dg : term of equations can be functions but not the boundary
 conditions

---
 Solver/function.cpp | 4 ++--
 Solver/function.h   | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/Solver/function.cpp b/Solver/function.cpp
index c135be15a8..daf9595071 100644
--- a/Solver/function.cpp
+++ b/Solver/function.cpp
@@ -78,7 +78,7 @@ dataCacheDouble &dataCacheMap::get(const function *f, dataCacheDouble *caller)
     }
   }
   if (r==NULL)
-    r = new dataCacheDouble(this, const_cast<function*>(f));
+    r = new dataCacheDouble(this, (function*)(f));
   if (caller)
     r->addMeAsDependencyOf(caller);
   return *r;
@@ -87,7 +87,7 @@ dataCacheDouble &dataCacheMap::get(const function *f, dataCacheDouble *caller)
 dataCacheDouble &dataCacheMap::substitute(const function *f) 
 {
   dataCacheDouble *&r= _cacheDoubleMap[f];
-  r = new dataCacheDouble(this, const_cast<function*>(f));
+  r = new dataCacheDouble(this, (function*)(f));
   return *r;
 }
 
diff --git a/Solver/function.h b/Solver/function.h
index 193eddeee4..d099676280 100644
--- a/Solver/function.h
+++ b/Solver/function.h
@@ -52,6 +52,8 @@ class function {
   virtual void call (dataCacheMap *m, fullMatrix<double> &res)=0;
   std::vector<argument*> arguments;
   const fullMatrix<double> &addArgument(const function *f, int iMap = 0) {
+    if(f==NULL)
+      throw;
     arguments.push_back(new argument(iMap, f));
     return arguments.back()->val;
   }
@@ -173,6 +175,9 @@ class dataCacheMap {
   }
   void addSecondaryCache(dataCacheMap *s) {
     _secondaryCaches.push_back(s);
+    if(_secondaryCaches.size()>1){
+      printf("!!!!!!!!!!!!!!!!!!!!!\n");
+    }
   }
   dataCacheDouble &get(const function *f, dataCacheDouble *caller=0);
   dataCacheDouble &substitute(const function *f);
-- 
GitLab