From e8c73978f0622dcf9eb466f976d59603f641cae3 Mon Sep 17 00:00:00 2001 From: Jonathan Lambrechts <jonathan.lambrechts@uclouvain.be> Date: Tue, 20 Apr 2010 22:19:06 +0000 Subject: [PATCH] dg : outsideValueBoundary as child dataCacheMap --- Solver/function.cpp | 6 +++++- Solver/function.h | 10 +++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Solver/function.cpp b/Solver/function.cpp index daf9595071..742d0221c1 100644 --- a/Solver/function.cpp +++ b/Solver/function.cpp @@ -71,14 +71,18 @@ dataCacheDouble &dataCacheMap::get(const function *f, dataCacheDouble *caller) r = it->second; for (std::set<dataCacheDouble*>::iterator dep = r->_iDependOn.begin(); dep != r->_iDependOn.end(); dep++) { if (&(*dep)->_cacheMap == this) { + throw; r = NULL; break; } } } } - if (r==NULL) + if (r==NULL) { + if(_parent) + throw; r = new dataCacheDouble(this, (function*)(f)); + } if (caller) r->addMeAsDependencyOf(caller); return *r; diff --git a/Solver/function.h b/Solver/function.h index d099676280..84a38f783c 100644 --- a/Solver/function.h +++ b/Solver/function.h @@ -147,6 +147,7 @@ class dgDataCacheMap; // more explanation at the head of this file class dataCacheMap { friend class dataCacheDouble; + protected: dataCacheMap *_parent; std::list<dataCacheMap*> _children; std::vector<dataCacheMap*> _secondaryCaches; @@ -155,15 +156,18 @@ class dataCacheMap { std::set<dataCacheDouble*> _allDataCaches; std::set<dataCacheDouble*> _toInvalidateOnElement; - MElement *_element; - protected: + MElement *_element; void addDataCacheDouble(dataCacheDouble *data, bool invalidatedOnElement){ _allDataCaches.insert(data); if(invalidatedOnElement) _toInvalidateOnElement.insert(data); } public: + void printList() { + for(std::set<dataCacheDouble*>::iterator it = _toInvalidateOnElement.begin(); it!= _toInvalidateOnElement.end(); it++) + printf("%p\n",*it); + } virtual dgDataCacheMap *asDgDataCacheMap() { Msg::Error("I'm not a dgDataCacheMap\n"); return NULL; @@ -195,7 +199,7 @@ class dataCacheMap { _nbEvaluationPoints = 0; _parent=NULL; } - dataCacheMap(dataCacheMap *parent) { + void setParent(dataCacheMap *parent) { _parent = parent; _parent->_children.push_back(this); _nbEvaluationPoints = 0; -- GitLab